diff --git a/java-aiplatform/README.md b/java-aiplatform/README.md index 943c5fcf488f..b4c5c3e86bc5 100644 --- a/java-aiplatform/README.md +++ b/java-aiplatform/README.md @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.19.0 + 26.20.0 pom import @@ -42,20 +42,20 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-aiplatform - 3.22.0 + 3.23.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-aiplatform:3.22.0' +implementation 'com.google.cloud:google-cloud-aiplatform:3.23.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.22.0" +libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.23.0" ``` @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-aiplatform.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.22.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.23.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java index 2198d770fe1a..3f192e8ed984 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java @@ -24,6 +24,7 @@ import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1.stub.PredictionServiceStub; import com.google.cloud.aiplatform.v1.stub.PredictionServiceStubSettings; @@ -535,6 +536,41 @@ public final UnaryCallable rawPredictCallable() { return stub.rawPredictCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform a server-side streaming online prediction request for Vertex LLM streaming. + * + *

Sample code: + * + *

{@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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   StreamingPredictRequest request =
+   *       StreamingPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllInputs(new ArrayList())
+   *           .setParameters(Tensor.newBuilder().build())
+   *           .build();
+   *   ServerStream stream =
+   *       predictionServiceClient.serverStreamingPredictCallable().call(request);
+   *   for (StreamingPredictResponse response : stream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final ServerStreamingCallable + serverStreamingPredictCallable() { + return stub.serverStreamingPredictCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Perform an online explanation. diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java index 4337f2f9accd..beedb36b2526 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java @@ -28,6 +28,7 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.aiplatform.v1.stub.PredictionServiceStubSettings; @@ -94,6 +95,12 @@ public UnaryCallSettings rawPredictSettings() { return ((PredictionServiceStubSettings) getStubSettings()).rawPredictSettings(); } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings + serverStreamingPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).serverStreamingPredictSettings(); + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return ((PredictionServiceStubSettings) getStubSettings()).explainSettings(); @@ -233,6 +240,12 @@ public UnaryCallSettings.Builder rawPredictSettings return getStubSettingsBuilder().rawPredictSettings(); } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings.Builder + serverStreamingPredictSettings() { + return getStubSettingsBuilder().serverStreamingPredictSettings(); + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return getStubSettingsBuilder().explainSettings(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceClient.java new file mode 100644 index 000000000000..d25f1bfe6f0d --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceClient.java @@ -0,0 +1,1721 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.aiplatform.v1.stub.ScheduleServiceStub; +import com.google.cloud.aiplatform.v1.stub.ScheduleServiceStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: A service for creating and managing Vertex AI's Schedule resources to + * periodically launch shceudled runs to make API calls. + * + *

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: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   Schedule schedule = Schedule.newBuilder().build();
+ *   Schedule response = scheduleServiceClient.createSchedule(parent, schedule);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the ScheduleServiceClient 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 ScheduleServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@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
+ * ScheduleServiceSettings scheduleServiceSettings =
+ *     ScheduleServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ScheduleServiceClient scheduleServiceClient =
+ *     ScheduleServiceClient.create(scheduleServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@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
+ * ScheduleServiceSettings scheduleServiceSettings =
+ *     ScheduleServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ScheduleServiceClient scheduleServiceClient =
+ *     ScheduleServiceClient.create(scheduleServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ScheduleServiceClient implements BackgroundResource { + private final ScheduleServiceSettings settings; + private final ScheduleServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of ScheduleServiceClient with default settings. */ + public static final ScheduleServiceClient create() throws IOException { + return create(ScheduleServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ScheduleServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ScheduleServiceClient create(ScheduleServiceSettings settings) + throws IOException { + return new ScheduleServiceClient(settings); + } + + /** + * Constructs an instance of ScheduleServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(ScheduleServiceSettings). + */ + public static final ScheduleServiceClient create(ScheduleServiceStub stub) { + return new ScheduleServiceClient(stub); + } + + /** + * Constructs an instance of ScheduleServiceClient, 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. + */ + protected ScheduleServiceClient(ScheduleServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ScheduleServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + protected ScheduleServiceClient(ScheduleServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final ScheduleServiceSettings getSettings() { + return settings; + } + + public ScheduleServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Schedule schedule = Schedule.newBuilder().build();
+   *   Schedule response = scheduleServiceClient.createSchedule(parent, schedule);
+   * }
+   * }
+ * + * @param parent Required. The resource name of the Location to create the Schedule in. Format: + * `projects/{project}/locations/{location}` + * @param schedule Required. The Schedule to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule createSchedule(LocationName parent, Schedule schedule) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSchedule(schedule) + .build(); + return createSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Schedule schedule = Schedule.newBuilder().build();
+   *   Schedule response = scheduleServiceClient.createSchedule(parent, schedule);
+   * }
+   * }
+ * + * @param parent Required. The resource name of the Location to create the Schedule in. Format: + * `projects/{project}/locations/{location}` + * @param schedule Required. The Schedule to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule createSchedule(String parent, Schedule schedule) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder().setParent(parent).setSchedule(schedule).build(); + return createSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   CreateScheduleRequest request =
+   *       CreateScheduleRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setSchedule(Schedule.newBuilder().build())
+   *           .build();
+   *   Schedule response = scheduleServiceClient.createSchedule(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule createSchedule(CreateScheduleRequest request) { + return createScheduleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   CreateScheduleRequest request =
+   *       CreateScheduleRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setSchedule(Schedule.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.createScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   Schedule response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createScheduleCallable() { + return stub.createScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]");
+   *   scheduleServiceClient.deleteScheduleAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be deleted. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteScheduleAsync( + ScheduleName name) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteScheduleAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString();
+   *   scheduleServiceClient.deleteScheduleAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be deleted. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteScheduleAsync(String name) { + DeleteScheduleRequest request = DeleteScheduleRequest.newBuilder().setName(name).build(); + return deleteScheduleAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   DeleteScheduleRequest request =
+   *       DeleteScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   scheduleServiceClient.deleteScheduleAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteScheduleAsync( + DeleteScheduleRequest request) { + return deleteScheduleOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   DeleteScheduleRequest request =
+   *       DeleteScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       scheduleServiceClient.deleteScheduleOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteScheduleOperationCallable() { + return stub.deleteScheduleOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   DeleteScheduleRequest request =
+   *       DeleteScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.deleteScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteScheduleCallable() { + return stub.deleteScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]");
+   *   Schedule response = scheduleServiceClient.getSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule getSchedule(ScheduleName name) { + GetScheduleRequest request = + GetScheduleRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString();
+   *   Schedule response = scheduleServiceClient.getSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule getSchedule(String name) { + GetScheduleRequest request = GetScheduleRequest.newBuilder().setName(name).build(); + return getSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetScheduleRequest request =
+   *       GetScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   Schedule response = scheduleServiceClient.getSchedule(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule getSchedule(GetScheduleRequest request) { + return getScheduleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Schedule. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetScheduleRequest request =
+   *       GetScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   ApiFuture future = scheduleServiceClient.getScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   Schedule response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getScheduleCallable() { + return stub.getScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Schedules in a Location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The resource name of the Location to list the Schedules from. Format: + * `projects/{project}/locations/{location}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchedulesPagedResponse listSchedules(LocationName parent) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listSchedules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Schedules in a Location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The resource name of the Location to list the Schedules from. Format: + * `projects/{project}/locations/{location}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchedulesPagedResponse listSchedules(String parent) { + ListSchedulesRequest request = ListSchedulesRequest.newBuilder().setParent(parent).build(); + return listSchedules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Schedules in a Location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListSchedulesRequest request =
+   *       ListSchedulesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   for (Schedule element : scheduleServiceClient.listSchedules(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchedulesPagedResponse listSchedules(ListSchedulesRequest request) { + return listSchedulesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Schedules in a Location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListSchedulesRequest request =
+   *       ListSchedulesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.listSchedulesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Schedule element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listSchedulesPagedCallable() { + return stub.listSchedulesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Schedules in a Location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListSchedulesRequest request =
+   *       ListSchedulesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   while (true) {
+   *     ListSchedulesResponse response =
+   *         scheduleServiceClient.listSchedulesCallable().call(request);
+   *     for (Schedule element : response.getSchedulesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listSchedulesCallable() { + return stub.listSchedulesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to + * 'PAUSED'. If the schedule is paused, no new runs will be created. Already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]");
+   *   scheduleServiceClient.pauseSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be paused. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void pauseSchedule(ScheduleName name) { + PauseScheduleRequest request = + PauseScheduleRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + pauseSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to + * 'PAUSED'. If the schedule is paused, no new runs will be created. Already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString();
+   *   scheduleServiceClient.pauseSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be paused. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void pauseSchedule(String name) { + PauseScheduleRequest request = PauseScheduleRequest.newBuilder().setName(name).build(); + pauseSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to + * 'PAUSED'. If the schedule is paused, no new runs will be created. Already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   PauseScheduleRequest request =
+   *       PauseScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   scheduleServiceClient.pauseSchedule(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void pauseSchedule(PauseScheduleRequest request) { + pauseScheduleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to + * 'PAUSED'. If the schedule is paused, no new runs will be created. Already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   PauseScheduleRequest request =
+   *       PauseScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .build();
+   *   ApiFuture future = scheduleServiceClient.pauseScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable pauseScheduleCallable() { + return stub.pauseScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]");
+   *   scheduleServiceClient.resumeSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be resumed. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void resumeSchedule(ScheduleName name) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + resumeSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString();
+   *   scheduleServiceClient.resumeSchedule(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be resumed. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void resumeSchedule(String name) { + ResumeScheduleRequest request = ResumeScheduleRequest.newBuilder().setName(name).build(); + resumeSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]");
+   *   boolean catchUp = true;
+   *   scheduleServiceClient.resumeSchedule(name, catchUp);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be resumed. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @param catchUp Optional. Whether to backfill missed runs when the schedule is resumed from + * PAUSED state. If set to true, all missed runs will be scheduled. New runs will be scheduled + * after the backfill is complete. This will also update + * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field. Default to false. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void resumeSchedule(ScheduleName name, boolean catchUp) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCatchUp(catchUp) + .build(); + resumeSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString();
+   *   boolean catchUp = true;
+   *   scheduleServiceClient.resumeSchedule(name, catchUp);
+   * }
+   * }
+ * + * @param name Required. The name of the Schedule resource to be resumed. Format: + * `projects/{project}/locations/{location}/schedules/{schedule}` + * @param catchUp Optional. Whether to backfill missed runs when the schedule is resumed from + * PAUSED state. If set to true, all missed runs will be scheduled. New runs will be scheduled + * after the backfill is complete. This will also update + * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field. Default to false. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void resumeSchedule(String name, boolean catchUp) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder().setName(name).setCatchUp(catchUp).build(); + resumeSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ResumeScheduleRequest request =
+   *       ResumeScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .setCatchUp(true)
+   *           .build();
+   *   scheduleServiceClient.resumeSchedule(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void resumeSchedule(ResumeScheduleRequest request) { + resumeScheduleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes a paused Schedule to start scheduling new runs. Will mark + * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. Only paused Schedule + * can be resumed. + * + *

When the Schedule is resumed, new runs will be scheduled starting from the next execution + * time after the current time based on the time_specification in the Schedule. If + * [Schedule.catchUp][] is set up true, all missed runs will be scheduled for backfill first. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ResumeScheduleRequest request =
+   *       ResumeScheduleRequest.newBuilder()
+   *           .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString())
+   *           .setCatchUp(true)
+   *           .build();
+   *   ApiFuture future = scheduleServiceClient.resumeScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable resumeScheduleCallable() { + return stub.resumeScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an active or paused Schedule. + * + *

When the Schedule is updated, new runs will be scheduled starting from the updated next + * execution time after the update time based on the time_specification in the updated Schedule. + * All unstarted runs before the update time will be skipped while already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   Schedule schedule = Schedule.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Schedule response = scheduleServiceClient.updateSchedule(schedule, updateMask);
+   * }
+   * }
+ * + * @param schedule Required. The Schedule which replaces the resource on the server. The following + * restrictions will be applied: * The scheduled request type cannot be changed. * The + * output_only fields will be ignored if specified. + * @param updateMask Required. The update mask applies to the resource. See + * [google.protobuf.FieldMask][google.protobuf.FieldMask]. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule updateSchedule(Schedule schedule, FieldMask updateMask) { + UpdateScheduleRequest request = + UpdateScheduleRequest.newBuilder().setSchedule(schedule).setUpdateMask(updateMask).build(); + return updateSchedule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an active or paused Schedule. + * + *

When the Schedule is updated, new runs will be scheduled starting from the updated next + * execution time after the update time based on the time_specification in the updated Schedule. + * All unstarted runs before the update time will be skipped while already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   UpdateScheduleRequest request =
+   *       UpdateScheduleRequest.newBuilder()
+   *           .setSchedule(Schedule.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Schedule response = scheduleServiceClient.updateSchedule(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schedule updateSchedule(UpdateScheduleRequest request) { + return updateScheduleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an active or paused Schedule. + * + *

When the Schedule is updated, new runs will be scheduled starting from the updated next + * execution time after the update time based on the time_specification in the updated Schedule. + * All unstarted runs before the update time will be skipped while already created runs will NOT + * be paused or canceled. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   UpdateScheduleRequest request =
+   *       UpdateScheduleRequest.newBuilder()
+   *           .setSchedule(Schedule.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.updateScheduleCallable().futureCall(request);
+   *   // Do something.
+   *   Schedule response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateScheduleCallable() { + return stub.updateScheduleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : scheduleServiceClient.listLocations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         scheduleServiceClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = scheduleServiceClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = scheduleServiceClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Policy response = scheduleServiceClient.setIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = scheduleServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = scheduleServiceClient.getIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = scheduleServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response = scheduleServiceClient.testIamPermissions(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *

Sample code: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       scheduleServiceClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListSchedulesPagedResponse + extends AbstractPagedListResponse< + ListSchedulesRequest, + ListSchedulesResponse, + Schedule, + ListSchedulesPage, + ListSchedulesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSchedulesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListSchedulesPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListSchedulesPagedResponse(ListSchedulesPage page) { + super(page, ListSchedulesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSchedulesPage + extends AbstractPage< + ListSchedulesRequest, ListSchedulesResponse, Schedule, ListSchedulesPage> { + + private ListSchedulesPage( + PageContext context, + ListSchedulesResponse response) { + super(context, response); + } + + private static ListSchedulesPage createEmptyPage() { + return new ListSchedulesPage(null, null); + } + + @Override + protected ListSchedulesPage createPage( + PageContext context, + ListSchedulesResponse response) { + return new ListSchedulesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSchedulesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSchedulesRequest, + ListSchedulesResponse, + Schedule, + ListSchedulesPage, + ListSchedulesFixedSizeCollection> { + + private ListSchedulesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSchedulesFixedSizeCollection createEmptyCollection() { + return new ListSchedulesFixedSizeCollection(null, 0); + } + + @Override + protected ListSchedulesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSchedulesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceSettings.java new file mode 100644 index 000000000000..22465dbd45c7 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceSettings.java @@ -0,0 +1,332 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListLocationsPagedResponse; +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListSchedulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.aiplatform.v1.stub.ScheduleServiceStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ScheduleServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (aiplatform.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createSchedule to 30 seconds: + * + *

{@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
+ * ScheduleServiceSettings.Builder scheduleServiceSettingsBuilder =
+ *     ScheduleServiceSettings.newBuilder();
+ * scheduleServiceSettingsBuilder
+ *     .createScheduleSettings()
+ *     .setRetrySettings(
+ *         scheduleServiceSettingsBuilder
+ *             .createScheduleSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ScheduleServiceSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ScheduleServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createSchedule. */ + public UnaryCallSettings createScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).createScheduleSettings(); + } + + /** Returns the object with the settings used for calls to deleteSchedule. */ + public UnaryCallSettings deleteScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).deleteScheduleSettings(); + } + + /** Returns the object with the settings used for calls to deleteSchedule. */ + public OperationCallSettings + deleteScheduleOperationSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).deleteScheduleOperationSettings(); + } + + /** Returns the object with the settings used for calls to getSchedule. */ + public UnaryCallSettings getScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).getScheduleSettings(); + } + + /** Returns the object with the settings used for calls to listSchedules. */ + public PagedCallSettings + listSchedulesSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).listSchedulesSettings(); + } + + /** Returns the object with the settings used for calls to pauseSchedule. */ + public UnaryCallSettings pauseScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).pauseScheduleSettings(); + } + + /** Returns the object with the settings used for calls to resumeSchedule. */ + public UnaryCallSettings resumeScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).resumeScheduleSettings(); + } + + /** Returns the object with the settings used for calls to updateSchedule. */ + public UnaryCallSettings updateScheduleSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).updateScheduleSettings(); + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).getLocationSettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((ScheduleServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + + public static final ScheduleServiceSettings create(ScheduleServiceStubSettings stub) + throws IOException { + return new ScheduleServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ScheduleServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ScheduleServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ScheduleServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ScheduleServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ScheduleServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ScheduleServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ScheduleServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ScheduleServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ScheduleServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ScheduleServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(ScheduleServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ScheduleServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ScheduleServiceStubSettings.newBuilder()); + } + + public ScheduleServiceStubSettings.Builder getStubSettingsBuilder() { + return ((ScheduleServiceStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createSchedule. */ + public UnaryCallSettings.Builder createScheduleSettings() { + return getStubSettingsBuilder().createScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to deleteSchedule. */ + public UnaryCallSettings.Builder deleteScheduleSettings() { + return getStubSettingsBuilder().deleteScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to deleteSchedule. */ + public OperationCallSettings.Builder + deleteScheduleOperationSettings() { + return getStubSettingsBuilder().deleteScheduleOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getSchedule. */ + public UnaryCallSettings.Builder getScheduleSettings() { + return getStubSettingsBuilder().getScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to listSchedules. */ + public PagedCallSettings.Builder< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse> + listSchedulesSettings() { + return getStubSettingsBuilder().listSchedulesSettings(); + } + + /** Returns the builder for the settings used for calls to pauseSchedule. */ + public UnaryCallSettings.Builder pauseScheduleSettings() { + return getStubSettingsBuilder().pauseScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to resumeSchedule. */ + public UnaryCallSettings.Builder resumeScheduleSettings() { + return getStubSettingsBuilder().resumeScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to updateSchedule. */ + public UnaryCallSettings.Builder updateScheduleSettings() { + return getStubSettingsBuilder().updateScheduleSettings(); + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + + @Override + public ScheduleServiceSettings build() throws IOException { + return new ScheduleServiceSettings(this); + } + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json index fbadbc292ed4..5da5ca02aa3c 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json @@ -820,11 +820,59 @@ "RawPredict": { "methods": ["rawPredict", "rawPredict", "rawPredict", "rawPredictCallable"] }, + "ServerStreamingPredict": { + "methods": ["serverStreamingPredictCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + } + } + } + } + }, + "ScheduleService": { + "clients": { + "grpc": { + "libraryClient": "ScheduleServiceClient", + "rpcs": { + "CreateSchedule": { + "methods": ["createSchedule", "createSchedule", "createSchedule", "createScheduleCallable"] + }, + "DeleteSchedule": { + "methods": ["deleteScheduleAsync", "deleteScheduleAsync", "deleteScheduleAsync", "deleteScheduleOperationCallable", "deleteScheduleCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "GetSchedule": { + "methods": ["getSchedule", "getSchedule", "getSchedule", "getScheduleCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, + "ListSchedules": { + "methods": ["listSchedules", "listSchedules", "listSchedules", "listSchedulesPagedCallable", "listSchedulesCallable"] + }, + "PauseSchedule": { + "methods": ["pauseSchedule", "pauseSchedule", "pauseSchedule", "pauseScheduleCallable"] + }, + "ResumeSchedule": { + "methods": ["resumeSchedule", "resumeSchedule", "resumeSchedule", "resumeSchedule", "resumeSchedule", "resumeScheduleCallable"] + }, "SetIamPolicy": { "methods": ["setIamPolicy", "setIamPolicyCallable"] }, "TestIamPermissions": { "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "UpdateSchedule": { + "methods": ["updateSchedule", "updateSchedule", "updateScheduleCallable"] } } } diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/package-info.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/package-info.java index a5b6f8fa7019..e7155cba4c33 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/package-info.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/package-info.java @@ -293,6 +293,26 @@ * } * } * + *

======================= ScheduleServiceClient ======================= + * + *

Service Description: A service for creating and managing Vertex AI's Schedule resources to + * periodically launch shceudled runs to make API calls. + * + *

Sample for ScheduleServiceClient: + * + *

{@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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   Schedule schedule = Schedule.newBuilder().build();
+ *   Schedule response = scheduleServiceClient.createSchedule(parent, schedule);
+ * }
+ * }
+ * *

======================= SpecialistPoolServiceClient ======================= * *

Service Description: A service for creating and managing Customer SpecialistPools. When diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java index 43d8265ce400..461ffd2f68db 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java @@ -25,12 +25,15 @@ import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1.ExplainRequest; import com.google.cloud.aiplatform.v1.ExplainResponse; import com.google.cloud.aiplatform.v1.PredictRequest; import com.google.cloud.aiplatform.v1.PredictResponse; import com.google.cloud.aiplatform.v1.RawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -71,6 +74,18 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) .build(); + private static final MethodDescriptor + serverStreamingPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName( + "google.cloud.aiplatform.v1.PredictionService/ServerStreamingPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor explainMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -127,6 +142,8 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { private final UnaryCallable predictCallable; private final UnaryCallable rawPredictCallable; + private final ServerStreamingCallable + serverStreamingPredictCallable; private final UnaryCallable explainCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable @@ -201,6 +218,17 @@ protected GrpcPredictionServiceStub( return builder.build(); }) .build(); + GrpcCallSettings + serverStreamingPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(serverStreamingPredictMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("endpoint", String.valueOf(request.getEndpoint())); + return builder.build(); + }) + .build(); GrpcCallSettings explainTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(explainMethodDescriptor) @@ -269,6 +297,11 @@ protected GrpcPredictionServiceStub( this.rawPredictCallable = callableFactory.createUnaryCallable( rawPredictTransportSettings, settings.rawPredictSettings(), clientContext); + this.serverStreamingPredictCallable = + callableFactory.createServerStreamingCallable( + serverStreamingPredictTransportSettings, + settings.serverStreamingPredictSettings(), + clientContext); this.explainCallable = callableFactory.createUnaryCallable( explainTransportSettings, settings.explainSettings(), clientContext); @@ -311,6 +344,12 @@ public UnaryCallable rawPredictCallable() { return rawPredictCallable; } + @Override + public ServerStreamingCallable + serverStreamingPredictCallable() { + return serverStreamingPredictCallable; + } + @Override public UnaryCallable explainCallable() { return explainCallable; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceCallableFactory.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceCallableFactory.java new file mode 100644 index 000000000000..fda95b853ae6 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ScheduleService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcScheduleServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceStub.java new file mode 100644 index 000000000000..55f47890a55a --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcScheduleServiceStub.java @@ -0,0 +1,538 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub; + +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListLocationsPagedResponse; +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListSchedulesPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.aiplatform.v1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesResponse; +import com.google.cloud.aiplatform.v1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.UpdateScheduleRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ScheduleService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcScheduleServiceStub extends ScheduleServiceStub { + private static final MethodDescriptor + createScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/CreateSchedule") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schedule.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/DeleteSchedule") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/GetSchedule") + .setRequestMarshaller(ProtoUtils.marshaller(GetScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schedule.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listSchedulesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/ListSchedules") + .setRequestMarshaller( + ProtoUtils.marshaller(ListSchedulesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListSchedulesResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor pauseScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/PauseSchedule") + .setRequestMarshaller(ProtoUtils.marshaller(PauseScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + resumeScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/ResumeSchedule") + .setRequestMarshaller( + ProtoUtils.marshaller(ResumeScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateScheduleMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1.ScheduleService/UpdateSchedule") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateScheduleRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schedule.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable createScheduleCallable; + private final UnaryCallable deleteScheduleCallable; + private final OperationCallable + deleteScheduleOperationCallable; + private final UnaryCallable getScheduleCallable; + private final UnaryCallable listSchedulesCallable; + private final UnaryCallable + listSchedulesPagedCallable; + private final UnaryCallable pauseScheduleCallable; + private final UnaryCallable resumeScheduleCallable; + private final UnaryCallable updateScheduleCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcScheduleServiceStub create(ScheduleServiceStubSettings settings) + throws IOException { + return new GrpcScheduleServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcScheduleServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcScheduleServiceStub( + ScheduleServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcScheduleServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcScheduleServiceStub( + ScheduleServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcScheduleServiceStub, 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. + */ + protected GrpcScheduleServiceStub( + ScheduleServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcScheduleServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcScheduleServiceStub, 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. + */ + protected GrpcScheduleServiceStub( + ScheduleServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + GrpcCallSettings deleteScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings getScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings listSchedulesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listSchedulesMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + GrpcCallSettings pauseScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(pauseScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings resumeScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(resumeScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings updateScheduleTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateScheduleMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("schedule.name", String.valueOf(request.getSchedule().getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .build(); + + this.createScheduleCallable = + callableFactory.createUnaryCallable( + createScheduleTransportSettings, settings.createScheduleSettings(), clientContext); + this.deleteScheduleCallable = + callableFactory.createUnaryCallable( + deleteScheduleTransportSettings, settings.deleteScheduleSettings(), clientContext); + this.deleteScheduleOperationCallable = + callableFactory.createOperationCallable( + deleteScheduleTransportSettings, + settings.deleteScheduleOperationSettings(), + clientContext, + operationsStub); + this.getScheduleCallable = + callableFactory.createUnaryCallable( + getScheduleTransportSettings, settings.getScheduleSettings(), clientContext); + this.listSchedulesCallable = + callableFactory.createUnaryCallable( + listSchedulesTransportSettings, settings.listSchedulesSettings(), clientContext); + this.listSchedulesPagedCallable = + callableFactory.createPagedCallable( + listSchedulesTransportSettings, settings.listSchedulesSettings(), clientContext); + this.pauseScheduleCallable = + callableFactory.createUnaryCallable( + pauseScheduleTransportSettings, settings.pauseScheduleSettings(), clientContext); + this.resumeScheduleCallable = + callableFactory.createUnaryCallable( + resumeScheduleTransportSettings, settings.resumeScheduleSettings(), clientContext); + this.updateScheduleCallable = + callableFactory.createUnaryCallable( + updateScheduleTransportSettings, settings.updateScheduleSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createScheduleCallable() { + return createScheduleCallable; + } + + @Override + public UnaryCallable deleteScheduleCallable() { + return deleteScheduleCallable; + } + + @Override + public OperationCallable + deleteScheduleOperationCallable() { + return deleteScheduleOperationCallable; + } + + @Override + public UnaryCallable getScheduleCallable() { + return getScheduleCallable; + } + + @Override + public UnaryCallable listSchedulesCallable() { + return listSchedulesCallable; + } + + @Override + public UnaryCallable + listSchedulesPagedCallable() { + return listSchedulesPagedCallable; + } + + @Override + public UnaryCallable pauseScheduleCallable() { + return pauseScheduleCallable; + } + + @Override + public UnaryCallable resumeScheduleCallable() { + return resumeScheduleCallable; + } + + @Override + public UnaryCallable updateScheduleCallable() { + return updateScheduleCallable; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java index 3a4b8930f5f0..36417dbfc42e 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java @@ -20,12 +20,15 @@ import com.google.api.HttpBody; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1.ExplainRequest; import com.google.cloud.aiplatform.v1.ExplainResponse; import com.google.cloud.aiplatform.v1.PredictRequest; import com.google.cloud.aiplatform.v1.PredictResponse; import com.google.cloud.aiplatform.v1.RawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -54,6 +57,11 @@ public UnaryCallable rawPredictCallable() { throw new UnsupportedOperationException("Not implemented: rawPredictCallable()"); } + public ServerStreamingCallable + serverStreamingPredictCallable() { + throw new UnsupportedOperationException("Not implemented: serverStreamingPredictCallable()"); + } + public UnaryCallable explainCallable() { throw new UnsupportedOperationException("Not implemented: explainCallable()"); } diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java index 13e7e8ec6b84..09970c36306a 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java @@ -36,6 +36,7 @@ import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; @@ -46,6 +47,8 @@ import com.google.cloud.aiplatform.v1.PredictRequest; import com.google.cloud.aiplatform.v1.PredictResponse; import com.google.cloud.aiplatform.v1.RawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -109,6 +112,8 @@ public class PredictionServiceStubSettings extends StubSettings predictSettings; private final UnaryCallSettings rawPredictSettings; + private final ServerStreamingCallSettings + serverStreamingPredictSettings; private final UnaryCallSettings explainSettings; private final PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -182,6 +187,12 @@ public UnaryCallSettings rawPredictSettings() { return rawPredictSettings; } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings + serverStreamingPredictSettings() { + return serverStreamingPredictSettings; + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return explainSettings; @@ -291,6 +302,7 @@ protected PredictionServiceStubSettings(Builder settingsBuilder) throws IOExcept predictSettings = settingsBuilder.predictSettings().build(); rawPredictSettings = settingsBuilder.rawPredictSettings().build(); + serverStreamingPredictSettings = settingsBuilder.serverStreamingPredictSettings().build(); explainSettings = settingsBuilder.explainSettings().build(); listLocationsSettings = settingsBuilder.listLocationsSettings().build(); getLocationSettings = settingsBuilder.getLocationSettings().build(); @@ -304,6 +316,9 @@ public static class Builder extends StubSettings.Builder> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder predictSettings; private final UnaryCallSettings.Builder rawPredictSettings; + private final ServerStreamingCallSettings.Builder< + StreamingPredictRequest, StreamingPredictResponse> + serverStreamingPredictSettings; private final UnaryCallSettings.Builder explainSettings; private final PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -342,6 +357,7 @@ protected Builder(ClientContext clientContext) { predictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); rawPredictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + serverStreamingPredictSettings = ServerStreamingCallSettings.newBuilder(); explainSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -367,6 +383,7 @@ protected Builder(PredictionServiceStubSettings settings) { predictSettings = settings.predictSettings.toBuilder(); rawPredictSettings = settings.rawPredictSettings.toBuilder(); + serverStreamingPredictSettings = settings.serverStreamingPredictSettings.toBuilder(); explainSettings = settings.explainSettings.toBuilder(); listLocationsSettings = settings.listLocationsSettings.toBuilder(); getLocationSettings = settings.getLocationSettings.toBuilder(); @@ -410,6 +427,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder + .serverStreamingPredictSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .explainSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) @@ -468,6 +490,12 @@ public UnaryCallSettings.Builder rawPredictSettings return rawPredictSettings; } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings.Builder + serverStreamingPredictSettings() { + return serverStreamingPredictSettings; + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return explainSettings; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStub.java new file mode 100644 index 000000000000..75209f89ba84 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStub.java @@ -0,0 +1,128 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub; + +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListLocationsPagedResponse; +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListSchedulesPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.aiplatform.v1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesResponse; +import com.google.cloud.aiplatform.v1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.UpdateScheduleRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ScheduleService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ScheduleServiceStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable createScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: createScheduleCallable()"); + } + + public OperationCallable + deleteScheduleOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteScheduleOperationCallable()"); + } + + public UnaryCallable deleteScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: deleteScheduleCallable()"); + } + + public UnaryCallable getScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: getScheduleCallable()"); + } + + public UnaryCallable + listSchedulesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSchedulesPagedCallable()"); + } + + public UnaryCallable listSchedulesCallable() { + throw new UnsupportedOperationException("Not implemented: listSchedulesCallable()"); + } + + public UnaryCallable pauseScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: pauseScheduleCallable()"); + } + + public UnaryCallable resumeScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: resumeScheduleCallable()"); + } + + public UnaryCallable updateScheduleCallable() { + throw new UnsupportedOperationException("Not implemented: updateScheduleCallable()"); + } + + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStubSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStubSettings.java new file mode 100644 index 000000000000..d8c31a9bfae4 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/ScheduleServiceStubSettings.java @@ -0,0 +1,715 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub; + +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListLocationsPagedResponse; +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListSchedulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.aiplatform.v1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesResponse; +import com.google.cloud.aiplatform.v1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.UpdateScheduleRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ScheduleServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (aiplatform.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createSchedule to 30 seconds: + * + *

{@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
+ * ScheduleServiceStubSettings.Builder scheduleServiceSettingsBuilder =
+ *     ScheduleServiceStubSettings.newBuilder();
+ * scheduleServiceSettingsBuilder
+ *     .createScheduleSettings()
+ *     .setRetrySettings(
+ *         scheduleServiceSettingsBuilder
+ *             .createScheduleSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ScheduleServiceStubSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ScheduleServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createScheduleSettings; + private final UnaryCallSettings deleteScheduleSettings; + private final OperationCallSettings + deleteScheduleOperationSettings; + private final UnaryCallSettings getScheduleSettings; + private final PagedCallSettings< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse> + listSchedulesSettings; + private final UnaryCallSettings pauseScheduleSettings; + private final UnaryCallSettings resumeScheduleSettings; + private final UnaryCallSettings updateScheduleSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + private static final PagedListDescriptor + LIST_SCHEDULES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSchedulesRequest injectToken(ListSchedulesRequest payload, String token) { + return ListSchedulesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSchedulesRequest injectPageSize(ListSchedulesRequest payload, int pageSize) { + return ListSchedulesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSchedulesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSchedulesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSchedulesResponse payload) { + return payload.getSchedulesList() == null + ? ImmutableList.of() + : payload.getSchedulesList(); + } + }; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse> + LIST_SCHEDULES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSchedulesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SCHEDULES_PAGE_STR_DESC, request, context); + return ListSchedulesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createSchedule. */ + public UnaryCallSettings createScheduleSettings() { + return createScheduleSettings; + } + + /** Returns the object with the settings used for calls to deleteSchedule. */ + public UnaryCallSettings deleteScheduleSettings() { + return deleteScheduleSettings; + } + + /** Returns the object with the settings used for calls to deleteSchedule. */ + public OperationCallSettings + deleteScheduleOperationSettings() { + return deleteScheduleOperationSettings; + } + + /** Returns the object with the settings used for calls to getSchedule. */ + public UnaryCallSettings getScheduleSettings() { + return getScheduleSettings; + } + + /** Returns the object with the settings used for calls to listSchedules. */ + public PagedCallSettings + listSchedulesSettings() { + return listSchedulesSettings; + } + + /** Returns the object with the settings used for calls to pauseSchedule. */ + public UnaryCallSettings pauseScheduleSettings() { + return pauseScheduleSettings; + } + + /** Returns the object with the settings used for calls to resumeSchedule. */ + public UnaryCallSettings resumeScheduleSettings() { + return resumeScheduleSettings; + } + + /** Returns the object with the settings used for calls to updateSchedule. */ + public UnaryCallSettings updateScheduleSettings() { + return updateScheduleSettings; + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + public ScheduleServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcScheduleServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "aiplatform.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "aiplatform.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ScheduleServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ScheduleServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createScheduleSettings = settingsBuilder.createScheduleSettings().build(); + deleteScheduleSettings = settingsBuilder.deleteScheduleSettings().build(); + deleteScheduleOperationSettings = settingsBuilder.deleteScheduleOperationSettings().build(); + getScheduleSettings = settingsBuilder.getScheduleSettings().build(); + listSchedulesSettings = settingsBuilder.listSchedulesSettings().build(); + pauseScheduleSettings = settingsBuilder.pauseScheduleSettings().build(); + resumeScheduleSettings = settingsBuilder.resumeScheduleSettings().build(); + updateScheduleSettings = settingsBuilder.updateScheduleSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + /** Builder for ScheduleServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createScheduleSettings; + private final UnaryCallSettings.Builder + deleteScheduleSettings; + private final OperationCallSettings.Builder< + DeleteScheduleRequest, Empty, DeleteOperationMetadata> + deleteScheduleOperationSettings; + private final UnaryCallSettings.Builder getScheduleSettings; + private final PagedCallSettings.Builder< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse> + listSchedulesSettings; + private final UnaryCallSettings.Builder pauseScheduleSettings; + private final UnaryCallSettings.Builder resumeScheduleSettings; + private final UnaryCallSettings.Builder updateScheduleSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteScheduleOperationSettings = OperationCallSettings.newBuilder(); + getScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listSchedulesSettings = PagedCallSettings.newBuilder(LIST_SCHEDULES_PAGE_STR_FACT); + pauseScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + resumeScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createScheduleSettings, + deleteScheduleSettings, + getScheduleSettings, + listSchedulesSettings, + pauseScheduleSettings, + resumeScheduleSettings, + updateScheduleSettings, + listLocationsSettings, + getLocationSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + initDefaults(this); + } + + protected Builder(ScheduleServiceStubSettings settings) { + super(settings); + + createScheduleSettings = settings.createScheduleSettings.toBuilder(); + deleteScheduleSettings = settings.deleteScheduleSettings.toBuilder(); + deleteScheduleOperationSettings = settings.deleteScheduleOperationSettings.toBuilder(); + getScheduleSettings = settings.getScheduleSettings.toBuilder(); + listSchedulesSettings = settings.listSchedulesSettings.toBuilder(); + pauseScheduleSettings = settings.pauseScheduleSettings.toBuilder(); + resumeScheduleSettings = settings.resumeScheduleSettings.toBuilder(); + updateScheduleSettings = settings.updateScheduleSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createScheduleSettings, + deleteScheduleSettings, + getScheduleSettings, + listSchedulesSettings, + pauseScheduleSettings, + resumeScheduleSettings, + updateScheduleSettings, + listLocationsSettings, + getLocationSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listSchedulesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .pauseScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .resumeScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateScheduleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteScheduleOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(DeleteOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createSchedule. */ + public UnaryCallSettings.Builder createScheduleSettings() { + return createScheduleSettings; + } + + /** Returns the builder for the settings used for calls to deleteSchedule. */ + public UnaryCallSettings.Builder deleteScheduleSettings() { + return deleteScheduleSettings; + } + + /** Returns the builder for the settings used for calls to deleteSchedule. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteScheduleOperationSettings() { + return deleteScheduleOperationSettings; + } + + /** Returns the builder for the settings used for calls to getSchedule. */ + public UnaryCallSettings.Builder getScheduleSettings() { + return getScheduleSettings; + } + + /** Returns the builder for the settings used for calls to listSchedules. */ + public PagedCallSettings.Builder< + ListSchedulesRequest, ListSchedulesResponse, ListSchedulesPagedResponse> + listSchedulesSettings() { + return listSchedulesSettings; + } + + /** Returns the builder for the settings used for calls to pauseSchedule. */ + public UnaryCallSettings.Builder pauseScheduleSettings() { + return pauseScheduleSettings; + } + + /** Returns the builder for the settings used for calls to resumeSchedule. */ + public UnaryCallSettings.Builder resumeScheduleSettings() { + return resumeScheduleSettings; + } + + /** Returns the builder for the settings used for calls to updateSchedule. */ + public UnaryCallSettings.Builder updateScheduleSettings() { + return updateScheduleSettings; + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @Override + public ScheduleServiceStubSettings build() throws IOException { + return new ScheduleServiceStubSettings(this); + } + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java index 19164a18dcd1..7aaa6a7d84a6 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java @@ -25,6 +25,7 @@ import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStub; import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStubSettings; @@ -543,6 +544,41 @@ public final UnaryCallable rawPredictCallable() { return stub.rawPredictCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform a server-side streaming online prediction request for Vertex LLM streaming. + * + *

Sample code: + * + *

{@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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   StreamingPredictRequest request =
+   *       StreamingPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllInputs(new ArrayList())
+   *           .setParameters(Tensor.newBuilder().build())
+   *           .build();
+   *   ServerStream stream =
+   *       predictionServiceClient.serverStreamingPredictCallable().call(request);
+   *   for (StreamingPredictResponse response : stream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final ServerStreamingCallable + serverStreamingPredictCallable() { + return stub.serverStreamingPredictCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Perform an online explanation. diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java index 1667226344ac..0e66b3f7b2f2 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java @@ -28,6 +28,7 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStubSettings; @@ -95,6 +96,12 @@ public UnaryCallSettings rawPredictSettings() { return ((PredictionServiceStubSettings) getStubSettings()).rawPredictSettings(); } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings + serverStreamingPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).serverStreamingPredictSettings(); + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return ((PredictionServiceStubSettings) getStubSettings()).explainSettings(); @@ -234,6 +241,12 @@ public UnaryCallSettings.Builder rawPredictSettings return getStubSettingsBuilder().rawPredictSettings(); } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings.Builder + serverStreamingPredictSettings() { + return getStubSettingsBuilder().serverStreamingPredictSettings(); + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return getStubSettingsBuilder().explainSettings(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json index ebad841b7179..3b929884e456 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json @@ -895,6 +895,9 @@ "RawPredict": { "methods": ["rawPredict", "rawPredict", "rawPredict", "rawPredictCallable"] }, + "ServerStreamingPredict": { + "methods": ["serverStreamingPredictCallable"] + }, "SetIamPolicy": { "methods": ["setIamPolicy", "setIamPolicyCallable"] }, diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java index d03fe1814d12..c77591394a8f 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java @@ -26,12 +26,15 @@ import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.ExplainRequest; import com.google.cloud.aiplatform.v1beta1.ExplainResponse; import com.google.cloud.aiplatform.v1beta1.PredictRequest; import com.google.cloud.aiplatform.v1beta1.PredictResponse; import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -73,6 +76,18 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) .build(); + private static final MethodDescriptor + serverStreamingPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName( + "google.cloud.aiplatform.v1beta1.PredictionService/ServerStreamingPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor explainMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -129,6 +144,8 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { private final UnaryCallable predictCallable; private final UnaryCallable rawPredictCallable; + private final ServerStreamingCallable + serverStreamingPredictCallable; private final UnaryCallable explainCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable @@ -203,6 +220,17 @@ protected GrpcPredictionServiceStub( return builder.build(); }) .build(); + GrpcCallSettings + serverStreamingPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(serverStreamingPredictMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("endpoint", String.valueOf(request.getEndpoint())); + return builder.build(); + }) + .build(); GrpcCallSettings explainTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(explainMethodDescriptor) @@ -271,6 +299,11 @@ protected GrpcPredictionServiceStub( this.rawPredictCallable = callableFactory.createUnaryCallable( rawPredictTransportSettings, settings.rawPredictSettings(), clientContext); + this.serverStreamingPredictCallable = + callableFactory.createServerStreamingCallable( + serverStreamingPredictTransportSettings, + settings.serverStreamingPredictSettings(), + clientContext); this.explainCallable = callableFactory.createUnaryCallable( explainTransportSettings, settings.explainSettings(), clientContext); @@ -313,6 +346,12 @@ public UnaryCallable rawPredictCallable() { return rawPredictCallable; } + @Override + public ServerStreamingCallable + serverStreamingPredictCallable() { + return serverStreamingPredictCallable; + } + @Override public UnaryCallable explainCallable() { return explainCallable; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java index 03d77213b553..c2388ddad848 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java @@ -21,12 +21,15 @@ import com.google.api.HttpBody; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.ExplainRequest; import com.google.cloud.aiplatform.v1beta1.ExplainResponse; import com.google.cloud.aiplatform.v1beta1.PredictRequest; import com.google.cloud.aiplatform.v1beta1.PredictResponse; import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -56,6 +59,11 @@ public UnaryCallable rawPredictCallable() { throw new UnsupportedOperationException("Not implemented: rawPredictCallable()"); } + public ServerStreamingCallable + serverStreamingPredictCallable() { + throw new UnsupportedOperationException("Not implemented: serverStreamingPredictCallable()"); + } + public UnaryCallable explainCallable() { throw new UnsupportedOperationException("Not implemented: explainCallable()"); } diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java index 30de946a9f19..a1fcb28b355e 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java @@ -36,6 +36,7 @@ import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; @@ -46,6 +47,8 @@ import com.google.cloud.aiplatform.v1beta1.PredictRequest; import com.google.cloud.aiplatform.v1beta1.PredictResponse; import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -111,6 +114,8 @@ public class PredictionServiceStubSettings extends StubSettings predictSettings; private final UnaryCallSettings rawPredictSettings; + private final ServerStreamingCallSettings + serverStreamingPredictSettings; private final UnaryCallSettings explainSettings; private final PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -184,6 +189,12 @@ public UnaryCallSettings rawPredictSettings() { return rawPredictSettings; } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings + serverStreamingPredictSettings() { + return serverStreamingPredictSettings; + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return explainSettings; @@ -293,6 +304,7 @@ protected PredictionServiceStubSettings(Builder settingsBuilder) throws IOExcept predictSettings = settingsBuilder.predictSettings().build(); rawPredictSettings = settingsBuilder.rawPredictSettings().build(); + serverStreamingPredictSettings = settingsBuilder.serverStreamingPredictSettings().build(); explainSettings = settingsBuilder.explainSettings().build(); listLocationsSettings = settingsBuilder.listLocationsSettings().build(); getLocationSettings = settingsBuilder.getLocationSettings().build(); @@ -306,6 +318,9 @@ public static class Builder extends StubSettings.Builder> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder predictSettings; private final UnaryCallSettings.Builder rawPredictSettings; + private final ServerStreamingCallSettings.Builder< + StreamingPredictRequest, StreamingPredictResponse> + serverStreamingPredictSettings; private final UnaryCallSettings.Builder explainSettings; private final PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -354,6 +369,7 @@ protected Builder(ClientContext clientContext) { predictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); rawPredictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + serverStreamingPredictSettings = ServerStreamingCallSettings.newBuilder(); explainSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -379,6 +395,7 @@ protected Builder(PredictionServiceStubSettings settings) { predictSettings = settings.predictSettings.toBuilder(); rawPredictSettings = settings.rawPredictSettings.toBuilder(); + serverStreamingPredictSettings = settings.serverStreamingPredictSettings.toBuilder(); explainSettings = settings.explainSettings.toBuilder(); listLocationsSettings = settings.listLocationsSettings.toBuilder(); getLocationSettings = settings.getLocationSettings.toBuilder(); @@ -422,6 +439,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder + .serverStreamingPredictSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .explainSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_9_codes")) @@ -480,6 +502,12 @@ public UnaryCallSettings.Builder rawPredictSettings return rawPredictSettings; } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ + public ServerStreamingCallSettings.Builder + serverStreamingPredictSettings() { + return serverStreamingPredictSettings; + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return explainSettings; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json index acd320862abc..9d64b75a4e9e 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json @@ -2069,6 +2069,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.CreateScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.CreateScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.CreateSpecialistPoolOperationMetadata", "queryAllDeclaredConstructors": true, @@ -2951,6 +2969,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.DeleteScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DeleteScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest", "queryAllDeclaredConstructors": true, @@ -5255,6 +5291,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.GetScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.GetScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.GetSpecialistPoolRequest", "queryAllDeclaredConstructors": true, @@ -6839,6 +6893,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.ListSchedulesRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.ListSchedulesRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.ListSchedulesResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.ListSchedulesResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest", "queryAllDeclaredConstructors": true, @@ -8558,6 +8648,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.PauseScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.PauseScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.PipelineFailurePolicy", "queryAllDeclaredConstructors": true, @@ -9764,6 +9872,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.ResumeScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.ResumeScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.SampleConfig", "queryAllDeclaredConstructors": true, @@ -9881,6 +10007,51 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.Schedule", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Schedule$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Schedule$RunResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Schedule$RunResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Schedule$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.Scheduling", "queryAllDeclaredConstructors": true, @@ -10151,6 +10322,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.StreamingReadFeatureValuesRequest", "queryAllDeclaredConstructors": true, @@ -10601,6 +10808,33 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.Tensor", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Tensor$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.Tensor$DataType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.Tensorboard", "queryAllDeclaredConstructors": true, @@ -11357,6 +11591,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.UpdateScheduleRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.UpdateScheduleRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.UpdateSpecialistPoolOperationMetadata", "queryAllDeclaredConstructors": true, diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json index 74b415bf3aa1..a5b9dd47aa01 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json @@ -9809,6 +9809,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.RaySpec", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.RaySpec$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest", "queryAllDeclaredConstructors": true, @@ -10241,6 +10259,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.ResourceRuntime", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.ResourceRuntime$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.ResourceRuntimeSpec", "queryAllDeclaredConstructors": true, @@ -10763,6 +10799,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.StreamingReadFeatureValuesRequest", "queryAllDeclaredConstructors": true, @@ -11249,6 +11321,33 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.Tensor", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.Tensor$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.Tensor$DataType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.Tensorboard", "queryAllDeclaredConstructors": true, diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java index eab79847fd00..93cfad302ead 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java @@ -99,6 +99,27 @@ public void rawPredict(RawPredictRequest request, StreamObserver respo } } + @Override + public void serverStreamingPredict( + StreamingPredictRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof StreamingPredictResponse) { + requests.add(request); + responseObserver.onNext(((StreamingPredictResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ServerStreamingPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + StreamingPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + @Override public void explain(ExplainRequest request, StreamObserver responseObserver) { Object response = responses.poll(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleService.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleService.java new file mode 100644 index 000000000000..5bd784742d1b --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockScheduleService implements MockGrpcService { + private final MockScheduleServiceImpl serviceImpl; + + public MockScheduleService() { + serviceImpl = new MockScheduleServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleServiceImpl.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleServiceImpl.java new file mode 100644 index 000000000000..08abc0d51be2 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockScheduleServiceImpl.java @@ -0,0 +1,207 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.aiplatform.v1.ScheduleServiceGrpc.ScheduleServiceImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockScheduleServiceImpl extends ScheduleServiceImplBase { + private List requests; + private Queue responses; + + public MockScheduleServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createSchedule( + CreateScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schedule) { + requests.add(request); + responseObserver.onNext(((Schedule) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schedule.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteSchedule( + DeleteScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getSchedule(GetScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schedule) { + requests.add(request); + responseObserver.onNext(((Schedule) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schedule.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listSchedules( + ListSchedulesRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListSchedulesResponse) { + requests.add(request); + responseObserver.onNext(((ListSchedulesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListSchedules, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListSchedulesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void pauseSchedule(PauseScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method PauseSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void resumeSchedule( + ResumeScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ResumeSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateSchedule( + UpdateScheduleRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schedule) { + requests.add(request); + responseObserver.onNext(((Schedule) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateSchedule, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schedule.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java index 0da3ebe37f9b..70a4eacc9f76 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java @@ -24,8 +24,11 @@ import com.google.api.gax.grpc.testing.LocalChannelProvider; import com.google.api.gax.grpc.testing.MockGrpcService; import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.grpc.testing.MockStreamObserver; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StatusCode; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -51,6 +54,7 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; +import java.util.concurrent.ExecutionException; import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; @@ -111,6 +115,7 @@ public void predictTest() throws Exception { .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelVersionId("modelVersionId-2006125846") .setModelDisplayName("modelDisplayName1578770308") + .setMetadata(Value.newBuilder().setBoolValue(true).build()) .build(); mockPredictionService.addResponse(expectedResponse); @@ -161,6 +166,7 @@ public void predictTest2() throws Exception { .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelVersionId("modelVersionId-2006125846") .setModelDisplayName("modelDisplayName1578770308") + .setMetadata(Value.newBuilder().setBoolValue(true).build()) .build(); mockPredictionService.addResponse(expectedResponse); @@ -288,6 +294,63 @@ public void rawPredictExceptionTest2() throws Exception { } } + @Test + public void serverStreamingPredictTest() throws Exception { + StreamingPredictResponse expectedResponse = + StreamingPredictResponse.newBuilder() + .addAllOutputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + mockPredictionService.addResponse(expectedResponse); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.serverStreamingPredictCallable(); + callable.serverStreamingCall(request, responseObserver); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void serverStreamingPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.serverStreamingPredictCallable(); + callable.serverStreamingCall(request, responseObserver); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test public void explainTest() throws Exception { ExplainResponse expectedResponse = diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/ScheduleServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/ScheduleServiceClientTest.java new file mode 100644 index 000000000000..4b9131f92e86 --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/ScheduleServiceClientTest.java @@ -0,0 +1,1023 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListLocationsPagedResponse; +import static com.google.cloud.aiplatform.v1.ScheduleServiceClient.ListSchedulesPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ScheduleServiceClientTest { + private static MockIAMPolicy mockIAMPolicy; + private static MockLocations mockLocations; + private static MockScheduleService mockScheduleService; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private ScheduleServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockScheduleService = new MockScheduleService(); + mockLocations = new MockLocations(); + mockIAMPolicy = new MockIAMPolicy(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockScheduleService, mockLocations, mockIAMPolicy)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ScheduleServiceSettings settings = + ScheduleServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ScheduleServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createScheduleTest() throws Exception { + Schedule expectedResponse = + Schedule.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setDisplayName("displayName1714148973") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setMaxRunCount(-845001408) + .setStartedRunCount(-479303651) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setNextRunTime(Timestamp.newBuilder().build()) + .setLastPauseTime(Timestamp.newBuilder().build()) + .setLastResumeTime(Timestamp.newBuilder().build()) + .setMaxConcurrentRunCount(-1478623794) + .setAllowQueueing(true) + .setCatchUp(true) + .setLastScheduledRunResponse(Schedule.RunResponse.newBuilder().build()) + .build(); + mockScheduleService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Schedule schedule = Schedule.newBuilder().build(); + + Schedule actualResponse = client.createSchedule(parent, schedule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateScheduleRequest actualRequest = ((CreateScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(schedule, actualRequest.getSchedule()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Schedule schedule = Schedule.newBuilder().build(); + client.createSchedule(parent, schedule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createScheduleTest2() throws Exception { + Schedule expectedResponse = + Schedule.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setDisplayName("displayName1714148973") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setMaxRunCount(-845001408) + .setStartedRunCount(-479303651) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setNextRunTime(Timestamp.newBuilder().build()) + .setLastPauseTime(Timestamp.newBuilder().build()) + .setLastResumeTime(Timestamp.newBuilder().build()) + .setMaxConcurrentRunCount(-1478623794) + .setAllowQueueing(true) + .setCatchUp(true) + .setLastScheduledRunResponse(Schedule.RunResponse.newBuilder().build()) + .build(); + mockScheduleService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Schedule schedule = Schedule.newBuilder().build(); + + Schedule actualResponse = client.createSchedule(parent, schedule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateScheduleRequest actualRequest = ((CreateScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(schedule, actualRequest.getSchedule()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createScheduleExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String parent = "parent-995424086"; + Schedule schedule = Schedule.newBuilder().build(); + client.createSchedule(parent, schedule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteScheduleTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteScheduleTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockScheduleService.addResponse(resultOperation); + + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + + client.deleteScheduleAsync(name).get(); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteScheduleRequest actualRequest = ((DeleteScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + client.deleteScheduleAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteScheduleTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteScheduleTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockScheduleService.addResponse(resultOperation); + + String name = "name3373707"; + + client.deleteScheduleAsync(name).get(); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteScheduleRequest actualRequest = ((DeleteScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteScheduleExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String name = "name3373707"; + client.deleteScheduleAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getScheduleTest() throws Exception { + Schedule expectedResponse = + Schedule.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setDisplayName("displayName1714148973") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setMaxRunCount(-845001408) + .setStartedRunCount(-479303651) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setNextRunTime(Timestamp.newBuilder().build()) + .setLastPauseTime(Timestamp.newBuilder().build()) + .setLastResumeTime(Timestamp.newBuilder().build()) + .setMaxConcurrentRunCount(-1478623794) + .setAllowQueueing(true) + .setCatchUp(true) + .setLastScheduledRunResponse(Schedule.RunResponse.newBuilder().build()) + .build(); + mockScheduleService.addResponse(expectedResponse); + + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + + Schedule actualResponse = client.getSchedule(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetScheduleRequest actualRequest = ((GetScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + client.getSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getScheduleTest2() throws Exception { + Schedule expectedResponse = + Schedule.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setDisplayName("displayName1714148973") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setMaxRunCount(-845001408) + .setStartedRunCount(-479303651) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setNextRunTime(Timestamp.newBuilder().build()) + .setLastPauseTime(Timestamp.newBuilder().build()) + .setLastResumeTime(Timestamp.newBuilder().build()) + .setMaxConcurrentRunCount(-1478623794) + .setAllowQueueing(true) + .setCatchUp(true) + .setLastScheduledRunResponse(Schedule.RunResponse.newBuilder().build()) + .build(); + mockScheduleService.addResponse(expectedResponse); + + String name = "name3373707"; + + Schedule actualResponse = client.getSchedule(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetScheduleRequest actualRequest = ((GetScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getScheduleExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String name = "name3373707"; + client.getSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchedulesTest() throws Exception { + Schedule responsesElement = Schedule.newBuilder().build(); + ListSchedulesResponse expectedResponse = + ListSchedulesResponse.newBuilder() + .setNextPageToken("") + .addAllSchedules(Arrays.asList(responsesElement)) + .build(); + mockScheduleService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListSchedulesPagedResponse pagedListResponse = client.listSchedules(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchedulesList().get(0), resources.get(0)); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSchedulesRequest actualRequest = ((ListSchedulesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSchedulesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listSchedules(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchedulesTest2() throws Exception { + Schedule responsesElement = Schedule.newBuilder().build(); + ListSchedulesResponse expectedResponse = + ListSchedulesResponse.newBuilder() + .setNextPageToken("") + .addAllSchedules(Arrays.asList(responsesElement)) + .build(); + mockScheduleService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSchedulesPagedResponse pagedListResponse = client.listSchedules(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchedulesList().get(0), resources.get(0)); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSchedulesRequest actualRequest = ((ListSchedulesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSchedulesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listSchedules(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pauseScheduleTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + + client.pauseSchedule(name); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PauseScheduleRequest actualRequest = ((PauseScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pauseScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + client.pauseSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pauseScheduleTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.pauseSchedule(name); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PauseScheduleRequest actualRequest = ((PauseScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pauseScheduleExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String name = "name3373707"; + client.pauseSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumeScheduleTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + + client.resumeSchedule(name); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ResumeScheduleRequest actualRequest = ((ResumeScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void resumeScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + client.resumeSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumeScheduleTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.resumeSchedule(name); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ResumeScheduleRequest actualRequest = ((ResumeScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void resumeScheduleExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String name = "name3373707"; + client.resumeSchedule(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumeScheduleTest3() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + boolean catchUp = true; + + client.resumeSchedule(name, catchUp); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ResumeScheduleRequest actualRequest = ((ResumeScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(catchUp, actualRequest.getCatchUp()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void resumeScheduleExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + boolean catchUp = true; + client.resumeSchedule(name, catchUp); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumeScheduleTest4() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockScheduleService.addResponse(expectedResponse); + + String name = "name3373707"; + boolean catchUp = true; + + client.resumeSchedule(name, catchUp); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ResumeScheduleRequest actualRequest = ((ResumeScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(catchUp, actualRequest.getCatchUp()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void resumeScheduleExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + String name = "name3373707"; + boolean catchUp = true; + client.resumeSchedule(name, catchUp); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateScheduleTest() throws Exception { + Schedule expectedResponse = + Schedule.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setDisplayName("displayName1714148973") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setMaxRunCount(-845001408) + .setStartedRunCount(-479303651) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setNextRunTime(Timestamp.newBuilder().build()) + .setLastPauseTime(Timestamp.newBuilder().build()) + .setLastResumeTime(Timestamp.newBuilder().build()) + .setMaxConcurrentRunCount(-1478623794) + .setAllowQueueing(true) + .setCatchUp(true) + .setLastScheduledRunResponse(Schedule.RunResponse.newBuilder().build()) + .build(); + mockScheduleService.addResponse(expectedResponse); + + Schedule schedule = Schedule.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Schedule actualResponse = client.updateSchedule(schedule, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockScheduleService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateScheduleRequest actualRequest = ((UpdateScheduleRequest) actualRequests.get(0)); + + Assert.assertEquals(schedule, actualRequest.getSchedule()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateScheduleExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockScheduleService.addException(exception); + + try { + Schedule schedule = Schedule.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSchedule(schedule, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockIAMPolicy.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockIAMPolicy.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockIAMPolicy.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java index 74714eefe7d9..92d54d08bf5a 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java @@ -99,6 +99,27 @@ public void rawPredict(RawPredictRequest request, StreamObserver respo } } + @Override + public void serverStreamingPredict( + StreamingPredictRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof StreamingPredictResponse) { + requests.add(request); + responseObserver.onNext(((StreamingPredictResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ServerStreamingPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + StreamingPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + @Override public void explain(ExplainRequest request, StreamObserver responseObserver) { Object response = responses.poll(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceServiceClientTest.java index 81d00d26cc28..57edf5b19fc3 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceServiceClientTest.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceServiceClientTest.java @@ -125,6 +125,7 @@ public void createPersistentResourceTest() throws Exception { .setNetwork("network1843485230") .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setResourceRuntimeSpec(ResourceRuntimeSpec.newBuilder().build()) + .setResourceRuntime(ResourceRuntime.newBuilder().build()) .addAllReservedIpRanges(new ArrayList()) .build(); Operation resultOperation = @@ -194,6 +195,7 @@ public void createPersistentResourceTest2() throws Exception { .setNetwork("network1843485230") .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setResourceRuntimeSpec(ResourceRuntimeSpec.newBuilder().build()) + .setResourceRuntime(ResourceRuntime.newBuilder().build()) .addAllReservedIpRanges(new ArrayList()) .build(); Operation resultOperation = @@ -263,6 +265,7 @@ public void getPersistentResourceTest() throws Exception { .setNetwork("network1843485230") .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setResourceRuntimeSpec(ResourceRuntimeSpec.newBuilder().build()) + .setResourceRuntime(ResourceRuntime.newBuilder().build()) .addAllReservedIpRanges(new ArrayList()) .build(); mockPersistentResourceService.addResponse(expectedResponse); @@ -317,6 +320,7 @@ public void getPersistentResourceTest2() throws Exception { .setNetwork("network1843485230") .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setResourceRuntimeSpec(ResourceRuntimeSpec.newBuilder().build()) + .setResourceRuntime(ResourceRuntime.newBuilder().build()) .addAllReservedIpRanges(new ArrayList()) .build(); mockPersistentResourceService.addResponse(expectedResponse); diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java index 8042aefeef69..851d67161023 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java @@ -24,8 +24,11 @@ import com.google.api.gax.grpc.testing.LocalChannelProvider; import com.google.api.gax.grpc.testing.MockGrpcService; import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.grpc.testing.MockStreamObserver; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StatusCode; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -51,6 +54,7 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; +import java.util.concurrent.ExecutionException; import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; @@ -111,6 +115,7 @@ public void predictTest() throws Exception { .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelVersionId("modelVersionId-2006125846") .setModelDisplayName("modelDisplayName1578770308") + .setMetadata(Value.newBuilder().setBoolValue(true).build()) .build(); mockPredictionService.addResponse(expectedResponse); @@ -161,6 +166,7 @@ public void predictTest2() throws Exception { .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelVersionId("modelVersionId-2006125846") .setModelDisplayName("modelDisplayName1578770308") + .setMetadata(Value.newBuilder().setBoolValue(true).build()) .build(); mockPredictionService.addResponse(expectedResponse); @@ -288,6 +294,63 @@ public void rawPredictExceptionTest2() throws Exception { } } + @Test + public void serverStreamingPredictTest() throws Exception { + StreamingPredictResponse expectedResponse = + StreamingPredictResponse.newBuilder() + .addAllOutputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + mockPredictionService.addResponse(expectedResponse); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.serverStreamingPredictCallable(); + callable.serverStreamingCall(request, responseObserver); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void serverStreamingPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.serverStreamingPredictCallable(); + callable.serverStreamingCall(request, responseObserver); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test public void explainTest() throws Exception { ExplainResponse expectedResponse = diff --git a/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java index f6b53ef50082..3e606ed300fe 100644 --- a/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java +++ b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java @@ -121,6 +121,57 @@ private PredictionServiceGrpc() {} return getRawPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse> + getServerStreamingPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ServerStreamingPredict", + requestType = com.google.cloud.aiplatform.v1.StreamingPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1.StreamingPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse> + getServerStreamingPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse> + getServerStreamingPredictMethod; + if ((getServerStreamingPredictMethod = PredictionServiceGrpc.getServerStreamingPredictMethod) + == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getServerStreamingPredictMethod = + PredictionServiceGrpc.getServerStreamingPredictMethod) + == null) { + PredictionServiceGrpc.getServerStreamingPredictMethod = + getServerStreamingPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ServerStreamingPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.StreamingPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.StreamingPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("ServerStreamingPredict")) + .build(); + } + } + } + return getServerStreamingPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1.ExplainRequest, com.google.cloud.aiplatform.v1.ExplainResponse> @@ -249,6 +300,22 @@ default void rawPredict( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRawPredictMethod(), responseObserver); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + default void serverStreamingPredict( + com.google.cloud.aiplatform.v1.StreamingPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getServerStreamingPredictMethod(), responseObserver); + } + /** * * @@ -344,6 +411,24 @@ public void rawPredict( getChannel().newCall(getRawPredictMethod(), getCallOptions()), request, responseObserver); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + public void serverStreamingPredict( + com.google.cloud.aiplatform.v1.StreamingPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getServerStreamingPredictMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -422,6 +507,20 @@ public com.google.api.HttpBody rawPredict( getChannel(), getRawPredictMethod(), getCallOptions(), request); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + public java.util.Iterator + serverStreamingPredict(com.google.cloud.aiplatform.v1.StreamingPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getServerStreamingPredictMethod(), getCallOptions(), request); + } + /** * * @@ -524,7 +623,8 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -554,6 +654,12 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.cloud.aiplatform.v1.RawPredictRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SERVER_STREAMING_PREDICT: + serviceImpl.serverStreamingPredict( + (com.google.cloud.aiplatform.v1.StreamingPredictRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; case METHODID_EXPLAIN: serviceImpl.explain( (com.google.cloud.aiplatform.v1.ExplainRequest) request, @@ -590,6 +696,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.cloud.aiplatform.v1.RawPredictRequest, com.google.api.HttpBody>( service, METHODID_RAW_PREDICT))) + .addMethod( + getServerStreamingPredictMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse>( + service, METHODID_SERVER_STREAMING_PREDICT))) .addMethod( getExplainMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -649,6 +762,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .setSchemaDescriptor(new PredictionServiceFileDescriptorSupplier()) .addMethod(getPredictMethod()) .addMethod(getRawPredictMethod()) + .addMethod(getServerStreamingPredictMethod()) .addMethod(getExplainMethod()) .build(); } diff --git a/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceGrpc.java b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceGrpc.java new file mode 100644 index 000000000000..90ef5a16161b --- /dev/null +++ b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceGrpc.java @@ -0,0 +1,1127 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.aiplatform.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * A service for creating and managing Vertex AI's Schedule resources to
+ * periodically launch shceudled runs to make API calls.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/aiplatform/v1/schedule_service.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ScheduleServiceGrpc { + + private ScheduleServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.aiplatform.v1.ScheduleService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.CreateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getCreateScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateSchedule", + requestType = com.google.cloud.aiplatform.v1.CreateScheduleRequest.class, + responseType = com.google.cloud.aiplatform.v1.Schedule.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.CreateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getCreateScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.CreateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getCreateScheduleMethod; + if ((getCreateScheduleMethod = ScheduleServiceGrpc.getCreateScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getCreateScheduleMethod = ScheduleServiceGrpc.getCreateScheduleMethod) == null) { + ScheduleServiceGrpc.getCreateScheduleMethod = + getCreateScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.CreateScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("CreateSchedule")) + .build(); + } + } + } + return getCreateScheduleMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DeleteScheduleRequest, com.google.longrunning.Operation> + getDeleteScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteSchedule", + requestType = com.google.cloud.aiplatform.v1.DeleteScheduleRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DeleteScheduleRequest, com.google.longrunning.Operation> + getDeleteScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DeleteScheduleRequest, com.google.longrunning.Operation> + getDeleteScheduleMethod; + if ((getDeleteScheduleMethod = ScheduleServiceGrpc.getDeleteScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getDeleteScheduleMethod = ScheduleServiceGrpc.getDeleteScheduleMethod) == null) { + ScheduleServiceGrpc.getDeleteScheduleMethod = + getDeleteScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("DeleteSchedule")) + .build(); + } + } + } + return getDeleteScheduleMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.GetScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getGetScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetSchedule", + requestType = com.google.cloud.aiplatform.v1.GetScheduleRequest.class, + responseType = com.google.cloud.aiplatform.v1.Schedule.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.GetScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getGetScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.GetScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getGetScheduleMethod; + if ((getGetScheduleMethod = ScheduleServiceGrpc.getGetScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getGetScheduleMethod = ScheduleServiceGrpc.getGetScheduleMethod) == null) { + ScheduleServiceGrpc.getGetScheduleMethod = + getGetScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.GetScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("GetSchedule")) + .build(); + } + } + } + return getGetScheduleMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ListSchedulesRequest, + com.google.cloud.aiplatform.v1.ListSchedulesResponse> + getListSchedulesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListSchedules", + requestType = com.google.cloud.aiplatform.v1.ListSchedulesRequest.class, + responseType = com.google.cloud.aiplatform.v1.ListSchedulesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ListSchedulesRequest, + com.google.cloud.aiplatform.v1.ListSchedulesResponse> + getListSchedulesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ListSchedulesRequest, + com.google.cloud.aiplatform.v1.ListSchedulesResponse> + getListSchedulesMethod; + if ((getListSchedulesMethod = ScheduleServiceGrpc.getListSchedulesMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getListSchedulesMethod = ScheduleServiceGrpc.getListSchedulesMethod) == null) { + ScheduleServiceGrpc.getListSchedulesMethod = + getListSchedulesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListSchedules")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.ListSchedulesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.ListSchedulesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("ListSchedules")) + .build(); + } + } + } + return getListSchedulesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.PauseScheduleRequest, com.google.protobuf.Empty> + getPauseScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PauseSchedule", + requestType = com.google.cloud.aiplatform.v1.PauseScheduleRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.PauseScheduleRequest, com.google.protobuf.Empty> + getPauseScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.PauseScheduleRequest, com.google.protobuf.Empty> + getPauseScheduleMethod; + if ((getPauseScheduleMethod = ScheduleServiceGrpc.getPauseScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getPauseScheduleMethod = ScheduleServiceGrpc.getPauseScheduleMethod) == null) { + ScheduleServiceGrpc.getPauseScheduleMethod = + getPauseScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PauseSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.PauseScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("PauseSchedule")) + .build(); + } + } + } + return getPauseScheduleMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ResumeScheduleRequest, com.google.protobuf.Empty> + getResumeScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ResumeSchedule", + requestType = com.google.cloud.aiplatform.v1.ResumeScheduleRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ResumeScheduleRequest, com.google.protobuf.Empty> + getResumeScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.ResumeScheduleRequest, com.google.protobuf.Empty> + getResumeScheduleMethod; + if ((getResumeScheduleMethod = ScheduleServiceGrpc.getResumeScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getResumeScheduleMethod = ScheduleServiceGrpc.getResumeScheduleMethod) == null) { + ScheduleServiceGrpc.getResumeScheduleMethod = + getResumeScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ResumeSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("ResumeSchedule")) + .build(); + } + } + } + return getResumeScheduleMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.UpdateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getUpdateScheduleMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateSchedule", + requestType = com.google.cloud.aiplatform.v1.UpdateScheduleRequest.class, + responseType = com.google.cloud.aiplatform.v1.Schedule.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.UpdateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getUpdateScheduleMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.UpdateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule> + getUpdateScheduleMethod; + if ((getUpdateScheduleMethod = ScheduleServiceGrpc.getUpdateScheduleMethod) == null) { + synchronized (ScheduleServiceGrpc.class) { + if ((getUpdateScheduleMethod = ScheduleServiceGrpc.getUpdateScheduleMethod) == null) { + ScheduleServiceGrpc.getUpdateScheduleMethod = + getUpdateScheduleMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateSchedule")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance())) + .setSchemaDescriptor( + new ScheduleServiceMethodDescriptorSupplier("UpdateSchedule")) + .build(); + } + } + } + return getUpdateScheduleMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ScheduleServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ScheduleServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceStub(channel, callOptions); + } + }; + return ScheduleServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ScheduleServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ScheduleServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceBlockingStub(channel, callOptions); + } + }; + return ScheduleServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ScheduleServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ScheduleServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceFutureStub(channel, callOptions); + } + }; + return ScheduleServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * A service for creating and managing Vertex AI's Schedule resources to
+   * periodically launch shceudled runs to make API calls.
+   * 
+ */ + public interface AsyncService { + + /** + * + * + *
+     * Creates a Schedule.
+     * 
+ */ + default void createSchedule( + com.google.cloud.aiplatform.v1.CreateScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateScheduleMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a Schedule.
+     * 
+ */ + default void deleteSchedule( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteScheduleMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a Schedule.
+     * 
+ */ + default void getSchedule( + com.google.cloud.aiplatform.v1.GetScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetScheduleMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists Schedules in a Location.
+     * 
+ */ + default void listSchedules( + com.google.cloud.aiplatform.v1.ListSchedulesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListSchedulesMethod(), responseObserver); + } + + /** + * + * + *
+     * Pauses a Schedule. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
+     * the schedule is paused, no new runs will be created. Already created runs
+     * will NOT be paused or canceled.
+     * 
+ */ + default void pauseSchedule( + com.google.cloud.aiplatform.v1.PauseScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getPauseScheduleMethod(), responseObserver); + } + + /** + * + * + *
+     * Resumes a paused Schedule to start scheduling new runs. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
+     * Only paused Schedule can be resumed.
+     * When the Schedule is resumed, new runs will be scheduled starting from the
+     * next execution time after the current time based on the time_specification
+     * in the Schedule. If [Schedule.catchUp][] is set up true, all
+     * missed runs will be scheduled for backfill first.
+     * 
+ */ + default void resumeSchedule( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getResumeScheduleMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates an active or paused Schedule.
+     * When the Schedule is updated, new runs will be scheduled starting from the
+     * updated next execution time after the update time based on the
+     * time_specification in the updated Schedule. All unstarted runs before the
+     * update time will be skipped while already created runs will NOT be paused
+     * or canceled.
+     * 
+ */ + default void updateSchedule( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateScheduleMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service ScheduleService. + * + *
+   * A service for creating and managing Vertex AI's Schedule resources to
+   * periodically launch shceudled runs to make API calls.
+   * 
+ */ + public abstract static class ScheduleServiceImplBase + implements io.grpc.BindableService, AsyncService { + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return ScheduleServiceGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service ScheduleService. + * + *
+   * A service for creating and managing Vertex AI's Schedule resources to
+   * periodically launch shceudled runs to make API calls.
+   * 
+ */ + public static final class ScheduleServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private ScheduleServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ScheduleServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Schedule.
+     * 
+ */ + public void createSchedule( + com.google.cloud.aiplatform.v1.CreateScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a Schedule.
+     * 
+ */ + public void deleteSchedule( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a Schedule.
+     * 
+ */ + public void getSchedule( + com.google.cloud.aiplatform.v1.GetScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists Schedules in a Location.
+     * 
+ */ + public void listSchedules( + com.google.cloud.aiplatform.v1.ListSchedulesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListSchedulesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Pauses a Schedule. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
+     * the schedule is paused, no new runs will be created. Already created runs
+     * will NOT be paused or canceled.
+     * 
+ */ + public void pauseSchedule( + com.google.cloud.aiplatform.v1.PauseScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getPauseScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Resumes a paused Schedule to start scheduling new runs. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
+     * Only paused Schedule can be resumed.
+     * When the Schedule is resumed, new runs will be scheduled starting from the
+     * next execution time after the current time based on the time_specification
+     * in the Schedule. If [Schedule.catchUp][] is set up true, all
+     * missed runs will be scheduled for backfill first.
+     * 
+ */ + public void resumeSchedule( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getResumeScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates an active or paused Schedule.
+     * When the Schedule is updated, new runs will be scheduled starting from the
+     * updated next execution time after the update time based on the
+     * time_specification in the updated Schedule. All unstarted runs before the
+     * update time will be skipped while already created runs will NOT be paused
+     * or canceled.
+     * 
+ */ + public void updateSchedule( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateScheduleMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service ScheduleService. + * + *
+   * A service for creating and managing Vertex AI's Schedule resources to
+   * periodically launch shceudled runs to make API calls.
+   * 
+ */ + public static final class ScheduleServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ScheduleServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ScheduleServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Schedule.
+     * 
+ */ + public com.google.cloud.aiplatform.v1.Schedule createSchedule( + com.google.cloud.aiplatform.v1.CreateScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateScheduleMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a Schedule.
+     * 
+ */ + public com.google.longrunning.Operation deleteSchedule( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteScheduleMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a Schedule.
+     * 
+ */ + public com.google.cloud.aiplatform.v1.Schedule getSchedule( + com.google.cloud.aiplatform.v1.GetScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetScheduleMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists Schedules in a Location.
+     * 
+ */ + public com.google.cloud.aiplatform.v1.ListSchedulesResponse listSchedules( + com.google.cloud.aiplatform.v1.ListSchedulesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListSchedulesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Pauses a Schedule. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
+     * the schedule is paused, no new runs will be created. Already created runs
+     * will NOT be paused or canceled.
+     * 
+ */ + public com.google.protobuf.Empty pauseSchedule( + com.google.cloud.aiplatform.v1.PauseScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPauseScheduleMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Resumes a paused Schedule to start scheduling new runs. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
+     * Only paused Schedule can be resumed.
+     * When the Schedule is resumed, new runs will be scheduled starting from the
+     * next execution time after the current time based on the time_specification
+     * in the Schedule. If [Schedule.catchUp][] is set up true, all
+     * missed runs will be scheduled for backfill first.
+     * 
+ */ + public com.google.protobuf.Empty resumeSchedule( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getResumeScheduleMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates an active or paused Schedule.
+     * When the Schedule is updated, new runs will be scheduled starting from the
+     * updated next execution time after the update time based on the
+     * time_specification in the updated Schedule. All unstarted runs before the
+     * update time will be skipped while already created runs will NOT be paused
+     * or canceled.
+     * 
+ */ + public com.google.cloud.aiplatform.v1.Schedule updateSchedule( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateScheduleMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service ScheduleService. + * + *
+   * A service for creating and managing Vertex AI's Schedule resources to
+   * periodically launch shceudled runs to make API calls.
+   * 
+ */ + public static final class ScheduleServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ScheduleServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ScheduleServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ScheduleServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Schedule.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1.Schedule> + createSchedule(com.google.cloud.aiplatform.v1.CreateScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateScheduleMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a Schedule.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteSchedule(com.google.cloud.aiplatform.v1.DeleteScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteScheduleMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a Schedule.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1.Schedule> + getSchedule(com.google.cloud.aiplatform.v1.GetScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetScheduleMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists Schedules in a Location.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1.ListSchedulesResponse> + listSchedules(com.google.cloud.aiplatform.v1.ListSchedulesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListSchedulesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Pauses a Schedule. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
+     * the schedule is paused, no new runs will be created. Already created runs
+     * will NOT be paused or canceled.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + pauseSchedule(com.google.cloud.aiplatform.v1.PauseScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPauseScheduleMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Resumes a paused Schedule to start scheduling new runs. Will mark
+     * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
+     * Only paused Schedule can be resumed.
+     * When the Schedule is resumed, new runs will be scheduled starting from the
+     * next execution time after the current time based on the time_specification
+     * in the Schedule. If [Schedule.catchUp][] is set up true, all
+     * missed runs will be scheduled for backfill first.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + resumeSchedule(com.google.cloud.aiplatform.v1.ResumeScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getResumeScheduleMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates an active or paused Schedule.
+     * When the Schedule is updated, new runs will be scheduled starting from the
+     * updated next execution time after the update time based on the
+     * time_specification in the updated Schedule. All unstarted runs before the
+     * update time will be skipped while already created runs will NOT be paused
+     * or canceled.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1.Schedule> + updateSchedule(com.google.cloud.aiplatform.v1.UpdateScheduleRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateScheduleMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_SCHEDULE = 0; + private static final int METHODID_DELETE_SCHEDULE = 1; + private static final int METHODID_GET_SCHEDULE = 2; + private static final int METHODID_LIST_SCHEDULES = 3; + private static final int METHODID_PAUSE_SCHEDULE = 4; + private static final int METHODID_RESUME_SCHEDULE = 5; + private static final int METHODID_UPDATE_SCHEDULE = 6; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_SCHEDULE: + serviceImpl.createSchedule( + (com.google.cloud.aiplatform.v1.CreateScheduleRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_SCHEDULE: + serviceImpl.deleteSchedule( + (com.google.cloud.aiplatform.v1.DeleteScheduleRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_SCHEDULE: + serviceImpl.getSchedule( + (com.google.cloud.aiplatform.v1.GetScheduleRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_SCHEDULES: + serviceImpl.listSchedules( + (com.google.cloud.aiplatform.v1.ListSchedulesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_PAUSE_SCHEDULE: + serviceImpl.pauseSchedule( + (com.google.cloud.aiplatform.v1.PauseScheduleRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_RESUME_SCHEDULE: + serviceImpl.resumeSchedule( + (com.google.cloud.aiplatform.v1.ResumeScheduleRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_SCHEDULE: + serviceImpl.updateSchedule( + (com.google.cloud.aiplatform.v1.UpdateScheduleRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.CreateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule>(service, METHODID_CREATE_SCHEDULE))) + .addMethod( + getDeleteScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.DeleteScheduleRequest, + com.google.longrunning.Operation>(service, METHODID_DELETE_SCHEDULE))) + .addMethod( + getGetScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.GetScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule>(service, METHODID_GET_SCHEDULE))) + .addMethod( + getListSchedulesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.ListSchedulesRequest, + com.google.cloud.aiplatform.v1.ListSchedulesResponse>( + service, METHODID_LIST_SCHEDULES))) + .addMethod( + getPauseScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.PauseScheduleRequest, com.google.protobuf.Empty>( + service, METHODID_PAUSE_SCHEDULE))) + .addMethod( + getResumeScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.ResumeScheduleRequest, + com.google.protobuf.Empty>(service, METHODID_RESUME_SCHEDULE))) + .addMethod( + getUpdateScheduleMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.UpdateScheduleRequest, + com.google.cloud.aiplatform.v1.Schedule>(service, METHODID_UPDATE_SCHEDULE))) + .build(); + } + + private abstract static class ScheduleServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ScheduleServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ScheduleService"); + } + } + + private static final class ScheduleServiceFileDescriptorSupplier + extends ScheduleServiceBaseDescriptorSupplier { + ScheduleServiceFileDescriptorSupplier() {} + } + + private static final class ScheduleServiceMethodDescriptorSupplier + extends ScheduleServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ScheduleServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ScheduleServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ScheduleServiceFileDescriptorSupplier()) + .addMethod(getCreateScheduleMethod()) + .addMethod(getDeleteScheduleMethod()) + .addMethod(getGetScheduleMethod()) + .addMethod(getListSchedulesMethod()) + .addMethod(getPauseScheduleMethod()) + .addMethod(getResumeScheduleMethod()) + .addMethod(getUpdateScheduleMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java b/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java index 649a838895de..33bfb2caf518 100644 --- a/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java +++ b/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java @@ -124,6 +124,57 @@ private PredictionServiceGrpc() {} return getRawPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getServerStreamingPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ServerStreamingPredict", + requestType = com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getServerStreamingPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getServerStreamingPredictMethod; + if ((getServerStreamingPredictMethod = PredictionServiceGrpc.getServerStreamingPredictMethod) + == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getServerStreamingPredictMethod = + PredictionServiceGrpc.getServerStreamingPredictMethod) + == null) { + PredictionServiceGrpc.getServerStreamingPredictMethod = + getServerStreamingPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ServerStreamingPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("ServerStreamingPredict")) + .build(); + } + } + } + return getServerStreamingPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1beta1.ExplainRequest, com.google.cloud.aiplatform.v1beta1.ExplainResponse> @@ -254,6 +305,22 @@ default void rawPredict( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRawPredictMethod(), responseObserver); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + default void serverStreamingPredict( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getServerStreamingPredictMethod(), responseObserver); + } + /** * * @@ -349,6 +416,24 @@ public void rawPredict( getChannel().newCall(getRawPredictMethod(), getCallOptions()), request, responseObserver); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + public void serverStreamingPredict( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getServerStreamingPredictMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -427,6 +512,21 @@ public com.google.api.HttpBody rawPredict( getChannel(), getRawPredictMethod(), getCallOptions(), request); } + /** + * + * + *
+     * Perform a server-side streaming online prediction request for Vertex
+     * LLM streaming.
+     * 
+ */ + public java.util.Iterator + serverStreamingPredict( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getServerStreamingPredictMethod(), getCallOptions(), request); + } + /** * * @@ -529,7 +629,8 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -559,6 +660,13 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.cloud.aiplatform.v1beta1.RawPredictRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SERVER_STREAMING_PREDICT: + serviceImpl.serverStreamingPredict( + (com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse>) + responseObserver); + break; case METHODID_EXPLAIN: serviceImpl.explain( (com.google.cloud.aiplatform.v1beta1.ExplainRequest) request, @@ -596,6 +704,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.cloud.aiplatform.v1beta1.RawPredictRequest, com.google.api.HttpBody>( service, METHODID_RAW_PREDICT))) + .addMethod( + getServerStreamingPredictMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse>( + service, METHODID_SERVER_STREAMING_PREDICT))) .addMethod( getExplainMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -656,6 +771,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .setSchemaDescriptor(new PredictionServiceFileDescriptorSupplier()) .addMethod(getPredictMethod()) .addMethod(getRawPredictMethod()) + .addMethod(getServerStreamingPredictMethod()) .addMethod(getExplainMethod()) .build(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequest.java new file mode 100644 index 000000000000..520d873a2c36 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequest.java @@ -0,0 +1,935 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.CreateSchedule][google.cloud.aiplatform.v1.ScheduleService.CreateSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.CreateScheduleRequest} + */ +public final class CreateScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.CreateScheduleRequest) + CreateScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateScheduleRequest.newBuilder() to construct. + private CreateScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateScheduleRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.CreateScheduleRequest.class, + com.google.cloud.aiplatform.v1.CreateScheduleRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The resource name of the Location to create the Schedule in.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the Location to create the Schedule in.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEDULE_FIELD_NUMBER = 2; + private com.google.cloud.aiplatform.v1.Schedule schedule_; + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + @java.lang.Override + public boolean hasSchedule() { + return schedule_ != null; + } + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule getSchedule() { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder() { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (schedule_ != null) { + output.writeMessage(2, getSchedule()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (schedule_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSchedule()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.CreateScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.CreateScheduleRequest other = + (com.google.cloud.aiplatform.v1.CreateScheduleRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasSchedule() != other.hasSchedule()) return false; + if (hasSchedule()) { + if (!getSchedule().equals(other.getSchedule())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasSchedule()) { + hash = (37 * hash) + SCHEDULE_FIELD_NUMBER; + hash = (53 * hash) + getSchedule().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.CreateScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.CreateSchedule][google.cloud.aiplatform.v1.ScheduleService.CreateSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.CreateScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.CreateScheduleRequest) + com.google.cloud.aiplatform.v1.CreateScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.CreateScheduleRequest.class, + com.google.cloud.aiplatform.v1.CreateScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.CreateScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + schedule_ = null; + if (scheduleBuilder_ != null) { + scheduleBuilder_.dispose(); + scheduleBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreateScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.CreateScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreateScheduleRequest build() { + com.google.cloud.aiplatform.v1.CreateScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreateScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.CreateScheduleRequest result = + new com.google.cloud.aiplatform.v1.CreateScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.CreateScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.schedule_ = scheduleBuilder_ == null ? schedule_ : scheduleBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.CreateScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.CreateScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.CreateScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.CreateScheduleRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasSchedule()) { + mergeSchedule(other.getSchedule()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getScheduleFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource name of the Location to create the Schedule in.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Location to create the Schedule in.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Location to create the Schedule in.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Location to create the Schedule in.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Location to create the Schedule in.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.cloud.aiplatform.v1.Schedule schedule_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + scheduleBuilder_; + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + public boolean hasSchedule() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + public com.google.cloud.aiplatform.v1.Schedule getSchedule() { + if (scheduleBuilder_ == null) { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } else { + return scheduleBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSchedule(com.google.cloud.aiplatform.v1.Schedule value) { + if (scheduleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schedule_ = value; + } else { + scheduleBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSchedule(com.google.cloud.aiplatform.v1.Schedule.Builder builderForValue) { + if (scheduleBuilder_ == null) { + schedule_ = builderForValue.build(); + } else { + scheduleBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeSchedule(com.google.cloud.aiplatform.v1.Schedule value) { + if (scheduleBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && schedule_ != null + && schedule_ != com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance()) { + getScheduleBuilder().mergeFrom(value); + } else { + schedule_ = value; + } + } else { + scheduleBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearSchedule() { + bitField0_ = (bitField0_ & ~0x00000002); + schedule_ = null; + if (scheduleBuilder_ != null) { + scheduleBuilder_.dispose(); + scheduleBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.aiplatform.v1.Schedule.Builder getScheduleBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getScheduleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder() { + if (scheduleBuilder_ != null) { + return scheduleBuilder_.getMessageOrBuilder(); + } else { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + } + /** + * + * + *
+     * Required. The Schedule to create.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + getScheduleFieldBuilder() { + if (scheduleBuilder_ == null) { + scheduleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder>( + getSchedule(), getParentForChildren(), isClean()); + schedule_ = null; + } + return scheduleBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.CreateScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.CreateScheduleRequest) + private static final com.google.cloud.aiplatform.v1.CreateScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.CreateScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.CreateScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreateScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..76efa91673f4 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/CreateScheduleRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface CreateScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.CreateScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the Location to create the Schedule in.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource name of the Location to create the Schedule in.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + boolean hasSchedule(); + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + com.google.cloud.aiplatform.v1.Schedule getSchedule(); + /** + * + * + *
+   * Required. The Schedule to create.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequest.java new file mode 100644 index 000000000000..ca16d66fefc8 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequest.java @@ -0,0 +1,654 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.DeleteSchedule][google.cloud.aiplatform.v1.ScheduleService.DeleteSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DeleteScheduleRequest} + */ +public final class DeleteScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.DeleteScheduleRequest) + DeleteScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteScheduleRequest.newBuilder() to construct. + private DeleteScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteScheduleRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest.class, + com.google.cloud.aiplatform.v1.DeleteScheduleRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the Schedule resource to be deleted.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Schedule resource to be deleted.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.DeleteScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.DeleteScheduleRequest other = + (com.google.cloud.aiplatform.v1.DeleteScheduleRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.DeleteScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.DeleteSchedule][google.cloud.aiplatform.v1.ScheduleService.DeleteSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DeleteScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.DeleteScheduleRequest) + com.google.cloud.aiplatform.v1.DeleteScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DeleteScheduleRequest.class, + com.google.cloud.aiplatform.v1.DeleteScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.DeleteScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DeleteScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.DeleteScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DeleteScheduleRequest build() { + com.google.cloud.aiplatform.v1.DeleteScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DeleteScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.DeleteScheduleRequest result = + new com.google.cloud.aiplatform.v1.DeleteScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.DeleteScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.DeleteScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.DeleteScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.DeleteScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.DeleteScheduleRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Schedule resource to be deleted.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be deleted.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be deleted.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be deleted.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be deleted.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.DeleteScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.DeleteScheduleRequest) + private static final com.google.cloud.aiplatform.v1.DeleteScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.DeleteScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.DeleteScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DeleteScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..af6828300676 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DeleteScheduleRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface DeleteScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.DeleteScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Schedule resource to be deleted.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Schedule resource to be deleted.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequest.java new file mode 100644 index 000000000000..1ae00bcb5335 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequest.java @@ -0,0 +1,654 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.GetSchedule][google.cloud.aiplatform.v1.ScheduleService.GetSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.GetScheduleRequest} + */ +public final class GetScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.GetScheduleRequest) + GetScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetScheduleRequest.newBuilder() to construct. + private GetScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetScheduleRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.GetScheduleRequest.class, + com.google.cloud.aiplatform.v1.GetScheduleRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the Schedule resource.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Schedule resource.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.GetScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.GetScheduleRequest other = + (com.google.cloud.aiplatform.v1.GetScheduleRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.GetScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.GetSchedule][google.cloud.aiplatform.v1.ScheduleService.GetSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.GetScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.GetScheduleRequest) + com.google.cloud.aiplatform.v1.GetScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.GetScheduleRequest.class, + com.google.cloud.aiplatform.v1.GetScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.GetScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.GetScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.GetScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.GetScheduleRequest build() { + com.google.cloud.aiplatform.v1.GetScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.GetScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.GetScheduleRequest result = + new com.google.cloud.aiplatform.v1.GetScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.GetScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.GetScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.GetScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.GetScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.GetScheduleRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Schedule resource.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.GetScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.GetScheduleRequest) + private static final com.google.cloud.aiplatform.v1.GetScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.GetScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.GetScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.GetScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..fa366fb44bc0 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/GetScheduleRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface GetScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.GetScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Schedule resource.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Schedule resource.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequest.java new file mode 100644 index 000000000000..0bb078508797 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequest.java @@ -0,0 +1,1633 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ListSchedulesRequest} + */ +public final class ListSchedulesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.ListSchedulesRequest) + ListSchedulesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListSchedulesRequest.newBuilder() to construct. + private ListSchedulesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListSchedulesRequest() { + parent_ = ""; + filter_ = ""; + pageToken_ = ""; + orderBy_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListSchedulesRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ListSchedulesRequest.class, + com.google.cloud.aiplatform.v1.ListSchedulesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The resource name of the Location to list the Schedules from.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the Location to list the Schedules from.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object filter_ = ""; + /** + * + * + *
+   * Lists the Schedules that match the filter expression. The following
+   * fields are supported:
+   *
+   * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+   * * `state`: Supports `=` and `!=` comparisons.
+   * * `request`: Supports existence of the <request_type> check.
+   *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+   *       create_pipeline_job_request).
+   * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+   *       existence check. Values must be in RFC 3339 format.
+   * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+   *       comparisons. Values must be in RFC 3339 format.
+   *
+   *
+   * Filter expressions can be combined together using logical operators
+   * (`NOT`, `AND` & `OR`).
+   * The syntax to define filter expression is based on
+   * https://google.aip.dev/160.
+   *
+   * Examples:
+   *
+   * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+   * * `NOT display_name="my_schedule"`
+   * * `create_time>"2021-05-18T00:00:00Z"`
+   * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+   * * `create_pipeline_job_request:*`
+   * 
+ * + * string filter = 2; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Lists the Schedules that match the filter expression. The following
+   * fields are supported:
+   *
+   * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+   * * `state`: Supports `=` and `!=` comparisons.
+   * * `request`: Supports existence of the <request_type> check.
+   *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+   *       create_pipeline_job_request).
+   * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+   *       existence check. Values must be in RFC 3339 format.
+   * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+   *       comparisons. Values must be in RFC 3339 format.
+   *
+   *
+   * Filter expressions can be combined together using logical operators
+   * (`NOT`, `AND` & `OR`).
+   * The syntax to define filter expression is based on
+   * https://google.aip.dev/160.
+   *
+   * Examples:
+   *
+   * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+   * * `NOT display_name="my_schedule"`
+   * * `create_time>"2021-05-18T00:00:00Z"`
+   * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+   * * `create_pipeline_job_request:*`
+   * 
+ * + * string filter = 2; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_ = 0; + /** + * + * + *
+   * The standard list page size.
+   * Default to 100 if not specified.
+   * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + * + * + *
+   * The standard list page token.
+   * Typically obtained via
+   * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+   * of the previous
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+   * call.
+   * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * The standard list page token.
+   * Typically obtained via
+   * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+   * of the previous
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+   * call.
+   * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ORDER_BY_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private volatile java.lang.Object orderBy_ = ""; + /** + * + * + *
+   * A comma-separated list of fields to order by. The default sort order is in
+   * ascending order. Use "desc" after a field name for descending. You can have
+   * multiple order_by fields provided.
+   *
+   * For example, using "create_time desc, end_time" will order results by
+   * create time in descending order, and if there are multiple schedules having
+   * the same create time, order them by the end time in ascending order.
+   *
+   * If order_by is not specified, it will order by default with create_time in
+   * descending order.
+   *
+   * Supported fields:
+   *   * `create_time`
+   *   * `start_time`
+   *   * `end_time`
+   *   * `next_run_time`
+   * 
+ * + * string order_by = 5; + * + * @return The orderBy. + */ + @java.lang.Override + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + orderBy_ = s; + return s; + } + } + /** + * + * + *
+   * A comma-separated list of fields to order by. The default sort order is in
+   * ascending order. Use "desc" after a field name for descending. You can have
+   * multiple order_by fields provided.
+   *
+   * For example, using "create_time desc, end_time" will order results by
+   * create time in descending order, and if there are multiple schedules having
+   * the same create time, order them by the end time in ascending order.
+   *
+   * If order_by is not specified, it will order by default with create_time in
+   * descending order.
+   *
+   * Supported fields:
+   *   * `create_time`
+   *   * `start_time`
+   *   * `end_time`
+   *   * `next_run_time`
+   * 
+ * + * string order_by = 5; + * + * @return The bytes for orderBy. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(orderBy_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, orderBy_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(orderBy_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, orderBy_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.ListSchedulesRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.ListSchedulesRequest other = + (com.google.cloud.aiplatform.v1.ListSchedulesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getOrderBy().equals(other.getOrderBy())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + ORDER_BY_FIELD_NUMBER; + hash = (53 * hash) + getOrderBy().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.ListSchedulesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ListSchedulesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.ListSchedulesRequest) + com.google.cloud.aiplatform.v1.ListSchedulesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ListSchedulesRequest.class, + com.google.cloud.aiplatform.v1.ListSchedulesRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.ListSchedulesRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + filter_ = ""; + pageSize_ = 0; + pageToken_ = ""; + orderBy_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.ListSchedulesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesRequest build() { + com.google.cloud.aiplatform.v1.ListSchedulesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesRequest buildPartial() { + com.google.cloud.aiplatform.v1.ListSchedulesRequest result = + new com.google.cloud.aiplatform.v1.ListSchedulesRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.ListSchedulesRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.filter_ = filter_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.pageToken_ = pageToken_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.orderBy_ = orderBy_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.ListSchedulesRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.ListSchedulesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.ListSchedulesRequest other) { + if (other == com.google.cloud.aiplatform.v1.ListSchedulesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getOrderBy().isEmpty()) { + orderBy_ = other.orderBy_; + bitField0_ |= 0x00000010; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + filter_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + orderBy_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource name of the Location to list the Schedules from.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Location to list the Schedules from.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Location to list the Schedules from.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Location to list the Schedules from.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Location to list the Schedules from.
+     * Format: `projects/{project}/locations/{location}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Lists the Schedules that match the filter expression. The following
+     * fields are supported:
+     *
+     * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+     * * `state`: Supports `=` and `!=` comparisons.
+     * * `request`: Supports existence of the <request_type> check.
+     *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+     *       create_pipeline_job_request).
+     * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+     *       existence check. Values must be in RFC 3339 format.
+     * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+     *       comparisons. Values must be in RFC 3339 format.
+     *
+     *
+     * Filter expressions can be combined together using logical operators
+     * (`NOT`, `AND` & `OR`).
+     * The syntax to define filter expression is based on
+     * https://google.aip.dev/160.
+     *
+     * Examples:
+     *
+     * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+     * * `NOT display_name="my_schedule"`
+     * * `create_time>"2021-05-18T00:00:00Z"`
+     * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+     * * `create_pipeline_job_request:*`
+     * 
+ * + * string filter = 2; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Lists the Schedules that match the filter expression. The following
+     * fields are supported:
+     *
+     * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+     * * `state`: Supports `=` and `!=` comparisons.
+     * * `request`: Supports existence of the <request_type> check.
+     *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+     *       create_pipeline_job_request).
+     * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+     *       existence check. Values must be in RFC 3339 format.
+     * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+     *       comparisons. Values must be in RFC 3339 format.
+     *
+     *
+     * Filter expressions can be combined together using logical operators
+     * (`NOT`, `AND` & `OR`).
+     * The syntax to define filter expression is based on
+     * https://google.aip.dev/160.
+     *
+     * Examples:
+     *
+     * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+     * * `NOT display_name="my_schedule"`
+     * * `create_time>"2021-05-18T00:00:00Z"`
+     * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+     * * `create_pipeline_job_request:*`
+     * 
+ * + * string filter = 2; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Lists the Schedules that match the filter expression. The following
+     * fields are supported:
+     *
+     * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+     * * `state`: Supports `=` and `!=` comparisons.
+     * * `request`: Supports existence of the <request_type> check.
+     *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+     *       create_pipeline_job_request).
+     * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+     *       existence check. Values must be in RFC 3339 format.
+     * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+     *       comparisons. Values must be in RFC 3339 format.
+     *
+     *
+     * Filter expressions can be combined together using logical operators
+     * (`NOT`, `AND` & `OR`).
+     * The syntax to define filter expression is based on
+     * https://google.aip.dev/160.
+     *
+     * Examples:
+     *
+     * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+     * * `NOT display_name="my_schedule"`
+     * * `create_time>"2021-05-18T00:00:00Z"`
+     * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+     * * `create_pipeline_job_request:*`
+     * 
+ * + * string filter = 2; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + filter_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Lists the Schedules that match the filter expression. The following
+     * fields are supported:
+     *
+     * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+     * * `state`: Supports `=` and `!=` comparisons.
+     * * `request`: Supports existence of the <request_type> check.
+     *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+     *       create_pipeline_job_request).
+     * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+     *       existence check. Values must be in RFC 3339 format.
+     * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+     *       comparisons. Values must be in RFC 3339 format.
+     *
+     *
+     * Filter expressions can be combined together using logical operators
+     * (`NOT`, `AND` & `OR`).
+     * The syntax to define filter expression is based on
+     * https://google.aip.dev/160.
+     *
+     * Examples:
+     *
+     * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+     * * `NOT display_name="my_schedule"`
+     * * `create_time>"2021-05-18T00:00:00Z"`
+     * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+     * * `create_pipeline_job_request:*`
+     * 
+ * + * string filter = 2; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + filter_ = getDefaultInstance().getFilter(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Lists the Schedules that match the filter expression. The following
+     * fields are supported:
+     *
+     * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+     * * `state`: Supports `=` and `!=` comparisons.
+     * * `request`: Supports existence of the <request_type> check.
+     *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+     *       create_pipeline_job_request).
+     * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+     *       Values must be in RFC 3339 format.
+     * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+     *       existence check. Values must be in RFC 3339 format.
+     * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+     *       comparisons. Values must be in RFC 3339 format.
+     *
+     *
+     * Filter expressions can be combined together using logical operators
+     * (`NOT`, `AND` & `OR`).
+     * The syntax to define filter expression is based on
+     * https://google.aip.dev/160.
+     *
+     * Examples:
+     *
+     * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+     * * `NOT display_name="my_schedule"`
+     * * `create_time>"2021-05-18T00:00:00Z"`
+     * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+     * * `create_pipeline_job_request:*`
+     * 
+ * + * string filter = 2; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + filter_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * The standard list page size.
+     * Default to 100 if not specified.
+     * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The standard list page size.
+     * Default to 100 if not specified.
+     * 
+ * + * int32 page_size = 3; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The standard list page size.
+     * Default to 100 if not specified.
+     * 
+ * + * int32 page_size = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000004); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * The standard list page token.
+     * Typically obtained via
+     * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+     * of the previous
+     * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+     * call.
+     * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The standard list page token.
+     * Typically obtained via
+     * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+     * of the previous
+     * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+     * call.
+     * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The standard list page token.
+     * Typically obtained via
+     * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+     * of the previous
+     * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+     * call.
+     * 
+ * + * string page_token = 4; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The standard list page token.
+     * Typically obtained via
+     * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+     * of the previous
+     * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+     * call.
+     * 
+ * + * string page_token = 4; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * The standard list page token.
+     * Typically obtained via
+     * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+     * of the previous
+     * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+     * call.
+     * 
+ * + * string page_token = 4; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object orderBy_ = ""; + /** + * + * + *
+     * A comma-separated list of fields to order by. The default sort order is in
+     * ascending order. Use "desc" after a field name for descending. You can have
+     * multiple order_by fields provided.
+     *
+     * For example, using "create_time desc, end_time" will order results by
+     * create time in descending order, and if there are multiple schedules having
+     * the same create time, order them by the end time in ascending order.
+     *
+     * If order_by is not specified, it will order by default with create_time in
+     * descending order.
+     *
+     * Supported fields:
+     *   * `create_time`
+     *   * `start_time`
+     *   * `end_time`
+     *   * `next_run_time`
+     * 
+ * + * string order_by = 5; + * + * @return The orderBy. + */ + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + orderBy_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A comma-separated list of fields to order by. The default sort order is in
+     * ascending order. Use "desc" after a field name for descending. You can have
+     * multiple order_by fields provided.
+     *
+     * For example, using "create_time desc, end_time" will order results by
+     * create time in descending order, and if there are multiple schedules having
+     * the same create time, order them by the end time in ascending order.
+     *
+     * If order_by is not specified, it will order by default with create_time in
+     * descending order.
+     *
+     * Supported fields:
+     *   * `create_time`
+     *   * `start_time`
+     *   * `end_time`
+     *   * `next_run_time`
+     * 
+ * + * string order_by = 5; + * + * @return The bytes for orderBy. + */ + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A comma-separated list of fields to order by. The default sort order is in
+     * ascending order. Use "desc" after a field name for descending. You can have
+     * multiple order_by fields provided.
+     *
+     * For example, using "create_time desc, end_time" will order results by
+     * create time in descending order, and if there are multiple schedules having
+     * the same create time, order them by the end time in ascending order.
+     *
+     * If order_by is not specified, it will order by default with create_time in
+     * descending order.
+     *
+     * Supported fields:
+     *   * `create_time`
+     *   * `start_time`
+     *   * `end_time`
+     *   * `next_run_time`
+     * 
+ * + * string order_by = 5; + * + * @param value The orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderBy(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + orderBy_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * A comma-separated list of fields to order by. The default sort order is in
+     * ascending order. Use "desc" after a field name for descending. You can have
+     * multiple order_by fields provided.
+     *
+     * For example, using "create_time desc, end_time" will order results by
+     * create time in descending order, and if there are multiple schedules having
+     * the same create time, order them by the end time in ascending order.
+     *
+     * If order_by is not specified, it will order by default with create_time in
+     * descending order.
+     *
+     * Supported fields:
+     *   * `create_time`
+     *   * `start_time`
+     *   * `end_time`
+     *   * `next_run_time`
+     * 
+ * + * string order_by = 5; + * + * @return This builder for chaining. + */ + public Builder clearOrderBy() { + orderBy_ = getDefaultInstance().getOrderBy(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + * + * + *
+     * A comma-separated list of fields to order by. The default sort order is in
+     * ascending order. Use "desc" after a field name for descending. You can have
+     * multiple order_by fields provided.
+     *
+     * For example, using "create_time desc, end_time" will order results by
+     * create time in descending order, and if there are multiple schedules having
+     * the same create time, order them by the end time in ascending order.
+     *
+     * If order_by is not specified, it will order by default with create_time in
+     * descending order.
+     *
+     * Supported fields:
+     *   * `create_time`
+     *   * `start_time`
+     *   * `end_time`
+     *   * `next_run_time`
+     * 
+ * + * string order_by = 5; + * + * @param value The bytes for orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderByBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + orderBy_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.ListSchedulesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.ListSchedulesRequest) + private static final com.google.cloud.aiplatform.v1.ListSchedulesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.ListSchedulesRequest(); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSchedulesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequestOrBuilder.java new file mode 100644 index 000000000000..e63aa99aad38 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesRequestOrBuilder.java @@ -0,0 +1,243 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface ListSchedulesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.ListSchedulesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the Location to list the Schedules from.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource name of the Location to list the Schedules from.
+   * Format: `projects/{project}/locations/{location}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Lists the Schedules that match the filter expression. The following
+   * fields are supported:
+   *
+   * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+   * * `state`: Supports `=` and `!=` comparisons.
+   * * `request`: Supports existence of the <request_type> check.
+   *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+   *       create_pipeline_job_request).
+   * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+   *       existence check. Values must be in RFC 3339 format.
+   * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+   *       comparisons. Values must be in RFC 3339 format.
+   *
+   *
+   * Filter expressions can be combined together using logical operators
+   * (`NOT`, `AND` & `OR`).
+   * The syntax to define filter expression is based on
+   * https://google.aip.dev/160.
+   *
+   * Examples:
+   *
+   * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+   * * `NOT display_name="my_schedule"`
+   * * `create_time>"2021-05-18T00:00:00Z"`
+   * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+   * * `create_pipeline_job_request:*`
+   * 
+ * + * string filter = 2; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Lists the Schedules that match the filter expression. The following
+   * fields are supported:
+   *
+   * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
+   * * `state`: Supports `=` and `!=` comparisons.
+   * * `request`: Supports existence of the <request_type> check.
+   *       (e.g. `create_pipeline_job_request:*` --> Schedule has
+   *       create_pipeline_job_request).
+   * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
+   *       Values must be in RFC 3339 format.
+   * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
+   *       existence check. Values must be in RFC 3339 format.
+   * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
+   *       comparisons. Values must be in RFC 3339 format.
+   *
+   *
+   * Filter expressions can be combined together using logical operators
+   * (`NOT`, `AND` & `OR`).
+   * The syntax to define filter expression is based on
+   * https://google.aip.dev/160.
+   *
+   * Examples:
+   *
+   * * `state="ACTIVE" AND display_name:"my_schedule_*"`
+   * * `NOT display_name="my_schedule"`
+   * * `create_time>"2021-05-18T00:00:00Z"`
+   * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
+   * * `create_pipeline_job_request:*`
+   * 
+ * + * string filter = 2; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * The standard list page size.
+   * Default to 100 if not specified.
+   * 
+ * + * int32 page_size = 3; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * The standard list page token.
+   * Typically obtained via
+   * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+   * of the previous
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+   * call.
+   * 
+ * + * string page_token = 4; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * The standard list page token.
+   * Typically obtained via
+   * [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token]
+   * of the previous
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+   * call.
+   * 
+ * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * A comma-separated list of fields to order by. The default sort order is in
+   * ascending order. Use "desc" after a field name for descending. You can have
+   * multiple order_by fields provided.
+   *
+   * For example, using "create_time desc, end_time" will order results by
+   * create time in descending order, and if there are multiple schedules having
+   * the same create time, order them by the end time in ascending order.
+   *
+   * If order_by is not specified, it will order by default with create_time in
+   * descending order.
+   *
+   * Supported fields:
+   *   * `create_time`
+   *   * `start_time`
+   *   * `end_time`
+   *   * `next_run_time`
+   * 
+ * + * string order_by = 5; + * + * @return The orderBy. + */ + java.lang.String getOrderBy(); + /** + * + * + *
+   * A comma-separated list of fields to order by. The default sort order is in
+   * ascending order. Use "desc" after a field name for descending. You can have
+   * multiple order_by fields provided.
+   *
+   * For example, using "create_time desc, end_time" will order results by
+   * create time in descending order, and if there are multiple schedules having
+   * the same create time, order them by the end time in ascending order.
+   *
+   * If order_by is not specified, it will order by default with create_time in
+   * descending order.
+   *
+   * Supported fields:
+   *   * `create_time`
+   *   * `start_time`
+   *   * `end_time`
+   *   * `next_run_time`
+   * 
+ * + * string order_by = 5; + * + * @return The bytes for orderBy. + */ + com.google.protobuf.ByteString getOrderByBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponse.java new file mode 100644 index 000000000000..499b3cd31624 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponse.java @@ -0,0 +1,1140 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Response message for
+ * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ListSchedulesResponse} + */ +public final class ListSchedulesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.ListSchedulesResponse) + ListSchedulesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListSchedulesResponse.newBuilder() to construct. + private ListSchedulesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListSchedulesResponse() { + schedules_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListSchedulesResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ListSchedulesResponse.class, + com.google.cloud.aiplatform.v1.ListSchedulesResponse.Builder.class); + } + + public static final int SCHEDULES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List schedules_; + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + @java.lang.Override + public java.util.List getSchedulesList() { + return schedules_; + } + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + @java.lang.Override + public java.util.List + getSchedulesOrBuilderList() { + return schedules_; + } + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + @java.lang.Override + public int getSchedulesCount() { + return schedules_.size(); + } + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule getSchedules(int index) { + return schedules_.get(index); + } + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getSchedulesOrBuilder(int index) { + return schedules_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+   * A token to retrieve the next page of results.
+   * Pass to
+   * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+   * to obtain that page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve the next page of results.
+   * Pass to
+   * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+   * to obtain that page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < schedules_.size(); i++) { + output.writeMessage(1, schedules_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < schedules_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, schedules_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.ListSchedulesResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.ListSchedulesResponse other = + (com.google.cloud.aiplatform.v1.ListSchedulesResponse) obj; + + if (!getSchedulesList().equals(other.getSchedulesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSchedulesCount() > 0) { + hash = (37 * hash) + SCHEDULES_FIELD_NUMBER; + hash = (53 * hash) + getSchedulesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.ListSchedulesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ListSchedulesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.ListSchedulesResponse) + com.google.cloud.aiplatform.v1.ListSchedulesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ListSchedulesResponse.class, + com.google.cloud.aiplatform.v1.ListSchedulesResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.ListSchedulesResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (schedulesBuilder_ == null) { + schedules_ = java.util.Collections.emptyList(); + } else { + schedules_ = null; + schedulesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.ListSchedulesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesResponse build() { + com.google.cloud.aiplatform.v1.ListSchedulesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesResponse buildPartial() { + com.google.cloud.aiplatform.v1.ListSchedulesResponse result = + new com.google.cloud.aiplatform.v1.ListSchedulesResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1.ListSchedulesResponse result) { + if (schedulesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + schedules_ = java.util.Collections.unmodifiableList(schedules_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.schedules_ = schedules_; + } else { + result.schedules_ = schedulesBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.ListSchedulesResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.ListSchedulesResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.ListSchedulesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.ListSchedulesResponse other) { + if (other == com.google.cloud.aiplatform.v1.ListSchedulesResponse.getDefaultInstance()) + return this; + if (schedulesBuilder_ == null) { + if (!other.schedules_.isEmpty()) { + if (schedules_.isEmpty()) { + schedules_ = other.schedules_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSchedulesIsMutable(); + schedules_.addAll(other.schedules_); + } + onChanged(); + } + } else { + if (!other.schedules_.isEmpty()) { + if (schedulesBuilder_.isEmpty()) { + schedulesBuilder_.dispose(); + schedulesBuilder_ = null; + schedules_ = other.schedules_; + bitField0_ = (bitField0_ & ~0x00000001); + schedulesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getSchedulesFieldBuilder() + : null; + } else { + schedulesBuilder_.addAllMessages(other.schedules_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.aiplatform.v1.Schedule m = + input.readMessage( + com.google.cloud.aiplatform.v1.Schedule.parser(), extensionRegistry); + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + schedules_.add(m); + } else { + schedulesBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List schedules_ = + java.util.Collections.emptyList(); + + private void ensureSchedulesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + schedules_ = new java.util.ArrayList(schedules_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + schedulesBuilder_; + + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public java.util.List getSchedulesList() { + if (schedulesBuilder_ == null) { + return java.util.Collections.unmodifiableList(schedules_); + } else { + return schedulesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public int getSchedulesCount() { + if (schedulesBuilder_ == null) { + return schedules_.size(); + } else { + return schedulesBuilder_.getCount(); + } + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public com.google.cloud.aiplatform.v1.Schedule getSchedules(int index) { + if (schedulesBuilder_ == null) { + return schedules_.get(index); + } else { + return schedulesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder setSchedules(int index, com.google.cloud.aiplatform.v1.Schedule value) { + if (schedulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchedulesIsMutable(); + schedules_.set(index, value); + onChanged(); + } else { + schedulesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder setSchedules( + int index, com.google.cloud.aiplatform.v1.Schedule.Builder builderForValue) { + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + schedules_.set(index, builderForValue.build()); + onChanged(); + } else { + schedulesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder addSchedules(com.google.cloud.aiplatform.v1.Schedule value) { + if (schedulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchedulesIsMutable(); + schedules_.add(value); + onChanged(); + } else { + schedulesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder addSchedules(int index, com.google.cloud.aiplatform.v1.Schedule value) { + if (schedulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchedulesIsMutable(); + schedules_.add(index, value); + onChanged(); + } else { + schedulesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder addSchedules(com.google.cloud.aiplatform.v1.Schedule.Builder builderForValue) { + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + schedules_.add(builderForValue.build()); + onChanged(); + } else { + schedulesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder addSchedules( + int index, com.google.cloud.aiplatform.v1.Schedule.Builder builderForValue) { + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + schedules_.add(index, builderForValue.build()); + onChanged(); + } else { + schedulesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder addAllSchedules( + java.lang.Iterable values) { + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, schedules_); + onChanged(); + } else { + schedulesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder clearSchedules() { + if (schedulesBuilder_ == null) { + schedules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + schedulesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public Builder removeSchedules(int index) { + if (schedulesBuilder_ == null) { + ensureSchedulesIsMutable(); + schedules_.remove(index); + onChanged(); + } else { + schedulesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public com.google.cloud.aiplatform.v1.Schedule.Builder getSchedulesBuilder(int index) { + return getSchedulesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getSchedulesOrBuilder(int index) { + if (schedulesBuilder_ == null) { + return schedules_.get(index); + } else { + return schedulesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public java.util.List + getSchedulesOrBuilderList() { + if (schedulesBuilder_ != null) { + return schedulesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(schedules_); + } + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public com.google.cloud.aiplatform.v1.Schedule.Builder addSchedulesBuilder() { + return getSchedulesFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance()); + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public com.google.cloud.aiplatform.v1.Schedule.Builder addSchedulesBuilder(int index) { + return getSchedulesFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance()); + } + /** + * + * + *
+     * List of Schedules in the requested page.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + public java.util.List + getSchedulesBuilderList() { + return getSchedulesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + getSchedulesFieldBuilder() { + if (schedulesBuilder_ == null) { + schedulesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder>( + schedules_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + schedules_ = null; + } + return schedulesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve the next page of results.
+     * Pass to
+     * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+     * to obtain that page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results.
+     * Pass to
+     * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+     * to obtain that page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results.
+     * Pass to
+     * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+     * to obtain that page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results.
+     * Pass to
+     * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+     * to obtain that page.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results.
+     * Pass to
+     * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+     * to obtain that page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.ListSchedulesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.ListSchedulesResponse) + private static final com.google.cloud.aiplatform.v1.ListSchedulesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.ListSchedulesResponse(); + } + + public static com.google.cloud.aiplatform.v1.ListSchedulesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSchedulesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ListSchedulesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponseOrBuilder.java new file mode 100644 index 000000000000..e2fa89b74af0 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ListSchedulesResponseOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface ListSchedulesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.ListSchedulesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + java.util.List getSchedulesList(); + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + com.google.cloud.aiplatform.v1.Schedule getSchedules(int index); + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + int getSchedulesCount(); + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + java.util.List + getSchedulesOrBuilderList(); + /** + * + * + *
+   * List of Schedules in the requested page.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Schedule schedules = 1; + */ + com.google.cloud.aiplatform.v1.ScheduleOrBuilder getSchedulesOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve the next page of results.
+   * Pass to
+   * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+   * to obtain that page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve the next page of results.
+   * Pass to
+   * [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token]
+   * to obtain that page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequest.java new file mode 100644 index 000000000000..8591d34de7eb --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequest.java @@ -0,0 +1,654 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.PauseSchedule][google.cloud.aiplatform.v1.ScheduleService.PauseSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.PauseScheduleRequest} + */ +public final class PauseScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.PauseScheduleRequest) + PauseScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use PauseScheduleRequest.newBuilder() to construct. + private PauseScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PauseScheduleRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PauseScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.PauseScheduleRequest.class, + com.google.cloud.aiplatform.v1.PauseScheduleRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the Schedule resource to be paused.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Schedule resource to be paused.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.PauseScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.PauseScheduleRequest other = + (com.google.cloud.aiplatform.v1.PauseScheduleRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.PauseScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.PauseSchedule][google.cloud.aiplatform.v1.ScheduleService.PauseSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.PauseScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.PauseScheduleRequest) + com.google.cloud.aiplatform.v1.PauseScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.PauseScheduleRequest.class, + com.google.cloud.aiplatform.v1.PauseScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.PauseScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.PauseScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.PauseScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.PauseScheduleRequest build() { + com.google.cloud.aiplatform.v1.PauseScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.PauseScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.PauseScheduleRequest result = + new com.google.cloud.aiplatform.v1.PauseScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.PauseScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.PauseScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.PauseScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.PauseScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.PauseScheduleRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Schedule resource to be paused.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be paused.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be paused.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be paused.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be paused.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.PauseScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.PauseScheduleRequest) + private static final com.google.cloud.aiplatform.v1.PauseScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.PauseScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.PauseScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PauseScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.PauseScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..5183c30f3fb5 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PauseScheduleRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface PauseScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.PauseScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Schedule resource to be paused.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Schedule resource to be paused.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponse.java index 5e71f1315ea5..be0fa9d33115 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponse.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponse.java @@ -374,6 +374,55 @@ public com.google.protobuf.ByteString getModelDisplayNameBytes() { } } + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Value metadata_; + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return metadata_ != null; + } + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Value getMetadata() { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + @java.lang.Override + public com.google.protobuf.ValueOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -403,6 +452,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelVersionId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, modelVersionId_); } + if (metadata_ != null) { + output.writeMessage(6, getMetadata()); + } getUnknownFields().writeTo(output); } @@ -427,6 +479,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelVersionId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, modelVersionId_); } + if (metadata_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getMetadata()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -448,6 +503,10 @@ public boolean equals(final java.lang.Object obj) { if (!getModel().equals(other.getModel())) return false; if (!getModelVersionId().equals(other.getModelVersionId())) return false; if (!getModelDisplayName().equals(other.getModelDisplayName())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata().equals(other.getMetadata())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -471,6 +530,10 @@ public int hashCode() { hash = (53 * hash) + getModelVersionId().hashCode(); hash = (37 * hash) + MODEL_DISPLAY_NAME_FIELD_NUMBER; hash = (53 * hash) + getModelDisplayName().hashCode(); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -622,6 +685,11 @@ public Builder clear() { model_ = ""; modelVersionId_ = ""; modelDisplayName_ = ""; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } return this; } @@ -683,6 +751,9 @@ private void buildPartial0(com.google.cloud.aiplatform.v1.PredictResponse result if (((from_bitField0_ & 0x00000010) != 0)) { result.modelDisplayName_ = modelDisplayName_; } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null ? metadata_ : metadataBuilder_.build(); + } } @java.lang.Override @@ -777,6 +848,9 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1.PredictResponse other) { bitField0_ |= 0x00000010; onChanged(); } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -839,6 +913,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000008; break; } // case 42 + case 50: + { + input.readMessage(getMetadataFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1730,6 +1810,203 @@ public Builder setModelDisplayNameBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.protobuf.Value metadata_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder> + metadataBuilder_; + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The metadata. + */ + public com.google.protobuf.Value getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMetadata(com.google.protobuf.Value value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMetadata(com.google.protobuf.Value.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeMetadata(com.google.protobuf.Value value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && metadata_ != null + && metadata_ != com.google.protobuf.Value.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Value.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.ValueOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder> + getMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder>( + getMetadata(), getParentForChildren(), isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponseOrBuilder.java index b88e888c09fa..7e11f6549f72 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponseOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictResponseOrBuilder.java @@ -205,4 +205,42 @@ public interface PredictResponseOrBuilder * @return The bytes for modelDisplayName. */ com.google.protobuf.ByteString getModelDisplayNameBytes(); + + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The metadata. + */ + com.google.protobuf.Value getMetadata(); + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + com.google.protobuf.ValueOrBuilder getMetadataOrBuilder(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java index cf177868c578..e7466914d8c4 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java @@ -39,6 +39,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1_RawPredictRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1_RawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -62,59 +70,77 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "api/client.proto\032\037google/api/field_behav" + "ior.proto\032\031google/api/httpbody.proto\032\031go" + "ogle/api/resource.proto\032,google/cloud/ai" - + "platform/v1/explanation.proto\032\034google/pr" + + "platform/v1/explanation.proto\032&google/cl" + + "oud/aiplatform/v1/types.proto\032\034google/pr" + "otobuf/struct.proto\"\254\001\n\016PredictRequest\022=" + "\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.go" + "ogleapis.com/Endpoint\022/\n\tinstances\030\002 \003(\013" + "2\026.google.protobuf.ValueB\004\342A\001\002\022*\n\nparame" - + "ters\030\003 \001(\0132\026.google.protobuf.Value\"\324\001\n\017P" + + "ters\030\003 \001(\0132\026.google.protobuf.Value\"\204\002\n\017P" + "redictResponse\022+\n\013predictions\030\001 \003(\0132\026.go" + "ogle.protobuf.Value\022\031\n\021deployed_model_id" + "\030\002 \001(\t\0227\n\005model\030\003 \001(\tB(\342A\001\003\372A!\n\037aiplatfo" + "rm.googleapis.com/Model\022\036\n\020model_version" + "_id\030\005 \001(\tB\004\342A\001\003\022 \n\022model_display_name\030\004 " - + "\001(\tB\004\342A\001\003\"{\n\021RawPredictRequest\022=\n\010endpoi" - + "nt\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis" - + ".com/Endpoint\022\'\n\thttp_body\030\002 \001(\0132\024.googl" - + "e.api.HttpBody\"\237\002\n\016ExplainRequest\022=\n\010end" - + "point\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googlea" - + "pis.com/Endpoint\022/\n\tinstances\030\002 \003(\0132\026.go" - + "ogle.protobuf.ValueB\004\342A\001\002\022*\n\nparameters\030" - + "\004 \001(\0132\026.google.protobuf.Value\022V\n\031explana" - + "tion_spec_override\030\005 \001(\01323.google.cloud." - + "aiplatform.v1.ExplanationSpecOverride\022\031\n" - + "\021deployed_model_id\030\003 \001(\t\"\230\001\n\017ExplainResp" - + "onse\022=\n\014explanations\030\001 \003(\0132\'.google.clou" - + "d.aiplatform.v1.Explanation\022\031\n\021deployed_" - + "model_id\030\002 \001(\t\022+\n\013predictions\030\003 \003(\0132\026.go" - + "ogle.protobuf.Value2\327\006\n\021PredictionServic" - + "e\022\224\002\n\007Predict\022*.google.cloud.aiplatform." - + "v1.PredictRequest\032+.google.cloud.aiplatf" - + "orm.v1.PredictResponse\"\257\001\332A\035endpoint,ins" - + "tances,parameters\202\323\344\223\002\210\001\"9/v1/{endpoint=" - + "projects/*/locations/*/endpoints/*}:pred" - + "ict:\001*ZH\"C/v1/{endpoint=projects/*/locat" - + "ions/*/publishers/*/models/*}:predict:\001*" - + "\022\376\001\n\nRawPredict\022-.google.cloud.aiplatfor" - + "m.v1.RawPredictRequest\032\024.google.api.Http" - + "Body\"\252\001\332A\022endpoint,http_body\202\323\344\223\002\216\001\"\"9/v1/{endpoint=projects" - + "/*/locations/*/endpoints/*}:explain:\001*\032M" - + "\312A\031aiplatform.googleapis.com\322A.https://w" - + "ww.googleapis.com/auth/cloud-platformB\324\001" - + "\n\036com.google.cloud.aiplatform.v1B\026Predic" - + "tionServiceProtoP\001Z>cloud.google.com/go/" - + "aiplatform/apiv1/aiplatformpb;aiplatform" - + "pb\252\002\032Google.Cloud.AIPlatform.V1\312\002\032Google" - + "\\Cloud\\AIPlatform\\V1\352\002\035Google::Cloud::AI" - + "Platform::V1b\006proto3" + + "\001(\tB\004\342A\001\003\022.\n\010metadata\030\006 \001(\0132\026.google.pro" + + "tobuf.ValueB\004\342A\001\003\"{\n\021RawPredictRequest\022=" + + "\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.go" + + "ogleapis.com/Endpoint\022\'\n\thttp_body\030\002 \001(\013" + + "2\024.google.api.HttpBody\"\304\001\n\027StreamingPred" + + "ictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"a" + + "iplatform.googleapis.com/Endpoint\0222\n\006inp" + + "uts\030\002 \003(\0132\".google.cloud.aiplatform.v1.T" + + "ensor\0226\n\nparameters\030\003 \001(\0132\".google.cloud" + + ".aiplatform.v1.Tensor\"\207\001\n\030StreamingPredi" + + "ctResponse\0223\n\007outputs\030\001 \003(\0132\".google.clo" + + "ud.aiplatform.v1.Tensor\0226\n\nparameters\030\002 " + + "\001(\0132\".google.cloud.aiplatform.v1.Tensor\"" + + "\237\002\n\016ExplainRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" + + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" + + "t\022/\n\tinstances\030\002 \003(\0132\026.google.protobuf.V" + + "alueB\004\342A\001\002\022*\n\nparameters\030\004 \001(\0132\026.google." + + "protobuf.Value\022V\n\031explanation_spec_overr" + + "ide\030\005 \001(\01323.google.cloud.aiplatform.v1.E" + + "xplanationSpecOverride\022\031\n\021deployed_model" + + "_id\030\003 \001(\t\"\230\001\n\017ExplainResponse\022=\n\014explana" + + "tions\030\001 \003(\0132\'.google.cloud.aiplatform.v1" + + ".Explanation\022\031\n\021deployed_model_id\030\002 \001(\t\022" + + "+\n\013predictions\030\003 \003(\0132\026.google.protobuf.V" + + "alue2\217\t\n\021PredictionService\022\224\002\n\007Predict\022*" + + ".google.cloud.aiplatform.v1.PredictReque" + + "st\032+.google.cloud.aiplatform.v1.PredictR" + + "esponse\"\257\001\332A\035endpoint,instances,paramete" + + "rs\202\323\344\223\002\210\001\"9/v1/{endpoint=projects/*/loca" + + "tions/*/endpoints/*}:predict:\001*ZH\"C/v1/{" + + "endpoint=projects/*/locations/*/publishe" + + "rs/*/models/*}:predict:\001*\022\376\001\n\nRawPredict" + + "\022-.google.cloud.aiplatform.v1.RawPredict" + + "Request\032\024.google.api.HttpBody\"\252\001\332A\022endpo" + + "int,http_body\202\323\344\223\002\216\001\"\"9/v1/{" + + "endpoint=projects/*/locations/*/endpoint" + + "s/*}:explain:\001*\032M\312A\031aiplatform.googleapi" + + "s.com\322A.https://www.googleapis.com/auth/" + + "cloud-platformB\324\001\n\036com.google.cloud.aipl" + + "atform.v1B\026PredictionServiceProtoP\001Z>clo" + + "ud.google.com/go/aiplatform/apiv1/aiplat" + + "formpb;aiplatformpb\252\002\032Google.Cloud.AIPla" + + "tform.V1\312\002\032Google\\Cloud\\AIPlatform\\V1\352\002\035" + + "Google::Cloud::AIPlatform::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -126,6 +152,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.HttpBodyProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.cloud.aiplatform.v1.ExplanationProto.getDescriptor(), + com.google.cloud.aiplatform.v1.TypesProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), }); internal_static_google_cloud_aiplatform_v1_PredictRequest_descriptor = @@ -142,7 +169,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_PredictResponse_descriptor, new java.lang.String[] { - "Predictions", "DeployedModelId", "Model", "ModelVersionId", "ModelDisplayName", + "Predictions", + "DeployedModelId", + "Model", + "ModelVersionId", + "ModelDisplayName", + "Metadata", }); internal_static_google_cloud_aiplatform_v1_RawPredictRequest_descriptor = getDescriptor().getMessageTypes().get(2); @@ -152,8 +184,24 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Endpoint", "HttpBody", }); - internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor = + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "Inputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor, + new java.lang.String[] { + "Outputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor = + getDescriptor().getMessageTypes().get(5); internal_static_google_cloud_aiplatform_v1_ExplainRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor, @@ -161,7 +209,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Instances", "Parameters", "ExplanationSpecOverride", "DeployedModelId", }); internal_static_google_cloud_aiplatform_v1_ExplainResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(6); internal_static_google_cloud_aiplatform_v1_ExplainResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_ExplainResponse_descriptor, @@ -184,6 +232,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.HttpBodyProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.cloud.aiplatform.v1.ExplanationProto.getDescriptor(); + com.google.cloud.aiplatform.v1.TypesProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequest.java new file mode 100644 index 000000000000..f48e46a3b454 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequest.java @@ -0,0 +1,763 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.ResumeSchedule][google.cloud.aiplatform.v1.ScheduleService.ResumeSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ResumeScheduleRequest} + */ +public final class ResumeScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.ResumeScheduleRequest) + ResumeScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResumeScheduleRequest.newBuilder() to construct. + private ResumeScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResumeScheduleRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResumeScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest.class, + com.google.cloud.aiplatform.v1.ResumeScheduleRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the Schedule resource to be resumed.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Schedule resource to be resumed.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATCH_UP_FIELD_NUMBER = 2; + private boolean catchUp_ = false; + /** + * + * + *
+   * Optional. Whether to backfill missed runs when the schedule is resumed from
+   * PAUSED state. If set to true, all missed runs will be scheduled. New runs
+   * will be scheduled after the backfill is complete. This will also update
+   * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field.
+   * Default to false.
+   * 
+ * + * bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The catchUp. + */ + @java.lang.Override + public boolean getCatchUp() { + return catchUp_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (catchUp_ != false) { + output.writeBool(2, catchUp_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (catchUp_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, catchUp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.ResumeScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.ResumeScheduleRequest other = + (com.google.cloud.aiplatform.v1.ResumeScheduleRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getCatchUp() != other.getCatchUp()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + CATCH_UP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getCatchUp()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.ResumeScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.ResumeSchedule][google.cloud.aiplatform.v1.ScheduleService.ResumeSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.ResumeScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.ResumeScheduleRequest) + com.google.cloud.aiplatform.v1.ResumeScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.ResumeScheduleRequest.class, + com.google.cloud.aiplatform.v1.ResumeScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.ResumeScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + catchUp_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ResumeScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.ResumeScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ResumeScheduleRequest build() { + com.google.cloud.aiplatform.v1.ResumeScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ResumeScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.ResumeScheduleRequest result = + new com.google.cloud.aiplatform.v1.ResumeScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.ResumeScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.catchUp_ = catchUp_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.ResumeScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.ResumeScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.ResumeScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.ResumeScheduleRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getCatchUp() != false) { + setCatchUp(other.getCatchUp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + catchUp_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Schedule resource to be resumed.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be resumed.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be resumed.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be resumed.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Schedule resource to be resumed.
+     * Format:
+     * `projects/{project}/locations/{location}/schedules/{schedule}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private boolean catchUp_; + /** + * + * + *
+     * Optional. Whether to backfill missed runs when the schedule is resumed from
+     * PAUSED state. If set to true, all missed runs will be scheduled. New runs
+     * will be scheduled after the backfill is complete. This will also update
+     * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field.
+     * Default to false.
+     * 
+ * + * bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The catchUp. + */ + @java.lang.Override + public boolean getCatchUp() { + return catchUp_; + } + /** + * + * + *
+     * Optional. Whether to backfill missed runs when the schedule is resumed from
+     * PAUSED state. If set to true, all missed runs will be scheduled. New runs
+     * will be scheduled after the backfill is complete. This will also update
+     * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field.
+     * Default to false.
+     * 
+ * + * bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The catchUp to set. + * @return This builder for chaining. + */ + public Builder setCatchUp(boolean value) { + + catchUp_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Whether to backfill missed runs when the schedule is resumed from
+     * PAUSED state. If set to true, all missed runs will be scheduled. New runs
+     * will be scheduled after the backfill is complete. This will also update
+     * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field.
+     * Default to false.
+     * 
+ * + * bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearCatchUp() { + bitField0_ = (bitField0_ & ~0x00000002); + catchUp_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.ResumeScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.ResumeScheduleRequest) + private static final com.google.cloud.aiplatform.v1.ResumeScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.ResumeScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.ResumeScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResumeScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.ResumeScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..945da9c63979 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ResumeScheduleRequestOrBuilder.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface ResumeScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.ResumeScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Schedule resource to be resumed.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Schedule resource to be resumed.
+   * Format:
+   * `projects/{project}/locations/{location}/schedules/{schedule}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. Whether to backfill missed runs when the schedule is resumed from
+   * PAUSED state. If set to true, all missed runs will be scheduled. New runs
+   * will be scheduled after the backfill is complete. This will also update
+   * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field.
+   * Default to false.
+   * 
+ * + * bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The catchUp. + */ + boolean getCatchUp(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Schedule.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Schedule.java new file mode 100644 index 000000000000..7a58ee40d5c5 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Schedule.java @@ -0,0 +1,5824 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * An instance of a Schedule periodically schedules runs to make API calls based
+ * on user specified time specification and API request type.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Schedule} + */ +public final class Schedule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.Schedule) + ScheduleOrBuilder { + private static final long serialVersionUID = 0L; + // Use Schedule.newBuilder() to construct. + private Schedule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Schedule() { + name_ = ""; + displayName_ = ""; + state_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Schedule(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Schedule.class, + com.google.cloud.aiplatform.v1.Schedule.Builder.class); + } + + /** + * + * + *
+   * Possible state of the schedule.
+   * 
+ * + * Protobuf enum {@code google.cloud.aiplatform.v1.Schedule.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The Schedule is active. Runs are being scheduled on the user-specified
+     * timespec.
+     * 
+ * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
+     * The schedule is paused. No new runs will be created until the schedule
+     * is resumed. Already started runs will be allowed to complete.
+     * 
+ * + * PAUSED = 2; + */ + PAUSED(2), + /** + * + * + *
+     * The Schedule is completed. No new runs will be scheduled. Already started
+     * runs will be allowed to complete. Schedules in completed state cannot be
+     * paused or resumed.
+     * 
+ * + * COMPLETED = 3; + */ + COMPLETED(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The Schedule is active. Runs are being scheduled on the user-specified
+     * timespec.
+     * 
+ * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + /** + * + * + *
+     * The schedule is paused. No new runs will be created until the schedule
+     * is resumed. Already started runs will be allowed to complete.
+     * 
+ * + * PAUSED = 2; + */ + public static final int PAUSED_VALUE = 2; + /** + * + * + *
+     * The Schedule is completed. No new runs will be scheduled. Already started
+     * runs will be allowed to complete. Schedules in completed state cannot be
+     * paused or resumed.
+     * 
+ * + * COMPLETED = 3; + */ + public static final int COMPLETED_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return PAUSED; + case 3: + return COMPLETED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.Schedule.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.aiplatform.v1.Schedule.State) + } + + public interface RunResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.Schedule.RunResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return Whether the scheduledRunTime field is set. + */ + boolean hasScheduledRunTime(); + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return The scheduledRunTime. + */ + com.google.protobuf.Timestamp getScheduledRunTime(); + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getScheduledRunTimeOrBuilder(); + + /** + * + * + *
+     * The response of the scheduled run.
+     * 
+ * + * string run_response = 2; + * + * @return The runResponse. + */ + java.lang.String getRunResponse(); + /** + * + * + *
+     * The response of the scheduled run.
+     * 
+ * + * string run_response = 2; + * + * @return The bytes for runResponse. + */ + com.google.protobuf.ByteString getRunResponseBytes(); + } + /** + * + * + *
+   * Status of a scheduled run.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Schedule.RunResponse} + */ + public static final class RunResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.Schedule.RunResponse) + RunResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use RunResponse.newBuilder() to construct. + private RunResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RunResponse() { + runResponse_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RunResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Schedule.RunResponse.class, + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder.class); + } + + public static final int SCHEDULED_RUN_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp scheduledRunTime_; + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return Whether the scheduledRunTime field is set. + */ + @java.lang.Override + public boolean hasScheduledRunTime() { + return scheduledRunTime_ != null; + } + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return The scheduledRunTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getScheduledRunTime() { + return scheduledRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : scheduledRunTime_; + } + /** + * + * + *
+     * The scheduled run time based on the user-specified schedule.
+     * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getScheduledRunTimeOrBuilder() { + return scheduledRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : scheduledRunTime_; + } + + public static final int RUN_RESPONSE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object runResponse_ = ""; + /** + * + * + *
+     * The response of the scheduled run.
+     * 
+ * + * string run_response = 2; + * + * @return The runResponse. + */ + @java.lang.Override + public java.lang.String getRunResponse() { + java.lang.Object ref = runResponse_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + runResponse_ = s; + return s; + } + } + /** + * + * + *
+     * The response of the scheduled run.
+     * 
+ * + * string run_response = 2; + * + * @return The bytes for runResponse. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRunResponseBytes() { + java.lang.Object ref = runResponse_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + runResponse_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (scheduledRunTime_ != null) { + output.writeMessage(1, getScheduledRunTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(runResponse_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, runResponse_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (scheduledRunTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getScheduledRunTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(runResponse_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, runResponse_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.Schedule.RunResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.Schedule.RunResponse other = + (com.google.cloud.aiplatform.v1.Schedule.RunResponse) obj; + + if (hasScheduledRunTime() != other.hasScheduledRunTime()) return false; + if (hasScheduledRunTime()) { + if (!getScheduledRunTime().equals(other.getScheduledRunTime())) return false; + } + if (!getRunResponse().equals(other.getRunResponse())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasScheduledRunTime()) { + hash = (37 * hash) + SCHEDULED_RUN_TIME_FIELD_NUMBER; + hash = (53 * hash) + getScheduledRunTime().hashCode(); + } + hash = (37 * hash) + RUN_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getRunResponse().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1.Schedule.RunResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Status of a scheduled run.
+     * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Schedule.RunResponse} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.Schedule.RunResponse) + com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Schedule.RunResponse.class, + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.Schedule.RunResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + scheduledRunTime_ = null; + if (scheduledRunTimeBuilder_ != null) { + scheduledRunTimeBuilder_.dispose(); + scheduledRunTimeBuilder_ = null; + } + runResponse_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponse build() { + com.google.cloud.aiplatform.v1.Schedule.RunResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponse buildPartial() { + com.google.cloud.aiplatform.v1.Schedule.RunResponse result = + new com.google.cloud.aiplatform.v1.Schedule.RunResponse(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.Schedule.RunResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.scheduledRunTime_ = + scheduledRunTimeBuilder_ == null + ? scheduledRunTime_ + : scheduledRunTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.runResponse_ = runResponse_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.Schedule.RunResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.Schedule.RunResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.Schedule.RunResponse other) { + if (other == com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance()) + return this; + if (other.hasScheduledRunTime()) { + mergeScheduledRunTime(other.getScheduledRunTime()); + } + if (!other.getRunResponse().isEmpty()) { + runResponse_ = other.runResponse_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getScheduledRunTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + runResponse_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.Timestamp scheduledRunTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + scheduledRunTimeBuilder_; + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return Whether the scheduledRunTime field is set. + */ + public boolean hasScheduledRunTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + * + * @return The scheduledRunTime. + */ + public com.google.protobuf.Timestamp getScheduledRunTime() { + if (scheduledRunTimeBuilder_ == null) { + return scheduledRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : scheduledRunTime_; + } else { + return scheduledRunTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public Builder setScheduledRunTime(com.google.protobuf.Timestamp value) { + if (scheduledRunTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheduledRunTime_ = value; + } else { + scheduledRunTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public Builder setScheduledRunTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (scheduledRunTimeBuilder_ == null) { + scheduledRunTime_ = builderForValue.build(); + } else { + scheduledRunTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public Builder mergeScheduledRunTime(com.google.protobuf.Timestamp value) { + if (scheduledRunTimeBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && scheduledRunTime_ != null + && scheduledRunTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getScheduledRunTimeBuilder().mergeFrom(value); + } else { + scheduledRunTime_ = value; + } + } else { + scheduledRunTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public Builder clearScheduledRunTime() { + bitField0_ = (bitField0_ & ~0x00000001); + scheduledRunTime_ = null; + if (scheduledRunTimeBuilder_ != null) { + scheduledRunTimeBuilder_.dispose(); + scheduledRunTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getScheduledRunTimeBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getScheduledRunTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getScheduledRunTimeOrBuilder() { + if (scheduledRunTimeBuilder_ != null) { + return scheduledRunTimeBuilder_.getMessageOrBuilder(); + } else { + return scheduledRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : scheduledRunTime_; + } + } + /** + * + * + *
+       * The scheduled run time based on the user-specified schedule.
+       * 
+ * + * .google.protobuf.Timestamp scheduled_run_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getScheduledRunTimeFieldBuilder() { + if (scheduledRunTimeBuilder_ == null) { + scheduledRunTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getScheduledRunTime(), getParentForChildren(), isClean()); + scheduledRunTime_ = null; + } + return scheduledRunTimeBuilder_; + } + + private java.lang.Object runResponse_ = ""; + /** + * + * + *
+       * The response of the scheduled run.
+       * 
+ * + * string run_response = 2; + * + * @return The runResponse. + */ + public java.lang.String getRunResponse() { + java.lang.Object ref = runResponse_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + runResponse_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The response of the scheduled run.
+       * 
+ * + * string run_response = 2; + * + * @return The bytes for runResponse. + */ + public com.google.protobuf.ByteString getRunResponseBytes() { + java.lang.Object ref = runResponse_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + runResponse_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The response of the scheduled run.
+       * 
+ * + * string run_response = 2; + * + * @param value The runResponse to set. + * @return This builder for chaining. + */ + public Builder setRunResponse(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + runResponse_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * The response of the scheduled run.
+       * 
+ * + * string run_response = 2; + * + * @return This builder for chaining. + */ + public Builder clearRunResponse() { + runResponse_ = getDefaultInstance().getRunResponse(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * The response of the scheduled run.
+       * 
+ * + * string run_response = 2; + * + * @param value The bytes for runResponse to set. + * @return This builder for chaining. + */ + public Builder setRunResponseBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + runResponse_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.Schedule.RunResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.Schedule.RunResponse) + private static final com.google.cloud.aiplatform.v1.Schedule.RunResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.Schedule.RunResponse(); + } + + public static com.google.cloud.aiplatform.v1.Schedule.RunResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RunResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int timeSpecificationCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object timeSpecification_; + + public enum TimeSpecificationCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CRON(10), + TIMESPECIFICATION_NOT_SET(0); + private final int value; + + private TimeSpecificationCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TimeSpecificationCase valueOf(int value) { + return forNumber(value); + } + + public static TimeSpecificationCase forNumber(int value) { + switch (value) { + case 10: + return CRON; + case 0: + return TIMESPECIFICATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public TimeSpecificationCase getTimeSpecificationCase() { + return TimeSpecificationCase.forNumber(timeSpecificationCase_); + } + + private int requestCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object request_; + + public enum RequestCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CREATE_PIPELINE_JOB_REQUEST(14), + REQUEST_NOT_SET(0); + private final int value; + + private RequestCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RequestCase valueOf(int value) { + return forNumber(value); + } + + public static RequestCase forNumber(int value) { + switch (value) { + case 14: + return CREATE_PIPELINE_JOB_REQUEST; + case 0: + return REQUEST_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public RequestCase getRequestCase() { + return RequestCase.forNumber(requestCase_); + } + + public static final int CRON_FIELD_NUMBER = 10; + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return Whether the cron field is set. + */ + public boolean hasCron() { + return timeSpecificationCase_ == 10; + } + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return The cron. + */ + public java.lang.String getCron() { + java.lang.Object ref = ""; + if (timeSpecificationCase_ == 10) { + ref = timeSpecification_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (timeSpecificationCase_ == 10) { + timeSpecification_ = s; + } + return s; + } + } + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return The bytes for cron. + */ + public com.google.protobuf.ByteString getCronBytes() { + java.lang.Object ref = ""; + if (timeSpecificationCase_ == 10) { + ref = timeSpecification_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (timeSpecificationCase_ == 10) { + timeSpecification_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_PIPELINE_JOB_REQUEST_FIELD_NUMBER = 14; + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return Whether the createPipelineJobRequest field is set. + */ + @java.lang.Override + public boolean hasCreatePipelineJobRequest() { + return requestCase_ == 14; + } + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return The createPipelineJobRequest. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreatePipelineJobRequest getCreatePipelineJobRequest() { + if (requestCase_ == 14) { + return (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_; + } + return com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder + getCreatePipelineJobRequestOrBuilder() { + if (requestCase_ == 14) { + return (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_; + } + return com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Output only. The resource name of the Schedule.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the Schedule.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object displayName_ = ""; + /** + * + * + *
+   * Required. User provided name of the Schedule.
+   * The name can be up to 128 characters long and can consist of any UTF-8
+   * characters.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. User provided name of the Schedule.
+   * The name can be up to 128 characters long and can consist of any UTF-8
+   * characters.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int START_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + + public static final int END_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return Whether the endTime field is set. + */ + @java.lang.Override + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The endTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + + public static final int MAX_RUN_COUNT_FIELD_NUMBER = 16; + private long maxRunCount_ = 0L; + /** + * + * + *
+   * Optional. Maximum run count of the schedule.
+   * If specified, The schedule will be completed when either
+   * started_run_count >= max_run_count or when end_time is reached.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxRunCount. + */ + @java.lang.Override + public long getMaxRunCount() { + return maxRunCount_; + } + + public static final int STARTED_RUN_COUNT_FIELD_NUMBER = 17; + private long startedRunCount_ = 0L; + /** + * + * + *
+   * Output only. The number of runs started by this schedule.
+   * 
+ * + * int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startedRunCount. + */ + @java.lang.Override + public long getStartedRunCount() { + return startedRunCount_; + } + + public static final int STATE_FIELD_NUMBER = 5; + private int state_ = 0; + /** + * + * + *
+   * Output only. The state of this Schedule.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The state of this Schedule.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.State getState() { + com.google.cloud.aiplatform.v1.Schedule.State result = + com.google.cloud.aiplatform.v1.Schedule.State.forNumber(state_); + return result == null ? com.google.cloud.aiplatform.v1.Schedule.State.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 19; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + + public static final int NEXT_RUN_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp nextRunTime_; + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the nextRunTime field is set. + */ + @java.lang.Override + public boolean hasNextRunTime() { + return nextRunTime_ != null; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The nextRunTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getNextRunTime() { + return nextRunTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : nextRunTime_; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getNextRunTimeOrBuilder() { + return nextRunTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : nextRunTime_; + } + + public static final int LAST_PAUSE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp lastPauseTime_; + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastPauseTime field is set. + */ + @java.lang.Override + public boolean hasLastPauseTime() { + return lastPauseTime_ != null; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastPauseTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getLastPauseTime() { + return lastPauseTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastPauseTime_; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getLastPauseTimeOrBuilder() { + return lastPauseTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastPauseTime_; + } + + public static final int LAST_RESUME_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp lastResumeTime_; + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastResumeTime field is set. + */ + @java.lang.Override + public boolean hasLastResumeTime() { + return lastResumeTime_ != null; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastResumeTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getLastResumeTime() { + return lastResumeTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastResumeTime_; + } + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getLastResumeTimeOrBuilder() { + return lastResumeTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastResumeTime_; + } + + public static final int MAX_CONCURRENT_RUN_COUNT_FIELD_NUMBER = 11; + private long maxConcurrentRunCount_ = 0L; + /** + * + * + *
+   * Required. Maximum number of runs that can be started concurrently for this
+   * Schedule. This is the limit for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * 
+ * + * int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxConcurrentRunCount. + */ + @java.lang.Override + public long getMaxConcurrentRunCount() { + return maxConcurrentRunCount_; + } + + public static final int ALLOW_QUEUEING_FIELD_NUMBER = 12; + private boolean allowQueueing_ = false; + /** + * + * + *
+   * Optional. Whether new scheduled runs can be queued when max_concurrent_runs
+   * limit is reached. If set to true, new runs will be queued instead of
+   * skipped. Default to false.
+   * 
+ * + * bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The allowQueueing. + */ + @java.lang.Override + public boolean getAllowQueueing() { + return allowQueueing_; + } + + public static final int CATCH_UP_FIELD_NUMBER = 13; + private boolean catchUp_ = false; + /** + * + * + *
+   * Output only. Whether to backfill missed runs when the schedule is resumed
+   * from PAUSED state. If set to true, all missed runs will be scheduled. New
+   * runs will be scheduled after the backfill is complete. Default to false.
+   * 
+ * + * bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The catchUp. + */ + @java.lang.Override + public boolean getCatchUp() { + return catchUp_; + } + + public static final int LAST_SCHEDULED_RUN_RESPONSE_FIELD_NUMBER = 18; + private com.google.cloud.aiplatform.v1.Schedule.RunResponse lastScheduledRunResponse_; + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastScheduledRunResponse field is set. + */ + @java.lang.Override + public boolean hasLastScheduledRunResponse() { + return lastScheduledRunResponse_ != null; + } + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastScheduledRunResponse. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponse getLastScheduledRunResponse() { + return lastScheduledRunResponse_ == null + ? com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance() + : lastScheduledRunResponse_; + } + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder + getLastScheduledRunResponseOrBuilder() { + return lastScheduledRunResponse_ == null + ? com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance() + : lastScheduledRunResponse_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (startTime_ != null) { + output.writeMessage(3, getStartTime()); + } + if (endTime_ != null) { + output.writeMessage(4, getEndTime()); + } + if (state_ != com.google.cloud.aiplatform.v1.Schedule.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(5, state_); + } + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (nextRunTime_ != null) { + output.writeMessage(7, getNextRunTime()); + } + if (lastPauseTime_ != null) { + output.writeMessage(8, getLastPauseTime()); + } + if (lastResumeTime_ != null) { + output.writeMessage(9, getLastResumeTime()); + } + if (timeSpecificationCase_ == 10) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, timeSpecification_); + } + if (maxConcurrentRunCount_ != 0L) { + output.writeInt64(11, maxConcurrentRunCount_); + } + if (allowQueueing_ != false) { + output.writeBool(12, allowQueueing_); + } + if (catchUp_ != false) { + output.writeBool(13, catchUp_); + } + if (requestCase_ == 14) { + output.writeMessage(14, (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_); + } + if (maxRunCount_ != 0L) { + output.writeInt64(16, maxRunCount_); + } + if (startedRunCount_ != 0L) { + output.writeInt64(17, startedRunCount_); + } + if (lastScheduledRunResponse_ != null) { + output.writeMessage(18, getLastScheduledRunResponse()); + } + if (updateTime_ != null) { + output.writeMessage(19, getUpdateTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getStartTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getEndTime()); + } + if (state_ != com.google.cloud.aiplatform.v1.Schedule.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, state_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (nextRunTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getNextRunTime()); + } + if (lastPauseTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getLastPauseTime()); + } + if (lastResumeTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getLastResumeTime()); + } + if (timeSpecificationCase_ == 10) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, timeSpecification_); + } + if (maxConcurrentRunCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(11, maxConcurrentRunCount_); + } + if (allowQueueing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(12, allowQueueing_); + } + if (catchUp_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(13, catchUp_); + } + if (requestCase_ == 14) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 14, (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_); + } + if (maxRunCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(16, maxRunCount_); + } + if (startedRunCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(17, startedRunCount_); + } + if (lastScheduledRunResponse_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 18, getLastScheduledRunResponse()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(19, getUpdateTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.Schedule)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.Schedule other = (com.google.cloud.aiplatform.v1.Schedule) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (getMaxRunCount() != other.getMaxRunCount()) return false; + if (getStartedRunCount() != other.getStartedRunCount()) return false; + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasNextRunTime() != other.hasNextRunTime()) return false; + if (hasNextRunTime()) { + if (!getNextRunTime().equals(other.getNextRunTime())) return false; + } + if (hasLastPauseTime() != other.hasLastPauseTime()) return false; + if (hasLastPauseTime()) { + if (!getLastPauseTime().equals(other.getLastPauseTime())) return false; + } + if (hasLastResumeTime() != other.hasLastResumeTime()) return false; + if (hasLastResumeTime()) { + if (!getLastResumeTime().equals(other.getLastResumeTime())) return false; + } + if (getMaxConcurrentRunCount() != other.getMaxConcurrentRunCount()) return false; + if (getAllowQueueing() != other.getAllowQueueing()) return false; + if (getCatchUp() != other.getCatchUp()) return false; + if (hasLastScheduledRunResponse() != other.hasLastScheduledRunResponse()) return false; + if (hasLastScheduledRunResponse()) { + if (!getLastScheduledRunResponse().equals(other.getLastScheduledRunResponse())) return false; + } + if (!getTimeSpecificationCase().equals(other.getTimeSpecificationCase())) return false; + switch (timeSpecificationCase_) { + case 10: + if (!getCron().equals(other.getCron())) return false; + break; + case 0: + default: + } + if (!getRequestCase().equals(other.getRequestCase())) return false; + switch (requestCase_) { + case 14: + if (!getCreatePipelineJobRequest().equals(other.getCreatePipelineJobRequest())) + return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (37 * hash) + MAX_RUN_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxRunCount()); + hash = (37 * hash) + STARTED_RUN_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getStartedRunCount()); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasNextRunTime()) { + hash = (37 * hash) + NEXT_RUN_TIME_FIELD_NUMBER; + hash = (53 * hash) + getNextRunTime().hashCode(); + } + if (hasLastPauseTime()) { + hash = (37 * hash) + LAST_PAUSE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getLastPauseTime().hashCode(); + } + if (hasLastResumeTime()) { + hash = (37 * hash) + LAST_RESUME_TIME_FIELD_NUMBER; + hash = (53 * hash) + getLastResumeTime().hashCode(); + } + hash = (37 * hash) + MAX_CONCURRENT_RUN_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxConcurrentRunCount()); + hash = (37 * hash) + ALLOW_QUEUEING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowQueueing()); + hash = (37 * hash) + CATCH_UP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getCatchUp()); + if (hasLastScheduledRunResponse()) { + hash = (37 * hash) + LAST_SCHEDULED_RUN_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getLastScheduledRunResponse().hashCode(); + } + switch (timeSpecificationCase_) { + case 10: + hash = (37 * hash) + CRON_FIELD_NUMBER; + hash = (53 * hash) + getCron().hashCode(); + break; + case 0: + default: + } + switch (requestCase_) { + case 14: + hash = (37 * hash) + CREATE_PIPELINE_JOB_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getCreatePipelineJobRequest().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Schedule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.Schedule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * An instance of a Schedule periodically schedules runs to make API calls based
+   * on user specified time specification and API request type.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Schedule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.Schedule) + com.google.cloud.aiplatform.v1.ScheduleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Schedule.class, + com.google.cloud.aiplatform.v1.Schedule.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.Schedule.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (createPipelineJobRequestBuilder_ != null) { + createPipelineJobRequestBuilder_.clear(); + } + name_ = ""; + displayName_ = ""; + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + maxRunCount_ = 0L; + startedRunCount_ = 0L; + state_ = 0; + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + nextRunTime_ = null; + if (nextRunTimeBuilder_ != null) { + nextRunTimeBuilder_.dispose(); + nextRunTimeBuilder_ = null; + } + lastPauseTime_ = null; + if (lastPauseTimeBuilder_ != null) { + lastPauseTimeBuilder_.dispose(); + lastPauseTimeBuilder_ = null; + } + lastResumeTime_ = null; + if (lastResumeTimeBuilder_ != null) { + lastResumeTimeBuilder_.dispose(); + lastResumeTimeBuilder_ = null; + } + maxConcurrentRunCount_ = 0L; + allowQueueing_ = false; + catchUp_ = false; + lastScheduledRunResponse_ = null; + if (lastScheduledRunResponseBuilder_ != null) { + lastScheduledRunResponseBuilder_.dispose(); + lastScheduledRunResponseBuilder_ = null; + } + timeSpecificationCase_ = 0; + timeSpecification_ = null; + requestCase_ = 0; + request_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleProto + .internal_static_google_cloud_aiplatform_v1_Schedule_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule build() { + com.google.cloud.aiplatform.v1.Schedule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule buildPartial() { + com.google.cloud.aiplatform.v1.Schedule result = + new com.google.cloud.aiplatform.v1.Schedule(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.Schedule result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.displayName_ = displayName_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.startTime_ = startTimeBuilder_ == null ? startTime_ : startTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.endTime_ = endTimeBuilder_ == null ? endTime_ : endTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.maxRunCount_ = maxRunCount_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.startedRunCount_ = startedRunCount_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.createTime_ = createTimeBuilder_ == null ? createTime_ : createTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.updateTime_ = updateTimeBuilder_ == null ? updateTime_ : updateTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.nextRunTime_ = + nextRunTimeBuilder_ == null ? nextRunTime_ : nextRunTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.lastPauseTime_ = + lastPauseTimeBuilder_ == null ? lastPauseTime_ : lastPauseTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.lastResumeTime_ = + lastResumeTimeBuilder_ == null ? lastResumeTime_ : lastResumeTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.maxConcurrentRunCount_ = maxConcurrentRunCount_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.allowQueueing_ = allowQueueing_; + } + if (((from_bitField0_ & 0x00010000) != 0)) { + result.catchUp_ = catchUp_; + } + if (((from_bitField0_ & 0x00020000) != 0)) { + result.lastScheduledRunResponse_ = + lastScheduledRunResponseBuilder_ == null + ? lastScheduledRunResponse_ + : lastScheduledRunResponseBuilder_.build(); + } + } + + private void buildPartialOneofs(com.google.cloud.aiplatform.v1.Schedule result) { + result.timeSpecificationCase_ = timeSpecificationCase_; + result.timeSpecification_ = this.timeSpecification_; + result.requestCase_ = requestCase_; + result.request_ = this.request_; + if (requestCase_ == 14 && createPipelineJobRequestBuilder_ != null) { + result.request_ = createPipelineJobRequestBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.Schedule) { + return mergeFrom((com.google.cloud.aiplatform.v1.Schedule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.Schedule other) { + if (other == com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + if (other.getMaxRunCount() != 0L) { + setMaxRunCount(other.getMaxRunCount()); + } + if (other.getStartedRunCount() != 0L) { + setStartedRunCount(other.getStartedRunCount()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasNextRunTime()) { + mergeNextRunTime(other.getNextRunTime()); + } + if (other.hasLastPauseTime()) { + mergeLastPauseTime(other.getLastPauseTime()); + } + if (other.hasLastResumeTime()) { + mergeLastResumeTime(other.getLastResumeTime()); + } + if (other.getMaxConcurrentRunCount() != 0L) { + setMaxConcurrentRunCount(other.getMaxConcurrentRunCount()); + } + if (other.getAllowQueueing() != false) { + setAllowQueueing(other.getAllowQueueing()); + } + if (other.getCatchUp() != false) { + setCatchUp(other.getCatchUp()); + } + if (other.hasLastScheduledRunResponse()) { + mergeLastScheduledRunResponse(other.getLastScheduledRunResponse()); + } + switch (other.getTimeSpecificationCase()) { + case CRON: + { + timeSpecificationCase_ = 10; + timeSpecification_ = other.timeSpecification_; + onChanged(); + break; + } + case TIMESPECIFICATION_NOT_SET: + { + break; + } + } + switch (other.getRequestCase()) { + case CREATE_PIPELINE_JOB_REQUEST: + { + mergeCreatePipelineJobRequest(other.getCreatePipelineJobRequest()); + break; + } + case REQUEST_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 10 + case 18: + { + displayName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 18 + case 26: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 26 + case 34: + { + input.readMessage(getEndTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 34 + case 40: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000100; + break; + } // case 40 + case 50: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000200; + break; + } // case 50 + case 58: + { + input.readMessage(getNextRunTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000800; + break; + } // case 58 + case 66: + { + input.readMessage(getLastPauseTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00001000; + break; + } // case 66 + case 74: + { + input.readMessage(getLastResumeTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00002000; + break; + } // case 74 + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + timeSpecificationCase_ = 10; + timeSpecification_ = s; + break; + } // case 82 + case 88: + { + maxConcurrentRunCount_ = input.readInt64(); + bitField0_ |= 0x00004000; + break; + } // case 88 + case 96: + { + allowQueueing_ = input.readBool(); + bitField0_ |= 0x00008000; + break; + } // case 96 + case 104: + { + catchUp_ = input.readBool(); + bitField0_ |= 0x00010000; + break; + } // case 104 + case 114: + { + input.readMessage( + getCreatePipelineJobRequestFieldBuilder().getBuilder(), extensionRegistry); + requestCase_ = 14; + break; + } // case 114 + case 128: + { + maxRunCount_ = input.readInt64(); + bitField0_ |= 0x00000040; + break; + } // case 128 + case 136: + { + startedRunCount_ = input.readInt64(); + bitField0_ |= 0x00000080; + break; + } // case 136 + case 146: + { + input.readMessage( + getLastScheduledRunResponseFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00020000; + break; + } // case 146 + case 154: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000400; + break; + } // case 154 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int timeSpecificationCase_ = 0; + private java.lang.Object timeSpecification_; + + public TimeSpecificationCase getTimeSpecificationCase() { + return TimeSpecificationCase.forNumber(timeSpecificationCase_); + } + + public Builder clearTimeSpecification() { + timeSpecificationCase_ = 0; + timeSpecification_ = null; + onChanged(); + return this; + } + + private int requestCase_ = 0; + private java.lang.Object request_; + + public RequestCase getRequestCase() { + return RequestCase.forNumber(requestCase_); + } + + public Builder clearRequest() { + requestCase_ = 0; + request_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @return Whether the cron field is set. + */ + @java.lang.Override + public boolean hasCron() { + return timeSpecificationCase_ == 10; + } + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @return The cron. + */ + @java.lang.Override + public java.lang.String getCron() { + java.lang.Object ref = ""; + if (timeSpecificationCase_ == 10) { + ref = timeSpecification_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (timeSpecificationCase_ == 10) { + timeSpecification_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @return The bytes for cron. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCronBytes() { + java.lang.Object ref = ""; + if (timeSpecificationCase_ == 10) { + ref = timeSpecification_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (timeSpecificationCase_ == 10) { + timeSpecification_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @param value The cron to set. + * @return This builder for chaining. + */ + public Builder setCron(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + timeSpecificationCase_ = 10; + timeSpecification_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @return This builder for chaining. + */ + public Builder clearCron() { + if (timeSpecificationCase_ == 10) { + timeSpecificationCase_ = 0; + timeSpecification_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+     * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+     * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+     * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+     * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+     * "TZ=America/New_York 1 * * * *".
+     * 
+ * + * string cron = 10; + * + * @param value The bytes for cron to set. + * @return This builder for chaining. + */ + public Builder setCronBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + timeSpecificationCase_ = 10; + timeSpecification_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.Builder, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder> + createPipelineJobRequestBuilder_; + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return Whether the createPipelineJobRequest field is set. + */ + @java.lang.Override + public boolean hasCreatePipelineJobRequest() { + return requestCase_ == 14; + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return The createPipelineJobRequest. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreatePipelineJobRequest getCreatePipelineJobRequest() { + if (createPipelineJobRequestBuilder_ == null) { + if (requestCase_ == 14) { + return (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_; + } + return com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } else { + if (requestCase_ == 14) { + return createPipelineJobRequestBuilder_.getMessage(); + } + return com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + public Builder setCreatePipelineJobRequest( + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest value) { + if (createPipelineJobRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + createPipelineJobRequestBuilder_.setMessage(value); + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + public Builder setCreatePipelineJobRequest( + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.Builder builderForValue) { + if (createPipelineJobRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + createPipelineJobRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + public Builder mergeCreatePipelineJobRequest( + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest value) { + if (createPipelineJobRequestBuilder_ == null) { + if (requestCase_ == 14 + && request_ + != com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance()) { + request_ = + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.newBuilder( + (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 14) { + createPipelineJobRequestBuilder_.mergeFrom(value); + } else { + createPipelineJobRequestBuilder_.setMessage(value); + } + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + public Builder clearCreatePipelineJobRequest() { + if (createPipelineJobRequestBuilder_ == null) { + if (requestCase_ == 14) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 14) { + requestCase_ = 0; + request_ = null; + } + createPipelineJobRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + public com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.Builder + getCreatePipelineJobRequestBuilder() { + return getCreatePipelineJobRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder + getCreatePipelineJobRequestOrBuilder() { + if ((requestCase_ == 14) && (createPipelineJobRequestBuilder_ != null)) { + return createPipelineJobRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 14) { + return (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_; + } + return com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * Request for
+     * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+     * CreatePipelineJobRequest.parent field is required (format:
+     * projects/{project}/locations/{location}).
+     * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.Builder, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder> + getCreatePipelineJobRequestFieldBuilder() { + if (createPipelineJobRequestBuilder_ == null) { + if (!(requestCase_ == 14)) { + request_ = com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.getDefaultInstance(); + } + createPipelineJobRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest.Builder, + com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder>( + (com.google.cloud.aiplatform.v1.CreatePipelineJobRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 14; + onChanged(); + return createPipelineJobRequestBuilder_; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the Schedule.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the Schedule.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the Schedule.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the Schedule.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the Schedule.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Required. User provided name of the Schedule.
+     * The name can be up to 128 characters long and can consist of any UTF-8
+     * characters.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. User provided name of the Schedule.
+     * The name can be up to 128 characters long and can consist of any UTF-8
+     * characters.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. User provided name of the Schedule.
+     * The name can be up to 128 characters long and can consist of any UTF-8
+     * characters.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + displayName_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. User provided name of the Schedule.
+     * The name can be up to 128 characters long and can consist of any UTF-8
+     * characters.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + displayName_ = getDefaultInstance().getDisplayName(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. User provided name of the Schedule.
+     * The name can be up to 128 characters long and can consist of any UTF-8
+     * characters.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + displayName_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + } else { + startTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && startTime_ != null + && startTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getStartTimeBuilder().mergeFrom(value); + } else { + startTime_ = value; + } + } else { + startTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearStartTime() { + bitField0_ = (bitField0_ & ~0x00000010); + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Optional. Timestamp after which the first run can be scheduled.
+     * Default to Schedule create time if not specified.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + } else { + endTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && endTime_ != null + && endTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getEndTimeBuilder().mergeFrom(value); + } else { + endTime_ = value; + } + } else { + endTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearEndTime() { + bitField0_ = (bitField0_ & ~0x00000020); + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * Optional. Timestamp after which no new runs can be scheduled.
+     * If specified, The schedule will be completed when either
+     * end_time is reached or when scheduled_run_count >= max_run_count.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + private long maxRunCount_; + /** + * + * + *
+     * Optional. Maximum run count of the schedule.
+     * If specified, The schedule will be completed when either
+     * started_run_count >= max_run_count or when end_time is reached.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxRunCount. + */ + @java.lang.Override + public long getMaxRunCount() { + return maxRunCount_; + } + /** + * + * + *
+     * Optional. Maximum run count of the schedule.
+     * If specified, The schedule will be completed when either
+     * started_run_count >= max_run_count or when end_time is reached.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The maxRunCount to set. + * @return This builder for chaining. + */ + public Builder setMaxRunCount(long value) { + + maxRunCount_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Maximum run count of the schedule.
+     * If specified, The schedule will be completed when either
+     * started_run_count >= max_run_count or when end_time is reached.
+     * If not specified, new runs will keep getting scheduled until this Schedule
+     * is paused or deleted. Already scheduled runs will be allowed to complete.
+     * Unset if not specified.
+     * 
+ * + * int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMaxRunCount() { + bitField0_ = (bitField0_ & ~0x00000040); + maxRunCount_ = 0L; + onChanged(); + return this; + } + + private long startedRunCount_; + /** + * + * + *
+     * Output only. The number of runs started by this schedule.
+     * 
+ * + * int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startedRunCount. + */ + @java.lang.Override + public long getStartedRunCount() { + return startedRunCount_; + } + /** + * + * + *
+     * Output only. The number of runs started by this schedule.
+     * 
+ * + * int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The startedRunCount to set. + * @return This builder for chaining. + */ + public Builder setStartedRunCount(long value) { + + startedRunCount_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of runs started by this schedule.
+     * 
+ * + * int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearStartedRunCount() { + bitField0_ = (bitField0_ & ~0x00000080); + startedRunCount_ = 0L; + onChanged(); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The state of this Schedule.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The state of this Schedule.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The state of this Schedule.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule.State getState() { + com.google.cloud.aiplatform.v1.Schedule.State result = + com.google.cloud.aiplatform.v1.Schedule.State.forNumber(state_); + return result == null ? com.google.cloud.aiplatform.v1.Schedule.State.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Output only. The state of this Schedule.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.aiplatform.v1.Schedule.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000100; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The state of this Schedule.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000100); + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000200) != 0); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + } else { + createTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (((bitField0_ & 0x00000200) != 0) + && createTime_ != null + && createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCreateTimeBuilder().mergeFrom(value); + } else { + createTime_ = value; + } + } else { + createTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + bitField0_ = (bitField0_ & ~0x00000200); + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + bitField0_ |= 0x00000200; + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return ((bitField0_ & 0x00000400) != 0); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + } else { + updateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000400) != 0) + && updateTime_ != null + && updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getUpdateTimeBuilder().mergeFrom(value); + } else { + updateTime_ = value; + } + } else { + updateTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + bitField0_ = (bitField0_ & ~0x00000400); + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + bitField0_ |= 0x00000400; + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp nextRunTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + nextRunTimeBuilder_; + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the nextRunTime field is set. + */ + public boolean hasNextRunTime() { + return ((bitField0_ & 0x00000800) != 0); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The nextRunTime. + */ + public com.google.protobuf.Timestamp getNextRunTime() { + if (nextRunTimeBuilder_ == null) { + return nextRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : nextRunTime_; + } else { + return nextRunTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setNextRunTime(com.google.protobuf.Timestamp value) { + if (nextRunTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nextRunTime_ = value; + } else { + nextRunTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setNextRunTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (nextRunTimeBuilder_ == null) { + nextRunTime_ = builderForValue.build(); + } else { + nextRunTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeNextRunTime(com.google.protobuf.Timestamp value) { + if (nextRunTimeBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0) + && nextRunTime_ != null + && nextRunTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getNextRunTimeBuilder().mergeFrom(value); + } else { + nextRunTime_ = value; + } + } else { + nextRunTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearNextRunTime() { + bitField0_ = (bitField0_ & ~0x00000800); + nextRunTime_ = null; + if (nextRunTimeBuilder_ != null) { + nextRunTimeBuilder_.dispose(); + nextRunTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getNextRunTimeBuilder() { + bitField0_ |= 0x00000800; + onChanged(); + return getNextRunTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getNextRunTimeOrBuilder() { + if (nextRunTimeBuilder_ != null) { + return nextRunTimeBuilder_.getMessageOrBuilder(); + } else { + return nextRunTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : nextRunTime_; + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule should schedule the next run.
+     * Having a next_run_time in the past means the runs are being started
+     * behind schedule.
+     * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getNextRunTimeFieldBuilder() { + if (nextRunTimeBuilder_ == null) { + nextRunTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getNextRunTime(), getParentForChildren(), isClean()); + nextRunTime_ = null; + } + return nextRunTimeBuilder_; + } + + private com.google.protobuf.Timestamp lastPauseTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + lastPauseTimeBuilder_; + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastPauseTime field is set. + */ + public boolean hasLastPauseTime() { + return ((bitField0_ & 0x00001000) != 0); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastPauseTime. + */ + public com.google.protobuf.Timestamp getLastPauseTime() { + if (lastPauseTimeBuilder_ == null) { + return lastPauseTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastPauseTime_; + } else { + return lastPauseTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastPauseTime(com.google.protobuf.Timestamp value) { + if (lastPauseTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastPauseTime_ = value; + } else { + lastPauseTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastPauseTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (lastPauseTimeBuilder_ == null) { + lastPauseTime_ = builderForValue.build(); + } else { + lastPauseTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLastPauseTime(com.google.protobuf.Timestamp value) { + if (lastPauseTimeBuilder_ == null) { + if (((bitField0_ & 0x00001000) != 0) + && lastPauseTime_ != null + && lastPauseTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getLastPauseTimeBuilder().mergeFrom(value); + } else { + lastPauseTime_ = value; + } + } else { + lastPauseTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLastPauseTime() { + bitField0_ = (bitField0_ & ~0x00001000); + lastPauseTime_ = null; + if (lastPauseTimeBuilder_ != null) { + lastPauseTimeBuilder_.dispose(); + lastPauseTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getLastPauseTimeBuilder() { + bitField0_ |= 0x00001000; + onChanged(); + return getLastPauseTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getLastPauseTimeOrBuilder() { + if (lastPauseTimeBuilder_ != null) { + return lastPauseTimeBuilder_.getMessageOrBuilder(); + } else { + return lastPauseTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastPauseTime_; + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last paused.
+     * Unset if never paused.
+     * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getLastPauseTimeFieldBuilder() { + if (lastPauseTimeBuilder_ == null) { + lastPauseTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getLastPauseTime(), getParentForChildren(), isClean()); + lastPauseTime_ = null; + } + return lastPauseTimeBuilder_; + } + + private com.google.protobuf.Timestamp lastResumeTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + lastResumeTimeBuilder_; + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastResumeTime field is set. + */ + public boolean hasLastResumeTime() { + return ((bitField0_ & 0x00002000) != 0); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastResumeTime. + */ + public com.google.protobuf.Timestamp getLastResumeTime() { + if (lastResumeTimeBuilder_ == null) { + return lastResumeTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastResumeTime_; + } else { + return lastResumeTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastResumeTime(com.google.protobuf.Timestamp value) { + if (lastResumeTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastResumeTime_ = value; + } else { + lastResumeTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastResumeTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (lastResumeTimeBuilder_ == null) { + lastResumeTime_ = builderForValue.build(); + } else { + lastResumeTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLastResumeTime(com.google.protobuf.Timestamp value) { + if (lastResumeTimeBuilder_ == null) { + if (((bitField0_ & 0x00002000) != 0) + && lastResumeTime_ != null + && lastResumeTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getLastResumeTimeBuilder().mergeFrom(value); + } else { + lastResumeTime_ = value; + } + } else { + lastResumeTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLastResumeTime() { + bitField0_ = (bitField0_ & ~0x00002000); + lastResumeTime_ = null; + if (lastResumeTimeBuilder_ != null) { + lastResumeTimeBuilder_.dispose(); + lastResumeTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getLastResumeTimeBuilder() { + bitField0_ |= 0x00002000; + onChanged(); + return getLastResumeTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getLastResumeTimeOrBuilder() { + if (lastResumeTimeBuilder_ != null) { + return lastResumeTimeBuilder_.getMessageOrBuilder(); + } else { + return lastResumeTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastResumeTime_; + } + } + /** + * + * + *
+     * Output only. Timestamp when this Schedule was last resumed.
+     * Unset if never resumed from pause.
+     * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getLastResumeTimeFieldBuilder() { + if (lastResumeTimeBuilder_ == null) { + lastResumeTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getLastResumeTime(), getParentForChildren(), isClean()); + lastResumeTime_ = null; + } + return lastResumeTimeBuilder_; + } + + private long maxConcurrentRunCount_; + /** + * + * + *
+     * Required. Maximum number of runs that can be started concurrently for this
+     * Schedule. This is the limit for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * 
+ * + * int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxConcurrentRunCount. + */ + @java.lang.Override + public long getMaxConcurrentRunCount() { + return maxConcurrentRunCount_; + } + /** + * + * + *
+     * Required. Maximum number of runs that can be started concurrently for this
+     * Schedule. This is the limit for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * 
+ * + * int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The maxConcurrentRunCount to set. + * @return This builder for chaining. + */ + public Builder setMaxConcurrentRunCount(long value) { + + maxConcurrentRunCount_ = value; + bitField0_ |= 0x00004000; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Maximum number of runs that can be started concurrently for this
+     * Schedule. This is the limit for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * 
+ * + * int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearMaxConcurrentRunCount() { + bitField0_ = (bitField0_ & ~0x00004000); + maxConcurrentRunCount_ = 0L; + onChanged(); + return this; + } + + private boolean allowQueueing_; + /** + * + * + *
+     * Optional. Whether new scheduled runs can be queued when max_concurrent_runs
+     * limit is reached. If set to true, new runs will be queued instead of
+     * skipped. Default to false.
+     * 
+ * + * bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The allowQueueing. + */ + @java.lang.Override + public boolean getAllowQueueing() { + return allowQueueing_; + } + /** + * + * + *
+     * Optional. Whether new scheduled runs can be queued when max_concurrent_runs
+     * limit is reached. If set to true, new runs will be queued instead of
+     * skipped. Default to false.
+     * 
+ * + * bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The allowQueueing to set. + * @return This builder for chaining. + */ + public Builder setAllowQueueing(boolean value) { + + allowQueueing_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Whether new scheduled runs can be queued when max_concurrent_runs
+     * limit is reached. If set to true, new runs will be queued instead of
+     * skipped. Default to false.
+     * 
+ * + * bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAllowQueueing() { + bitField0_ = (bitField0_ & ~0x00008000); + allowQueueing_ = false; + onChanged(); + return this; + } + + private boolean catchUp_; + /** + * + * + *
+     * Output only. Whether to backfill missed runs when the schedule is resumed
+     * from PAUSED state. If set to true, all missed runs will be scheduled. New
+     * runs will be scheduled after the backfill is complete. Default to false.
+     * 
+ * + * bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The catchUp. + */ + @java.lang.Override + public boolean getCatchUp() { + return catchUp_; + } + /** + * + * + *
+     * Output only. Whether to backfill missed runs when the schedule is resumed
+     * from PAUSED state. If set to true, all missed runs will be scheduled. New
+     * runs will be scheduled after the backfill is complete. Default to false.
+     * 
+ * + * bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The catchUp to set. + * @return This builder for chaining. + */ + public Builder setCatchUp(boolean value) { + + catchUp_ = value; + bitField0_ |= 0x00010000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Whether to backfill missed runs when the schedule is resumed
+     * from PAUSED state. If set to true, all missed runs will be scheduled. New
+     * runs will be scheduled after the backfill is complete. Default to false.
+     * 
+ * + * bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearCatchUp() { + bitField0_ = (bitField0_ & ~0x00010000); + catchUp_ = false; + onChanged(); + return this; + } + + private com.google.cloud.aiplatform.v1.Schedule.RunResponse lastScheduledRunResponse_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule.RunResponse, + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder, + com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder> + lastScheduledRunResponseBuilder_; + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastScheduledRunResponse field is set. + */ + public boolean hasLastScheduledRunResponse() { + return ((bitField0_ & 0x00020000) != 0); + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastScheduledRunResponse. + */ + public com.google.cloud.aiplatform.v1.Schedule.RunResponse getLastScheduledRunResponse() { + if (lastScheduledRunResponseBuilder_ == null) { + return lastScheduledRunResponse_ == null + ? com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance() + : lastScheduledRunResponse_; + } else { + return lastScheduledRunResponseBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastScheduledRunResponse( + com.google.cloud.aiplatform.v1.Schedule.RunResponse value) { + if (lastScheduledRunResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastScheduledRunResponse_ = value; + } else { + lastScheduledRunResponseBuilder_.setMessage(value); + } + bitField0_ |= 0x00020000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastScheduledRunResponse( + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder builderForValue) { + if (lastScheduledRunResponseBuilder_ == null) { + lastScheduledRunResponse_ = builderForValue.build(); + } else { + lastScheduledRunResponseBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00020000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLastScheduledRunResponse( + com.google.cloud.aiplatform.v1.Schedule.RunResponse value) { + if (lastScheduledRunResponseBuilder_ == null) { + if (((bitField0_ & 0x00020000) != 0) + && lastScheduledRunResponse_ != null + && lastScheduledRunResponse_ + != com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance()) { + getLastScheduledRunResponseBuilder().mergeFrom(value); + } else { + lastScheduledRunResponse_ = value; + } + } else { + lastScheduledRunResponseBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00020000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLastScheduledRunResponse() { + bitField0_ = (bitField0_ & ~0x00020000); + lastScheduledRunResponse_ = null; + if (lastScheduledRunResponseBuilder_ != null) { + lastScheduledRunResponseBuilder_.dispose(); + lastScheduledRunResponseBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder + getLastScheduledRunResponseBuilder() { + bitField0_ |= 0x00020000; + onChanged(); + return getLastScheduledRunResponseFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder + getLastScheduledRunResponseOrBuilder() { + if (lastScheduledRunResponseBuilder_ != null) { + return lastScheduledRunResponseBuilder_.getMessageOrBuilder(); + } else { + return lastScheduledRunResponse_ == null + ? com.google.cloud.aiplatform.v1.Schedule.RunResponse.getDefaultInstance() + : lastScheduledRunResponse_; + } + } + /** + * + * + *
+     * Output only. Response of the last scheduled run.
+     * This is the response for starting the scheduled requests and not the
+     * execution of the operations/jobs created by the requests (if applicable).
+     * Unset if no run has been scheduled yet.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule.RunResponse, + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder, + com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder> + getLastScheduledRunResponseFieldBuilder() { + if (lastScheduledRunResponseBuilder_ == null) { + lastScheduledRunResponseBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule.RunResponse, + com.google.cloud.aiplatform.v1.Schedule.RunResponse.Builder, + com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder>( + getLastScheduledRunResponse(), getParentForChildren(), isClean()); + lastScheduledRunResponse_ = null; + } + return lastScheduledRunResponseBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.Schedule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.Schedule) + private static final com.google.cloud.aiplatform.v1.Schedule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.Schedule(); + } + + public static com.google.cloud.aiplatform.v1.Schedule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Schedule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleName.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleName.java new file mode 100644 index 000000000000..46bcbe41d05f --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ScheduleName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_SCHEDULE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/schedules/{schedule}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String schedule; + + @Deprecated + protected ScheduleName() { + project = null; + location = null; + schedule = null; + } + + private ScheduleName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + schedule = Preconditions.checkNotNull(builder.getSchedule()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getSchedule() { + return schedule; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ScheduleName of(String project, String location, String schedule) { + return newBuilder().setProject(project).setLocation(location).setSchedule(schedule).build(); + } + + public static String format(String project, String location, String schedule) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setSchedule(schedule) + .build() + .toString(); + } + + public static ScheduleName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_SCHEDULE.validatedMatch( + formattedString, "ScheduleName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("schedule")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ScheduleName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_SCHEDULE.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (schedule != null) { + fieldMapBuilder.put("schedule", schedule); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_SCHEDULE.instantiate( + "project", project, "location", location, "schedule", schedule); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ScheduleName that = ((ScheduleName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.schedule, that.schedule); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(schedule); + return h; + } + + /** Builder for projects/{project}/locations/{location}/schedules/{schedule}. */ + public static class Builder { + private String project; + private String location; + private String schedule; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getSchedule() { + return schedule; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setSchedule(String schedule) { + this.schedule = schedule; + return this; + } + + private Builder(ScheduleName scheduleName) { + this.project = scheduleName.project; + this.location = scheduleName.location; + this.schedule = scheduleName.schedule; + } + + public ScheduleName build() { + return new ScheduleName(this); + } + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleOrBuilder.java new file mode 100644 index 000000000000..3135f4a6dc31 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleOrBuilder.java @@ -0,0 +1,641 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule.proto + +package com.google.cloud.aiplatform.v1; + +public interface ScheduleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.Schedule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return Whether the cron field is set. + */ + boolean hasCron(); + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return The cron. + */ + java.lang.String getCron(); + /** + * + * + *
+   * Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
+   * runs. To explicitly set a timezone to the cron tab, apply a prefix in the
+   * cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
+   * The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
+   * database. For example, "CRON_TZ=America/New_York 1 * * * *", or
+   * "TZ=America/New_York 1 * * * *".
+   * 
+ * + * string cron = 10; + * + * @return The bytes for cron. + */ + com.google.protobuf.ByteString getCronBytes(); + + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return Whether the createPipelineJobRequest field is set. + */ + boolean hasCreatePipelineJobRequest(); + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + * + * @return The createPipelineJobRequest. + */ + com.google.cloud.aiplatform.v1.CreatePipelineJobRequest getCreatePipelineJobRequest(); + /** + * + * + *
+   * Request for
+   * [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob].
+   * CreatePipelineJobRequest.parent field is required (format:
+   * projects/{project}/locations/{location}).
+   * 
+ * + * .google.cloud.aiplatform.v1.CreatePipelineJobRequest create_pipeline_job_request = 14; + * + */ + com.google.cloud.aiplatform.v1.CreatePipelineJobRequestOrBuilder + getCreatePipelineJobRequestOrBuilder(); + + /** + * + * + *
+   * Output only. The resource name of the Schedule.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the Schedule.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. User provided name of the Schedule.
+   * The name can be up to 128 characters long and can consist of any UTF-8
+   * characters.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Required. User provided name of the Schedule.
+   * The name can be up to 128 characters long and can consist of any UTF-8
+   * characters.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Optional. Timestamp after which the first run can be scheduled.
+   * Default to Schedule create time if not specified.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * Optional. Timestamp after which no new runs can be scheduled.
+   * If specified, The schedule will be completed when either
+   * end_time is reached or when scheduled_run_count >= max_run_count.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); + + /** + * + * + *
+   * Optional. Maximum run count of the schedule.
+   * If specified, The schedule will be completed when either
+   * started_run_count >= max_run_count or when end_time is reached.
+   * If not specified, new runs will keep getting scheduled until this Schedule
+   * is paused or deleted. Already scheduled runs will be allowed to complete.
+   * Unset if not specified.
+   * 
+ * + * int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxRunCount. + */ + long getMaxRunCount(); + + /** + * + * + *
+   * Output only. The number of runs started by this schedule.
+   * 
+ * + * int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startedRunCount. + */ + long getStartedRunCount(); + + /** + * + * + *
+   * Output only. The state of this Schedule.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The state of this Schedule.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.aiplatform.v1.Schedule.State getState(); + + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the nextRunTime field is set. + */ + boolean hasNextRunTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The nextRunTime. + */ + com.google.protobuf.Timestamp getNextRunTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule should schedule the next run.
+   * Having a next_run_time in the past means the runs are being started
+   * behind schedule.
+   * 
+ * + * + * .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getNextRunTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastPauseTime field is set. + */ + boolean hasLastPauseTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastPauseTime. + */ + com.google.protobuf.Timestamp getLastPauseTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last paused.
+   * Unset if never paused.
+   * 
+ * + * + * .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getLastPauseTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastResumeTime field is set. + */ + boolean hasLastResumeTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastResumeTime. + */ + com.google.protobuf.Timestamp getLastResumeTime(); + /** + * + * + *
+   * Output only. Timestamp when this Schedule was last resumed.
+   * Unset if never resumed from pause.
+   * 
+ * + * + * .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getLastResumeTimeOrBuilder(); + + /** + * + * + *
+   * Required. Maximum number of runs that can be started concurrently for this
+   * Schedule. This is the limit for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * 
+ * + * int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxConcurrentRunCount. + */ + long getMaxConcurrentRunCount(); + + /** + * + * + *
+   * Optional. Whether new scheduled runs can be queued when max_concurrent_runs
+   * limit is reached. If set to true, new runs will be queued instead of
+   * skipped. Default to false.
+   * 
+ * + * bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The allowQueueing. + */ + boolean getAllowQueueing(); + + /** + * + * + *
+   * Output only. Whether to backfill missed runs when the schedule is resumed
+   * from PAUSED state. If set to true, all missed runs will be scheduled. New
+   * runs will be scheduled after the backfill is complete. Default to false.
+   * 
+ * + * bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The catchUp. + */ + boolean getCatchUp(); + + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastScheduledRunResponse field is set. + */ + boolean hasLastScheduledRunResponse(); + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastScheduledRunResponse. + */ + com.google.cloud.aiplatform.v1.Schedule.RunResponse getLastScheduledRunResponse(); + /** + * + * + *
+   * Output only. Response of the last scheduled run.
+   * This is the response for starting the scheduled requests and not the
+   * execution of the operations/jobs created by the requests (if applicable).
+   * Unset if no run has been scheduled yet.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.aiplatform.v1.Schedule.RunResponseOrBuilder + getLastScheduledRunResponseOrBuilder(); + + com.google.cloud.aiplatform.v1.Schedule.TimeSpecificationCase getTimeSpecificationCase(); + + com.google.cloud.aiplatform.v1.Schedule.RequestCase getRequestCase(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleProto.java new file mode 100644 index 000000000000..b600af708738 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleProto.java @@ -0,0 +1,146 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule.proto + +package com.google.cloud.aiplatform.v1; + +public final class ScheduleProto { + private ScheduleProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_Schedule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_Schedule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n)google/cloud/aiplatform/v1/schedule.pr" + + "oto\022\032google.cloud.aiplatform.v1\032\037google/" + + "api/field_behavior.proto\032\031google/api/res" + + "ource.proto\0321google/cloud/aiplatform/v1/" + + "pipeline_service.proto\032\037google/protobuf/" + + "timestamp.proto\"\225\t\n\010Schedule\022\016\n\004cron\030\n \001" + + "(\tH\000\022[\n\033create_pipeline_job_request\030\016 \001(" + + "\01324.google.cloud.aiplatform.v1.CreatePip" + + "elineJobRequestH\001\022\022\n\004name\030\001 \001(\tB\004\342A\001\003\022\032\n" + + "\014display_name\030\002 \001(\tB\004\342A\001\002\0224\n\nstart_time\030" + + "\003 \001(\0132\032.google.protobuf.TimestampB\004\342A\001\001\022" + + "2\n\010end_time\030\004 \001(\0132\032.google.protobuf.Time" + + "stampB\004\342A\001\001\022\033\n\rmax_run_count\030\020 \001(\003B\004\342A\001\001" + + "\022\037\n\021started_run_count\030\021 \001(\003B\004\342A\001\003\022?\n\005sta" + + "te\030\005 \001(\0162*.google.cloud.aiplatform.v1.Sc" + + "hedule.StateB\004\342A\001\003\0225\n\013create_time\030\006 \001(\0132" + + "\032.google.protobuf.TimestampB\004\342A\001\003\0225\n\013upd" + + "ate_time\030\023 \001(\0132\032.google.protobuf.Timesta" + + "mpB\004\342A\001\003\0227\n\rnext_run_time\030\007 \001(\0132\032.google" + + ".protobuf.TimestampB\004\342A\001\003\0229\n\017last_pause_" + + "time\030\010 \001(\0132\032.google.protobuf.TimestampB\004" + + "\342A\001\003\022:\n\020last_resume_time\030\t \001(\0132\032.google." + + "protobuf.TimestampB\004\342A\001\003\022&\n\030max_concurre" + + "nt_run_count\030\013 \001(\003B\004\342A\001\002\022\034\n\016allow_queuei" + + "ng\030\014 \001(\010B\004\342A\001\001\022\026\n\010catch_up\030\r \001(\010B\004\342A\001\003\022[" + + "\n\033last_scheduled_run_response\030\022 \001(\01320.go" + + "ogle.cloud.aiplatform.v1.Schedule.RunRes" + + "ponseB\004\342A\001\003\032[\n\013RunResponse\0226\n\022scheduled_" + + "run_time\030\001 \001(\0132\032.google.protobuf.Timesta" + + "mp\022\024\n\014run_response\030\002 \001(\t\"E\n\005State\022\025\n\021STA" + + "TE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001\022\n\n\006PAUSED\020\002" + + "\022\r\n\tCOMPLETED\020\003:e\352Ab\n\"aiplatform.googlea" + + "pis.com/Schedule\022cloud.google.com/go/aiplatform/apiv" + + "1/aiplatformpb;aiplatformpb\252\002\032Google.Clo" + + "ud.AIPlatform.V1\312\002\032Google\\Cloud\\AIPlatfo" + + "rm\\V1\352\002\035Google::Cloud::AIPlatform::V1b\006p" + + "roto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.aiplatform.v1.PipelineServiceProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_aiplatform_v1_Schedule_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_aiplatform_v1_Schedule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_Schedule_descriptor, + new java.lang.String[] { + "Cron", + "CreatePipelineJobRequest", + "Name", + "DisplayName", + "StartTime", + "EndTime", + "MaxRunCount", + "StartedRunCount", + "State", + "CreateTime", + "UpdateTime", + "NextRunTime", + "LastPauseTime", + "LastResumeTime", + "MaxConcurrentRunCount", + "AllowQueueing", + "CatchUp", + "LastScheduledRunResponse", + "TimeSpecification", + "Request", + }); + internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor = + internal_static_google_cloud_aiplatform_v1_Schedule_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_Schedule_RunResponse_descriptor, + new java.lang.String[] { + "ScheduledRunTime", "RunResponse", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.ResourceProto.resource); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.aiplatform.v1.PipelineServiceProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceProto.java new file mode 100644 index 000000000000..603054075a1d --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ScheduleServiceProto.java @@ -0,0 +1,246 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public final class ScheduleServiceProto { + private ScheduleServiceProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n1google/cloud/aiplatform/v1/schedule_se" + + "rvice.proto\022\032google.cloud.aiplatform.v1\032" + + "\034google/api/annotations.proto\032\027google/ap" + + "i/client.proto\032\037google/api/field_behavio" + + "r.proto\032\031google/api/resource.proto\032*goog" + + "le/cloud/aiplatform/v1/operation.proto\032)" + + "google/cloud/aiplatform/v1/schedule.prot" + + "o\032#google/longrunning/operations.proto\032\033" + + "google/protobuf/empty.proto\032 google/prot" + + "obuf/field_mask.proto\"\221\001\n\025CreateSchedule" + + "Request\022:\n\006parent\030\001 \001(\tB*\342A\001\002\372A#\n!locati" + + "ons.googleapis.com/Location\022<\n\010schedule\030" + + "\002 \001(\0132$.google.cloud.aiplatform.v1.Sched" + + "uleB\004\342A\001\002\"O\n\022GetScheduleRequest\0229\n\004name\030" + + "\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.co" + + "m/Schedule\"\233\001\n\024ListSchedulesRequest\022:\n\006p" + + "arent\030\001 \001(\tB*\342A\001\002\372A#\n!locations.googleap" + + "is.com/Location\022\016\n\006filter\030\002 \001(\t\022\021\n\tpage_" + + "size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\022\020\n\010order_" + + "by\030\005 \001(\t\"i\n\025ListSchedulesResponse\0227\n\tsch" + + "edules\030\001 \003(\0132$.google.cloud.aiplatform.v" + + "1.Schedule\022\027\n\017next_page_token\030\002 \001(\t\"R\n\025D" + + "eleteScheduleRequest\0229\n\004name\030\001 \001(\tB+\342A\001\002" + + "\372A$\n\"aiplatform.googleapis.com/Schedule\"" + + "Q\n\024PauseScheduleRequest\0229\n\004name\030\001 \001(\tB+\342" + + "A\001\002\372A$\n\"aiplatform.googleapis.com/Schedu" + + "le\"j\n\025ResumeScheduleRequest\0229\n\004name\030\001 \001(" + + "\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.com/Sc" + + "hedule\022\026\n\010catch_up\030\002 \001(\010B\004\342A\001\001\"\214\001\n\025Updat" + + "eScheduleRequest\022<\n\010schedule\030\001 \001(\0132$.goo" + + "gle.cloud.aiplatform.v1.ScheduleB\004\342A\001\002\0225" + + "\n\013update_mask\030\002 \001(\0132\032.google.protobuf.Fi" + + "eldMaskB\004\342A\001\0022\366\n\n\017ScheduleService\022\274\001\n\016Cr" + + "eateSchedule\0221.google.cloud.aiplatform.v" + + "1.CreateScheduleRequest\032$.google.cloud.a" + + "iplatform.v1.Schedule\"Q\332A\017parent,schedul" + + "e\202\323\344\223\0029\"-/v1/{parent=projects/*/location" + + "s/*}/schedules:\010schedule\022\323\001\n\016DeleteSched" + + "ule\0221.google.cloud.aiplatform.v1.DeleteS" + + "cheduleRequest\032\035.google.longrunning.Oper" + + "ation\"o\312A0\n\025google.protobuf.Empty\022\027Delet" + + "eOperationMetadata\332A\004name\202\323\344\223\002/*-/v1/{na" + + "me=projects/*/locations/*/schedules/*}\022\241" + + "\001\n\013GetSchedule\022..google.cloud.aiplatform" + + ".v1.GetScheduleRequest\032$.google.cloud.ai" + + "platform.v1.Schedule\"<\332A\004name\202\323\344\223\002/\022-/v1" + + "/{name=projects/*/locations/*/schedules/" + + "*}\022\264\001\n\rListSchedules\0220.google.cloud.aipl" + + "atform.v1.ListSchedulesRequest\0321.google." + + "cloud.aiplatform.v1.ListSchedulesRespons" + + "e\">\332A\006parent\202\323\344\223\002/\022-/v1/{parent=projects" + + "/*/locations/*}/schedules\022\240\001\n\rPauseSched" + + "ule\0220.google.cloud.aiplatform.v1.PauseSc" + + "heduleRequest\032\026.google.protobuf.Empty\"E\332" + + "A\004name\202\323\344\223\0028\"3/v1/{name=projects/*/locat" + + "ions/*/schedules/*}:pause:\001*\022\263\001\n\016ResumeS" + + "chedule\0221.google.cloud.aiplatform.v1.Res" + + "umeScheduleRequest\032\026.google.protobuf.Emp" + + "ty\"V\332A\004name\332A\rname,catch_up\202\323\344\223\0029\"4/v1/{" + + "name=projects/*/locations/*/schedules/*}" + + ":resume:\001*\022\312\001\n\016UpdateSchedule\0221.google.c" + + "loud.aiplatform.v1.UpdateScheduleRequest" + + "\032$.google.cloud.aiplatform.v1.Schedule\"_" + + "\332A\024schedule,update_mask\202\323\344\223\002B26/v1/{sche" + + "dule.name=projects/*/locations/*/schedul" + + "es/*}:\010schedule\032M\312A\031aiplatform.googleapi" + + "s.com\322A.https://www.googleapis.com/auth/" + + "cloud-platformB\322\001\n\036com.google.cloud.aipl" + + "atform.v1B\024ScheduleServiceProtoP\001Z>cloud" + + ".google.com/go/aiplatform/apiv1/aiplatfo" + + "rmpb;aiplatformpb\252\002\032Google.Cloud.AIPlatf" + + "orm.V1\312\002\032Google\\Cloud\\AIPlatform\\V1\352\002\035Go" + + "ogle::Cloud::AIPlatform::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.aiplatform.v1.OperationProto.getDescriptor(), + com.google.cloud.aiplatform.v1.ScheduleProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + }); + internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_CreateScheduleRequest_descriptor, + new java.lang.String[] { + "Parent", "Schedule", + }); + internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_GetScheduleRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_ListSchedulesRequest_descriptor, + new java.lang.String[] { + "Parent", "Filter", "PageSize", "PageToken", "OrderBy", + }); + internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_ListSchedulesResponse_descriptor, + new java.lang.String[] { + "Schedules", "NextPageToken", + }); + internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_DeleteScheduleRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_PauseScheduleRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_ResumeScheduleRequest_descriptor, + new java.lang.String[] { + "Name", "CatchUp", + }); + internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor, + new java.lang.String[] { + "Schedule", "UpdateMask", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.aiplatform.v1.OperationProto.getDescriptor(); + com.google.cloud.aiplatform.v1.ScheduleProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequest.java new file mode 100644 index 000000000000..c22fc41aee39 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequest.java @@ -0,0 +1,1419 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict].
+ *
+ * The first message must contain
+ * [endpoint][google.cloud.aiplatform.v1.StreamingPredictRequest.endpoint] field
+ * and optionally [input][]. The subsequent messages must contain [input][].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingPredictRequest} + */ +public final class StreamingPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.StreamingPredictRequest) + StreamingPredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingPredictRequest.newBuilder() to construct. + private StreamingPredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingPredictRequest() { + endpoint_ = ""; + inputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingPredictRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingPredictRequest.class, + com.google.cloud.aiplatform.v1.StreamingPredictRequest.Builder.class); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUTS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List inputs_; + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List getInputsList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List + getInputsOrBuilderList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public int getInputsCount() { + return inputs_.size(); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getInputs(int index) { + return inputs_.get(index); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index) { + return inputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 3; + private com.google.cloud.aiplatform.v1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + output.writeMessage(2, inputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(3, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, inputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.StreamingPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.StreamingPredictRequest other = + (com.google.cloud.aiplatform.v1.StreamingPredictRequest) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getInputsList().equals(other.getInputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + if (getInputsCount() > 0) { + hash = (37 * hash) + INPUTS_FIELD_NUMBER; + hash = (53 * hash) + getInputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1.StreamingPredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict].
+   *
+   * The first message must contain
+   * [endpoint][google.cloud.aiplatform.v1.StreamingPredictRequest.endpoint] field
+   * and optionally [input][]. The subsequent messages must contain [input][].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.StreamingPredictRequest) + com.google.cloud.aiplatform.v1.StreamingPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingPredictRequest.class, + com.google.cloud.aiplatform.v1.StreamingPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.StreamingPredictRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + } else { + inputs_ = null; + inputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.StreamingPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictRequest build() { + com.google.cloud.aiplatform.v1.StreamingPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1.StreamingPredictRequest result = + new com.google.cloud.aiplatform.v1.StreamingPredictRequest(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1.StreamingPredictRequest result) { + if (inputsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + inputs_ = java.util.Collections.unmodifiableList(inputs_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.inputs_ = inputs_; + } else { + result.inputs_ = inputsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.StreamingPredictRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.StreamingPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.StreamingPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.StreamingPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1.StreamingPredictRequest.getDefaultInstance()) + return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (inputsBuilder_ == null) { + if (!other.inputs_.isEmpty()) { + if (inputs_.isEmpty()) { + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureInputsIsMutable(); + inputs_.addAll(other.inputs_); + } + onChanged(); + } + } else { + if (!other.inputs_.isEmpty()) { + if (inputsBuilder_.isEmpty()) { + inputsBuilder_.dispose(); + inputsBuilder_ = null; + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + inputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInputsFieldBuilder() + : null; + } else { + inputsBuilder_.addAllMessages(other.inputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.cloud.aiplatform.v1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1.Tensor.parser(), extensionRegistry); + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(m); + } else { + inputsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List inputs_ = + java.util.Collections.emptyList(); + + private void ensureInputsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + inputs_ = new java.util.ArrayList(inputs_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + inputsBuilder_; + + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public java.util.List getInputsList() { + if (inputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(inputs_); + } else { + return inputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public int getInputsCount() { + if (inputsBuilder_ == null) { + return inputs_.size(); + } else { + return inputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor getInputs(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder setInputs(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.set(index, value); + onChanged(); + } else { + inputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder setInputs( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.set(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(value); + onChanged(); + } else { + inputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder addInputs(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(index, value); + onChanged(); + } else { + inputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder addInputs( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder addAllInputs( + java.lang.Iterable values) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputs_); + onChanged(); + } else { + inputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder clearInputs() { + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + inputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder removeInputs(int index) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.remove(index); + onChanged(); + } else { + inputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getInputsBuilder(int index) { + return getInputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public java.util.List + getInputsOrBuilderList() { + if (inputsBuilder_ != null) { + return inputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(inputs_); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addInputsBuilder() { + return getInputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addInputsBuilder(int index) { + return getInputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public java.util.List getInputsBuilderList() { + return getInputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getInputsFieldBuilder() { + if (inputsBuilder_ == null) { + inputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + inputs_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + inputs_ = null; + } + return inputsBuilder_; + } + + private com.google.cloud.aiplatform.v1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000004); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.StreamingPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.StreamingPredictRequest) + private static final com.google.cloud.aiplatform.v1.StreamingPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.StreamingPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingPredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequestOrBuilder.java new file mode 100644 index 000000000000..d23bb6281c42 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictRequestOrBuilder.java @@ -0,0 +1,144 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface StreamingPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.StreamingPredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + java.util.List getInputsList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1.Tensor getInputs(int index); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + int getInputsCount(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + java.util.List getInputsOrBuilderList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponse.java new file mode 100644 index 000000000000..76f5ff3b127b --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponse.java @@ -0,0 +1,1201 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingPredictResponse} + */ +public final class StreamingPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.StreamingPredictResponse) + StreamingPredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingPredictResponse.newBuilder() to construct. + private StreamingPredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingPredictResponse() { + outputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingPredictResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingPredictResponse.class, + com.google.cloud.aiplatform.v1.StreamingPredictResponse.Builder.class); + } + + public static final int OUTPUTS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List outputs_; + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List getOutputsList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List + getOutputsOrBuilderList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public int getOutputsCount() { + return outputs_.size(); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getOutputs(int index) { + return outputs_.get(index); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index) { + return outputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 2; + private com.google.cloud.aiplatform.v1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < outputs_.size(); i++) { + output.writeMessage(1, outputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(2, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < outputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, outputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.StreamingPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.StreamingPredictResponse other = + (com.google.cloud.aiplatform.v1.StreamingPredictResponse) obj; + + if (!getOutputsList().equals(other.getOutputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getOutputsCount() > 0) { + hash = (37 * hash) + OUTPUTS_FIELD_NUMBER; + hash = (53 * hash) + getOutputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1.StreamingPredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.StreamingPredictResponse) + com.google.cloud.aiplatform.v1.StreamingPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingPredictResponse.class, + com.google.cloud.aiplatform.v1.StreamingPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.StreamingPredictResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + } else { + outputs_ = null; + outputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.StreamingPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictResponse build() { + com.google.cloud.aiplatform.v1.StreamingPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1.StreamingPredictResponse result = + new com.google.cloud.aiplatform.v1.StreamingPredictResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1.StreamingPredictResponse result) { + if (outputsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + outputs_ = java.util.Collections.unmodifiableList(outputs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.outputs_ = outputs_; + } else { + result.outputs_ = outputsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.StreamingPredictResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.StreamingPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.StreamingPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.StreamingPredictResponse other) { + if (other == com.google.cloud.aiplatform.v1.StreamingPredictResponse.getDefaultInstance()) + return this; + if (outputsBuilder_ == null) { + if (!other.outputs_.isEmpty()) { + if (outputs_.isEmpty()) { + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureOutputsIsMutable(); + outputs_.addAll(other.outputs_); + } + onChanged(); + } + } else { + if (!other.outputs_.isEmpty()) { + if (outputsBuilder_.isEmpty()) { + outputsBuilder_.dispose(); + outputsBuilder_ = null; + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + outputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOutputsFieldBuilder() + : null; + } else { + outputsBuilder_.addAllMessages(other.outputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.aiplatform.v1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1.Tensor.parser(), extensionRegistry); + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(m); + } else { + outputsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List outputs_ = + java.util.Collections.emptyList(); + + private void ensureOutputsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + outputs_ = new java.util.ArrayList(outputs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + outputsBuilder_; + + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public java.util.List getOutputsList() { + if (outputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(outputs_); + } else { + return outputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public int getOutputsCount() { + if (outputsBuilder_ == null) { + return outputs_.size(); + } else { + return outputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor getOutputs(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder setOutputs(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.set(index, value); + onChanged(); + } else { + outputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder setOutputs( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.set(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(value); + onChanged(); + } else { + outputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder addOutputs(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(index, value); + onChanged(); + } else { + outputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder addOutputs( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder addAllOutputs( + java.lang.Iterable values) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, outputs_); + onChanged(); + } else { + outputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder clearOutputs() { + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + outputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder removeOutputs(int index) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.remove(index); + onChanged(); + } else { + outputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getOutputsBuilder(int index) { + return getOutputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public java.util.List + getOutputsOrBuilderList() { + if (outputsBuilder_ != null) { + return outputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(outputs_); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addOutputsBuilder() { + return getOutputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addOutputsBuilder(int index) { + return getOutputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public java.util.List getOutputsBuilderList() { + return getOutputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getOutputsFieldBuilder() { + if (outputsBuilder_ == null) { + outputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + outputs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + outputs_ = null; + } + return outputsBuilder_; + } + + private com.google.cloud.aiplatform.v1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.StreamingPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.StreamingPredictResponse) + private static final com.google.cloud.aiplatform.v1.StreamingPredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.StreamingPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1.StreamingPredictResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingPredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponseOrBuilder.java new file mode 100644 index 000000000000..9a69e6811e01 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingPredictResponseOrBuilder.java @@ -0,0 +1,112 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface StreamingPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.StreamingPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + java.util.List getOutputsList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1.Tensor getOutputs(int index); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + int getOutputsCount(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + java.util.List + getOutputsOrBuilderList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Tensor.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Tensor.java new file mode 100644 index 000000000000..7a4bf2e3faed --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/Tensor.java @@ -0,0 +1,4223 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/types.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * A tensor value type.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Tensor} + */ +public final class Tensor extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.Tensor) + TensorOrBuilder { + private static final long serialVersionUID = 0L; + // Use Tensor.newBuilder() to construct. + private Tensor(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Tensor() { + dtype_ = 0; + shape_ = emptyLongList(); + boolVal_ = emptyBooleanList(); + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bytesVal_ = java.util.Collections.emptyList(); + floatVal_ = emptyFloatList(); + doubleVal_ = emptyDoubleList(); + intVal_ = emptyIntList(); + int64Val_ = emptyLongList(); + uintVal_ = emptyIntList(); + uint64Val_ = emptyLongList(); + listVal_ = java.util.Collections.emptyList(); + tensorVal_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Tensor(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Tensor.class, + com.google.cloud.aiplatform.v1.Tensor.Builder.class); + } + + /** + * + * + *
+   * Data type of the tensor.
+   * 
+ * + * Protobuf enum {@code google.cloud.aiplatform.v1.Tensor.DataType} + */ + public enum DataType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Not a legal value for DataType. Used to indicate a DataType field has not
+     * been set.
+     * 
+ * + * DATA_TYPE_UNSPECIFIED = 0; + */ + DATA_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * Data types that all computation devices are expected to be
+     * capable to support.
+     * 
+ * + * BOOL = 1; + */ + BOOL(1), + /** STRING = 2; */ + STRING(2), + /** FLOAT = 3; */ + FLOAT(3), + /** DOUBLE = 4; */ + DOUBLE(4), + /** INT8 = 5; */ + INT8(5), + /** INT16 = 6; */ + INT16(6), + /** INT32 = 7; */ + INT32(7), + /** INT64 = 8; */ + INT64(8), + /** UINT8 = 9; */ + UINT8(9), + /** UINT16 = 10; */ + UINT16(10), + /** UINT32 = 11; */ + UINT32(11), + /** UINT64 = 12; */ + UINT64(12), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Not a legal value for DataType. Used to indicate a DataType field has not
+     * been set.
+     * 
+ * + * DATA_TYPE_UNSPECIFIED = 0; + */ + public static final int DATA_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Data types that all computation devices are expected to be
+     * capable to support.
+     * 
+ * + * BOOL = 1; + */ + public static final int BOOL_VALUE = 1; + /** STRING = 2; */ + public static final int STRING_VALUE = 2; + /** FLOAT = 3; */ + public static final int FLOAT_VALUE = 3; + /** DOUBLE = 4; */ + public static final int DOUBLE_VALUE = 4; + /** INT8 = 5; */ + public static final int INT8_VALUE = 5; + /** INT16 = 6; */ + public static final int INT16_VALUE = 6; + /** INT32 = 7; */ + public static final int INT32_VALUE = 7; + /** INT64 = 8; */ + public static final int INT64_VALUE = 8; + /** UINT8 = 9; */ + public static final int UINT8_VALUE = 9; + /** UINT16 = 10; */ + public static final int UINT16_VALUE = 10; + /** UINT32 = 11; */ + public static final int UINT32_VALUE = 11; + /** UINT64 = 12; */ + public static final int UINT64_VALUE = 12; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DataType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DataType forNumber(int value) { + switch (value) { + case 0: + return DATA_TYPE_UNSPECIFIED; + case 1: + return BOOL; + case 2: + return STRING; + case 3: + return FLOAT; + case 4: + return DOUBLE; + case 5: + return INT8; + case 6: + return INT16; + case 7: + return INT32; + case 8: + return INT64; + case 9: + return UINT8; + case 10: + return UINT16; + case 11: + return UINT32; + case 12: + return UINT64; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DataType findValueByNumber(int number) { + return DataType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.Tensor.getDescriptor().getEnumTypes().get(0); + } + + private static final DataType[] VALUES = values(); + + public static DataType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DataType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.aiplatform.v1.Tensor.DataType) + } + + public static final int DTYPE_FIELD_NUMBER = 1; + private int dtype_ = 0; + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + @java.lang.Override + public int getDtypeValue() { + return dtype_; + } + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor.DataType getDtype() { + com.google.cloud.aiplatform.v1.Tensor.DataType result = + com.google.cloud.aiplatform.v1.Tensor.DataType.forNumber(dtype_); + return result == null ? com.google.cloud.aiplatform.v1.Tensor.DataType.UNRECOGNIZED : result; + } + + public static final int SHAPE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList shape_; + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + @java.lang.Override + public java.util.List getShapeList() { + return shape_; + } + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + public int getShapeCount() { + return shape_.size(); + } + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + public long getShape(int index) { + return shape_.getLong(index); + } + + private int shapeMemoizedSerializedSize = -1; + + public static final int BOOL_VAL_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.BooleanList boolVal_; + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + @java.lang.Override + public java.util.List getBoolValList() { + return boolVal_; + } + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + public int getBoolValCount() { + return boolVal_.size(); + } + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + public boolean getBoolVal(int index) { + return boolVal_.getBoolean(index); + } + + private int boolValMemoizedSerializedSize = -1; + + public static final int STRING_VAL_FIELD_NUMBER = 14; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList stringVal_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + public com.google.protobuf.ProtocolStringList getStringValList() { + return stringVal_; + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + public int getStringValCount() { + return stringVal_.size(); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + public java.lang.String getStringVal(int index) { + return stringVal_.get(index); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + public com.google.protobuf.ByteString getStringValBytes(int index) { + return stringVal_.getByteString(index); + } + + public static final int BYTES_VAL_FIELD_NUMBER = 15; + + @SuppressWarnings("serial") + private java.util.List bytesVal_; + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + @java.lang.Override + public java.util.List getBytesValList() { + return bytesVal_; + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + public int getBytesValCount() { + return bytesVal_.size(); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + public com.google.protobuf.ByteString getBytesVal(int index) { + return bytesVal_.get(index); + } + + public static final int FLOAT_VAL_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.FloatList floatVal_; + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + @java.lang.Override + public java.util.List getFloatValList() { + return floatVal_; + } + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + public int getFloatValCount() { + return floatVal_.size(); + } + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + public float getFloatVal(int index) { + return floatVal_.getFloat(index); + } + + private int floatValMemoizedSerializedSize = -1; + + public static final int DOUBLE_VAL_FIELD_NUMBER = 6; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.DoubleList doubleVal_; + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + @java.lang.Override + public java.util.List getDoubleValList() { + return doubleVal_; + } + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + public int getDoubleValCount() { + return doubleVal_.size(); + } + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + public double getDoubleVal(int index) { + return doubleVal_.getDouble(index); + } + + private int doubleValMemoizedSerializedSize = -1; + + public static final int INT_VAL_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList intVal_; + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + @java.lang.Override + public java.util.List getIntValList() { + return intVal_; + } + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + public int getIntValCount() { + return intVal_.size(); + } + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + public int getIntVal(int index) { + return intVal_.getInt(index); + } + + private int intValMemoizedSerializedSize = -1; + + public static final int INT64_VAL_FIELD_NUMBER = 8; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList int64Val_; + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + @java.lang.Override + public java.util.List getInt64ValList() { + return int64Val_; + } + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + public int getInt64ValCount() { + return int64Val_.size(); + } + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + public long getInt64Val(int index) { + return int64Val_.getLong(index); + } + + private int int64ValMemoizedSerializedSize = -1; + + public static final int UINT_VAL_FIELD_NUMBER = 9; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList uintVal_; + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + @java.lang.Override + public java.util.List getUintValList() { + return uintVal_; + } + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + public int getUintValCount() { + return uintVal_.size(); + } + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + public int getUintVal(int index) { + return uintVal_.getInt(index); + } + + private int uintValMemoizedSerializedSize = -1; + + public static final int UINT64_VAL_FIELD_NUMBER = 10; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList uint64Val_; + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + @java.lang.Override + public java.util.List getUint64ValList() { + return uint64Val_; + } + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + public int getUint64ValCount() { + return uint64Val_.size(); + } + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + public long getUint64Val(int index) { + return uint64Val_.getLong(index); + } + + private int uint64ValMemoizedSerializedSize = -1; + + public static final int LIST_VAL_FIELD_NUMBER = 11; + + @SuppressWarnings("serial") + private java.util.List listVal_; + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + @java.lang.Override + public java.util.List getListValList() { + return listVal_; + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + @java.lang.Override + public java.util.List + getListValOrBuilderList() { + return listVal_; + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + @java.lang.Override + public int getListValCount() { + return listVal_.size(); + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getListVal(int index) { + return listVal_.get(index); + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getListValOrBuilder(int index) { + return listVal_.get(index); + } + + public static final int STRUCT_VAL_FIELD_NUMBER = 12; + + private static final class StructValDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.aiplatform.v1.Tensor> + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField + structVal_; + + private com.google.protobuf.MapField + internalGetStructVal() { + if (structVal_ == null) { + return com.google.protobuf.MapField.emptyMapField(StructValDefaultEntryHolder.defaultEntry); + } + return structVal_; + } + + public int getStructValCount() { + return internalGetStructVal().getMap().size(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public boolean containsStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetStructVal().getMap().containsKey(key); + } + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getStructVal() { + return getStructValMap(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public java.util.Map getStructValMap() { + return internalGetStructVal().getMap(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public /* nullable */ com.google.cloud.aiplatform.v1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1.Tensor defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getStructValOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int TENSOR_VAL_FIELD_NUMBER = 13; + private com.google.protobuf.ByteString tensorVal_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * Serialized raw tensor content.
+   * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTensorVal() { + return tensorVal_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (dtype_ + != com.google.cloud.aiplatform.v1.Tensor.DataType.DATA_TYPE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, dtype_); + } + if (getShapeList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(shapeMemoizedSerializedSize); + } + for (int i = 0; i < shape_.size(); i++) { + output.writeInt64NoTag(shape_.getLong(i)); + } + if (getBoolValList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(boolValMemoizedSerializedSize); + } + for (int i = 0; i < boolVal_.size(); i++) { + output.writeBoolNoTag(boolVal_.getBoolean(i)); + } + if (getFloatValList().size() > 0) { + output.writeUInt32NoTag(42); + output.writeUInt32NoTag(floatValMemoizedSerializedSize); + } + for (int i = 0; i < floatVal_.size(); i++) { + output.writeFloatNoTag(floatVal_.getFloat(i)); + } + if (getDoubleValList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(doubleValMemoizedSerializedSize); + } + for (int i = 0; i < doubleVal_.size(); i++) { + output.writeDoubleNoTag(doubleVal_.getDouble(i)); + } + if (getIntValList().size() > 0) { + output.writeUInt32NoTag(58); + output.writeUInt32NoTag(intValMemoizedSerializedSize); + } + for (int i = 0; i < intVal_.size(); i++) { + output.writeInt32NoTag(intVal_.getInt(i)); + } + if (getInt64ValList().size() > 0) { + output.writeUInt32NoTag(66); + output.writeUInt32NoTag(int64ValMemoizedSerializedSize); + } + for (int i = 0; i < int64Val_.size(); i++) { + output.writeInt64NoTag(int64Val_.getLong(i)); + } + if (getUintValList().size() > 0) { + output.writeUInt32NoTag(74); + output.writeUInt32NoTag(uintValMemoizedSerializedSize); + } + for (int i = 0; i < uintVal_.size(); i++) { + output.writeUInt32NoTag(uintVal_.getInt(i)); + } + if (getUint64ValList().size() > 0) { + output.writeUInt32NoTag(82); + output.writeUInt32NoTag(uint64ValMemoizedSerializedSize); + } + for (int i = 0; i < uint64Val_.size(); i++) { + output.writeUInt64NoTag(uint64Val_.getLong(i)); + } + for (int i = 0; i < listVal_.size(); i++) { + output.writeMessage(11, listVal_.get(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetStructVal(), StructValDefaultEntryHolder.defaultEntry, 12); + if (!tensorVal_.isEmpty()) { + output.writeBytes(13, tensorVal_); + } + for (int i = 0; i < stringVal_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 14, stringVal_.getRaw(i)); + } + for (int i = 0; i < bytesVal_.size(); i++) { + output.writeBytes(15, bytesVal_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (dtype_ + != com.google.cloud.aiplatform.v1.Tensor.DataType.DATA_TYPE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, dtype_); + } + { + int dataSize = 0; + for (int i = 0; i < shape_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag(shape_.getLong(i)); + } + size += dataSize; + if (!getShapeList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + shapeMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * getBoolValList().size(); + size += dataSize; + if (!getBoolValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + boolValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * getFloatValList().size(); + size += dataSize; + if (!getFloatValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + floatValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * getDoubleValList().size(); + size += dataSize; + if (!getDoubleValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + doubleValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < intVal_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intVal_.getInt(i)); + } + size += dataSize; + if (!getIntValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + intValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < int64Val_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag(int64Val_.getLong(i)); + } + size += dataSize; + if (!getInt64ValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + int64ValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < uintVal_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uintVal_.getInt(i)); + } + size += dataSize; + if (!getUintValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + uintValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < uint64Val_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeUInt64SizeNoTag(uint64Val_.getLong(i)); + } + size += dataSize; + if (!getUint64ValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + uint64ValMemoizedSerializedSize = dataSize; + } + for (int i = 0; i < listVal_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, listVal_.get(i)); + } + for (java.util.Map.Entry entry : + internalGetStructVal().getMap().entrySet()) { + com.google.protobuf.MapEntry + structVal__ = + StructValDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, structVal__); + } + if (!tensorVal_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(13, tensorVal_); + } + { + int dataSize = 0; + for (int i = 0; i < stringVal_.size(); i++) { + dataSize += computeStringSizeNoTag(stringVal_.getRaw(i)); + } + size += dataSize; + size += 1 * getStringValList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < bytesVal_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeBytesSizeNoTag(bytesVal_.get(i)); + } + size += dataSize; + size += 1 * getBytesValList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.Tensor)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.Tensor other = (com.google.cloud.aiplatform.v1.Tensor) obj; + + if (dtype_ != other.dtype_) return false; + if (!getShapeList().equals(other.getShapeList())) return false; + if (!getBoolValList().equals(other.getBoolValList())) return false; + if (!getStringValList().equals(other.getStringValList())) return false; + if (!getBytesValList().equals(other.getBytesValList())) return false; + if (!getFloatValList().equals(other.getFloatValList())) return false; + if (!getDoubleValList().equals(other.getDoubleValList())) return false; + if (!getIntValList().equals(other.getIntValList())) return false; + if (!getInt64ValList().equals(other.getInt64ValList())) return false; + if (!getUintValList().equals(other.getUintValList())) return false; + if (!getUint64ValList().equals(other.getUint64ValList())) return false; + if (!getListValList().equals(other.getListValList())) return false; + if (!internalGetStructVal().equals(other.internalGetStructVal())) return false; + if (!getTensorVal().equals(other.getTensorVal())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DTYPE_FIELD_NUMBER; + hash = (53 * hash) + dtype_; + if (getShapeCount() > 0) { + hash = (37 * hash) + SHAPE_FIELD_NUMBER; + hash = (53 * hash) + getShapeList().hashCode(); + } + if (getBoolValCount() > 0) { + hash = (37 * hash) + BOOL_VAL_FIELD_NUMBER; + hash = (53 * hash) + getBoolValList().hashCode(); + } + if (getStringValCount() > 0) { + hash = (37 * hash) + STRING_VAL_FIELD_NUMBER; + hash = (53 * hash) + getStringValList().hashCode(); + } + if (getBytesValCount() > 0) { + hash = (37 * hash) + BYTES_VAL_FIELD_NUMBER; + hash = (53 * hash) + getBytesValList().hashCode(); + } + if (getFloatValCount() > 0) { + hash = (37 * hash) + FLOAT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getFloatValList().hashCode(); + } + if (getDoubleValCount() > 0) { + hash = (37 * hash) + DOUBLE_VAL_FIELD_NUMBER; + hash = (53 * hash) + getDoubleValList().hashCode(); + } + if (getIntValCount() > 0) { + hash = (37 * hash) + INT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getIntValList().hashCode(); + } + if (getInt64ValCount() > 0) { + hash = (37 * hash) + INT64_VAL_FIELD_NUMBER; + hash = (53 * hash) + getInt64ValList().hashCode(); + } + if (getUintValCount() > 0) { + hash = (37 * hash) + UINT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getUintValList().hashCode(); + } + if (getUint64ValCount() > 0) { + hash = (37 * hash) + UINT64_VAL_FIELD_NUMBER; + hash = (53 * hash) + getUint64ValList().hashCode(); + } + if (getListValCount() > 0) { + hash = (37 * hash) + LIST_VAL_FIELD_NUMBER; + hash = (53 * hash) + getListValList().hashCode(); + } + if (!internalGetStructVal().getMap().isEmpty()) { + hash = (37 * hash) + STRUCT_VAL_FIELD_NUMBER; + hash = (53 * hash) + internalGetStructVal().hashCode(); + } + hash = (37 * hash) + TENSOR_VAL_FIELD_NUMBER; + hash = (53 * hash) + getTensorVal().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.Tensor parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.Tensor prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A tensor value type.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.Tensor} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.Tensor) + com.google.cloud.aiplatform.v1.TensorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 12: + return internalGetMutableStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.Tensor.class, + com.google.cloud.aiplatform.v1.Tensor.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.Tensor.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + dtype_ = 0; + shape_ = emptyLongList(); + boolVal_ = emptyBooleanList(); + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bytesVal_ = java.util.Collections.emptyList(); + floatVal_ = emptyFloatList(); + doubleVal_ = emptyDoubleList(); + intVal_ = emptyIntList(); + int64Val_ = emptyLongList(); + uintVal_ = emptyIntList(); + uint64Val_ = emptyLongList(); + if (listValBuilder_ == null) { + listVal_ = java.util.Collections.emptyList(); + } else { + listVal_ = null; + listValBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000800); + internalGetMutableStructVal().clear(); + tensorVal_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.TypesProto + .internal_static_google_cloud_aiplatform_v1_Tensor_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor build() { + com.google.cloud.aiplatform.v1.Tensor result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor buildPartial() { + com.google.cloud.aiplatform.v1.Tensor result = + new com.google.cloud.aiplatform.v1.Tensor(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.cloud.aiplatform.v1.Tensor result) { + if (((bitField0_ & 0x00000002) != 0)) { + shape_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.shape_ = shape_; + if (((bitField0_ & 0x00000004) != 0)) { + boolVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.boolVal_ = boolVal_; + if (((bitField0_ & 0x00000010) != 0)) { + bytesVal_ = java.util.Collections.unmodifiableList(bytesVal_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.bytesVal_ = bytesVal_; + if (((bitField0_ & 0x00000020) != 0)) { + floatVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.floatVal_ = floatVal_; + if (((bitField0_ & 0x00000040) != 0)) { + doubleVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.doubleVal_ = doubleVal_; + if (((bitField0_ & 0x00000080) != 0)) { + intVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.intVal_ = intVal_; + if (((bitField0_ & 0x00000100) != 0)) { + int64Val_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000100); + } + result.int64Val_ = int64Val_; + if (((bitField0_ & 0x00000200) != 0)) { + uintVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000200); + } + result.uintVal_ = uintVal_; + if (((bitField0_ & 0x00000400) != 0)) { + uint64Val_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000400); + } + result.uint64Val_ = uint64Val_; + if (listValBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0)) { + listVal_ = java.util.Collections.unmodifiableList(listVal_); + bitField0_ = (bitField0_ & ~0x00000800); + } + result.listVal_ = listVal_; + } else { + result.listVal_ = listValBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.Tensor result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.dtype_ = dtype_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + stringVal_.makeImmutable(); + result.stringVal_ = stringVal_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.structVal_ = internalGetStructVal(); + result.structVal_.makeImmutable(); + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.tensorVal_ = tensorVal_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.Tensor) { + return mergeFrom((com.google.cloud.aiplatform.v1.Tensor) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.Tensor other) { + if (other == com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()) return this; + if (other.dtype_ != 0) { + setDtypeValue(other.getDtypeValue()); + } + if (!other.shape_.isEmpty()) { + if (shape_.isEmpty()) { + shape_ = other.shape_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureShapeIsMutable(); + shape_.addAll(other.shape_); + } + onChanged(); + } + if (!other.boolVal_.isEmpty()) { + if (boolVal_.isEmpty()) { + boolVal_ = other.boolVal_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureBoolValIsMutable(); + boolVal_.addAll(other.boolVal_); + } + onChanged(); + } + if (!other.stringVal_.isEmpty()) { + if (stringVal_.isEmpty()) { + stringVal_ = other.stringVal_; + bitField0_ |= 0x00000008; + } else { + ensureStringValIsMutable(); + stringVal_.addAll(other.stringVal_); + } + onChanged(); + } + if (!other.bytesVal_.isEmpty()) { + if (bytesVal_.isEmpty()) { + bytesVal_ = other.bytesVal_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureBytesValIsMutable(); + bytesVal_.addAll(other.bytesVal_); + } + onChanged(); + } + if (!other.floatVal_.isEmpty()) { + if (floatVal_.isEmpty()) { + floatVal_ = other.floatVal_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureFloatValIsMutable(); + floatVal_.addAll(other.floatVal_); + } + onChanged(); + } + if (!other.doubleVal_.isEmpty()) { + if (doubleVal_.isEmpty()) { + doubleVal_ = other.doubleVal_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureDoubleValIsMutable(); + doubleVal_.addAll(other.doubleVal_); + } + onChanged(); + } + if (!other.intVal_.isEmpty()) { + if (intVal_.isEmpty()) { + intVal_ = other.intVal_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureIntValIsMutable(); + intVal_.addAll(other.intVal_); + } + onChanged(); + } + if (!other.int64Val_.isEmpty()) { + if (int64Val_.isEmpty()) { + int64Val_ = other.int64Val_; + bitField0_ = (bitField0_ & ~0x00000100); + } else { + ensureInt64ValIsMutable(); + int64Val_.addAll(other.int64Val_); + } + onChanged(); + } + if (!other.uintVal_.isEmpty()) { + if (uintVal_.isEmpty()) { + uintVal_ = other.uintVal_; + bitField0_ = (bitField0_ & ~0x00000200); + } else { + ensureUintValIsMutable(); + uintVal_.addAll(other.uintVal_); + } + onChanged(); + } + if (!other.uint64Val_.isEmpty()) { + if (uint64Val_.isEmpty()) { + uint64Val_ = other.uint64Val_; + bitField0_ = (bitField0_ & ~0x00000400); + } else { + ensureUint64ValIsMutable(); + uint64Val_.addAll(other.uint64Val_); + } + onChanged(); + } + if (listValBuilder_ == null) { + if (!other.listVal_.isEmpty()) { + if (listVal_.isEmpty()) { + listVal_ = other.listVal_; + bitField0_ = (bitField0_ & ~0x00000800); + } else { + ensureListValIsMutable(); + listVal_.addAll(other.listVal_); + } + onChanged(); + } + } else { + if (!other.listVal_.isEmpty()) { + if (listValBuilder_.isEmpty()) { + listValBuilder_.dispose(); + listValBuilder_ = null; + listVal_ = other.listVal_; + bitField0_ = (bitField0_ & ~0x00000800); + listValBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getListValFieldBuilder() + : null; + } else { + listValBuilder_.addAllMessages(other.listVal_); + } + } + } + internalGetMutableStructVal().mergeFrom(other.internalGetStructVal()); + bitField0_ |= 0x00001000; + if (other.getTensorVal() != com.google.protobuf.ByteString.EMPTY) { + setTensorVal(other.getTensorVal()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + dtype_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + long v = input.readInt64(); + ensureShapeIsMutable(); + shape_.addLong(v); + break; + } // case 16 + case 18: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureShapeIsMutable(); + while (input.getBytesUntilLimit() > 0) { + shape_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } // case 18 + case 24: + { + boolean v = input.readBool(); + ensureBoolValIsMutable(); + boolVal_.addBoolean(v); + break; + } // case 24 + case 26: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureBoolValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + boolVal_.addBoolean(input.readBool()); + } + input.popLimit(limit); + break; + } // case 26 + case 45: + { + float v = input.readFloat(); + ensureFloatValIsMutable(); + floatVal_.addFloat(v); + break; + } // case 45 + case 42: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureFloatValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + floatVal_.addFloat(input.readFloat()); + } + input.popLimit(limit); + break; + } // case 42 + case 49: + { + double v = input.readDouble(); + ensureDoubleValIsMutable(); + doubleVal_.addDouble(v); + break; + } // case 49 + case 50: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureDoubleValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + doubleVal_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } // case 50 + case 56: + { + int v = input.readInt32(); + ensureIntValIsMutable(); + intVal_.addInt(v); + break; + } // case 56 + case 58: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureIntValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + intVal_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } // case 58 + case 64: + { + long v = input.readInt64(); + ensureInt64ValIsMutable(); + int64Val_.addLong(v); + break; + } // case 64 + case 66: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureInt64ValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + int64Val_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } // case 66 + case 72: + { + int v = input.readUInt32(); + ensureUintValIsMutable(); + uintVal_.addInt(v); + break; + } // case 72 + case 74: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureUintValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + uintVal_.addInt(input.readUInt32()); + } + input.popLimit(limit); + break; + } // case 74 + case 80: + { + long v = input.readUInt64(); + ensureUint64ValIsMutable(); + uint64Val_.addLong(v); + break; + } // case 80 + case 82: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureUint64ValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + uint64Val_.addLong(input.readUInt64()); + } + input.popLimit(limit); + break; + } // case 82 + case 90: + { + com.google.cloud.aiplatform.v1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1.Tensor.parser(), extensionRegistry); + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(m); + } else { + listValBuilder_.addMessage(m); + } + break; + } // case 90 + case 98: + { + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.aiplatform.v1.Tensor> + structVal__ = + input.readMessage( + StructValDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableStructVal() + .getMutableMap() + .put(structVal__.getKey(), structVal__.getValue()); + bitField0_ |= 0x00001000; + break; + } // case 98 + case 106: + { + tensorVal_ = input.readBytes(); + bitField0_ |= 0x00002000; + break; + } // case 106 + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureStringValIsMutable(); + stringVal_.add(s); + break; + } // case 114 + case 122: + { + com.google.protobuf.ByteString v = input.readBytes(); + ensureBytesValIsMutable(); + bytesVal_.add(v); + break; + } // case 122 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int dtype_ = 0; + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + @java.lang.Override + public int getDtypeValue() { + return dtype_; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @param value The enum numeric value on the wire for dtype to set. + * @return This builder for chaining. + */ + public Builder setDtypeValue(int value) { + dtype_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor.DataType getDtype() { + com.google.cloud.aiplatform.v1.Tensor.DataType result = + com.google.cloud.aiplatform.v1.Tensor.DataType.forNumber(dtype_); + return result == null ? com.google.cloud.aiplatform.v1.Tensor.DataType.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @param value The dtype to set. + * @return This builder for chaining. + */ + public Builder setDtype(com.google.cloud.aiplatform.v1.Tensor.DataType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + dtype_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return This builder for chaining. + */ + public Builder clearDtype() { + bitField0_ = (bitField0_ & ~0x00000001); + dtype_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList shape_ = emptyLongList(); + + private void ensureShapeIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + shape_ = mutableCopy(shape_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + public java.util.List getShapeList() { + return ((bitField0_ & 0x00000002) != 0) + ? java.util.Collections.unmodifiableList(shape_) + : shape_; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + public int getShapeCount() { + return shape_.size(); + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + public long getShape(int index) { + return shape_.getLong(index); + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param index The index to set the value at. + * @param value The shape to set. + * @return This builder for chaining. + */ + public Builder setShape(int index, long value) { + + ensureShapeIsMutable(); + shape_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param value The shape to add. + * @return This builder for chaining. + */ + public Builder addShape(long value) { + + ensureShapeIsMutable(); + shape_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param values The shape to add. + * @return This builder for chaining. + */ + public Builder addAllShape(java.lang.Iterable values) { + ensureShapeIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, shape_); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return This builder for chaining. + */ + public Builder clearShape() { + shape_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.BooleanList boolVal_ = emptyBooleanList(); + + private void ensureBoolValIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + boolVal_ = mutableCopy(boolVal_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + public java.util.List getBoolValList() { + return ((bitField0_ & 0x00000004) != 0) + ? java.util.Collections.unmodifiableList(boolVal_) + : boolVal_; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + public int getBoolValCount() { + return boolVal_.size(); + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + public boolean getBoolVal(int index) { + return boolVal_.getBoolean(index); + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index to set the value at. + * @param value The boolVal to set. + * @return This builder for chaining. + */ + public Builder setBoolVal(int index, boolean value) { + + ensureBoolValIsMutable(); + boolVal_.setBoolean(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param value The boolVal to add. + * @return This builder for chaining. + */ + public Builder addBoolVal(boolean value) { + + ensureBoolValIsMutable(); + boolVal_.addBoolean(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param values The boolVal to add. + * @return This builder for chaining. + */ + public Builder addAllBoolVal(java.lang.Iterable values) { + ensureBoolValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, boolVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return This builder for chaining. + */ + public Builder clearBoolVal() { + boolVal_ = emptyBooleanList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList stringVal_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureStringValIsMutable() { + if (!stringVal_.isModifiable()) { + stringVal_ = new com.google.protobuf.LazyStringArrayList(stringVal_); + } + bitField0_ |= 0x00000008; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + public com.google.protobuf.ProtocolStringList getStringValList() { + stringVal_.makeImmutable(); + return stringVal_; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + public int getStringValCount() { + return stringVal_.size(); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + public java.lang.String getStringVal(int index) { + return stringVal_.get(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + public com.google.protobuf.ByteString getStringValBytes(int index) { + return stringVal_.getByteString(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index to set the value at. + * @param value The stringVal to set. + * @return This builder for chaining. + */ + public Builder setStringVal(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringValIsMutable(); + stringVal_.set(index, value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param value The stringVal to add. + * @return This builder for chaining. + */ + public Builder addStringVal(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringValIsMutable(); + stringVal_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param values The stringVal to add. + * @return This builder for chaining. + */ + public Builder addAllStringVal(java.lang.Iterable values) { + ensureStringValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, stringVal_); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return This builder for chaining. + */ + public Builder clearStringVal() { + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param value The bytes of the stringVal to add. + * @return This builder for chaining. + */ + public Builder addStringValBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureStringValIsMutable(); + stringVal_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.util.List bytesVal_ = + java.util.Collections.emptyList(); + + private void ensureBytesValIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + bytesVal_ = new java.util.ArrayList(bytesVal_); + bitField0_ |= 0x00000010; + } + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + public java.util.List getBytesValList() { + return ((bitField0_ & 0x00000010) != 0) + ? java.util.Collections.unmodifiableList(bytesVal_) + : bytesVal_; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + public int getBytesValCount() { + return bytesVal_.size(); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + public com.google.protobuf.ByteString getBytesVal(int index) { + return bytesVal_.get(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index to set the value at. + * @param value The bytesVal to set. + * @return This builder for chaining. + */ + public Builder setBytesVal(int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBytesValIsMutable(); + bytesVal_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param value The bytesVal to add. + * @return This builder for chaining. + */ + public Builder addBytesVal(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBytesValIsMutable(); + bytesVal_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param values The bytesVal to add. + * @return This builder for chaining. + */ + public Builder addAllBytesVal( + java.lang.Iterable values) { + ensureBytesValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, bytesVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return This builder for chaining. + */ + public Builder clearBytesVal() { + bytesVal_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.FloatList floatVal_ = emptyFloatList(); + + private void ensureFloatValIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + floatVal_ = mutableCopy(floatVal_); + bitField0_ |= 0x00000020; + } + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + public java.util.List getFloatValList() { + return ((bitField0_ & 0x00000020) != 0) + ? java.util.Collections.unmodifiableList(floatVal_) + : floatVal_; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + public int getFloatValCount() { + return floatVal_.size(); + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + public float getFloatVal(int index) { + return floatVal_.getFloat(index); + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param index The index to set the value at. + * @param value The floatVal to set. + * @return This builder for chaining. + */ + public Builder setFloatVal(int index, float value) { + + ensureFloatValIsMutable(); + floatVal_.setFloat(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param value The floatVal to add. + * @return This builder for chaining. + */ + public Builder addFloatVal(float value) { + + ensureFloatValIsMutable(); + floatVal_.addFloat(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param values The floatVal to add. + * @return This builder for chaining. + */ + public Builder addAllFloatVal(java.lang.Iterable values) { + ensureFloatValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, floatVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return This builder for chaining. + */ + public Builder clearFloatVal() { + floatVal_ = emptyFloatList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList doubleVal_ = emptyDoubleList(); + + private void ensureDoubleValIsMutable() { + if (!((bitField0_ & 0x00000040) != 0)) { + doubleVal_ = mutableCopy(doubleVal_); + bitField0_ |= 0x00000040; + } + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + public java.util.List getDoubleValList() { + return ((bitField0_ & 0x00000040) != 0) + ? java.util.Collections.unmodifiableList(doubleVal_) + : doubleVal_; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + public int getDoubleValCount() { + return doubleVal_.size(); + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + public double getDoubleVal(int index) { + return doubleVal_.getDouble(index); + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param index The index to set the value at. + * @param value The doubleVal to set. + * @return This builder for chaining. + */ + public Builder setDoubleVal(int index, double value) { + + ensureDoubleValIsMutable(); + doubleVal_.setDouble(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param value The doubleVal to add. + * @return This builder for chaining. + */ + public Builder addDoubleVal(double value) { + + ensureDoubleValIsMutable(); + doubleVal_.addDouble(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param values The doubleVal to add. + * @return This builder for chaining. + */ + public Builder addAllDoubleVal(java.lang.Iterable values) { + ensureDoubleValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, doubleVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return This builder for chaining. + */ + public Builder clearDoubleVal() { + doubleVal_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.IntList intVal_ = emptyIntList(); + + private void ensureIntValIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + intVal_ = mutableCopy(intVal_); + bitField0_ |= 0x00000080; + } + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + public java.util.List getIntValList() { + return ((bitField0_ & 0x00000080) != 0) + ? java.util.Collections.unmodifiableList(intVal_) + : intVal_; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + public int getIntValCount() { + return intVal_.size(); + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + public int getIntVal(int index) { + return intVal_.getInt(index); + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index to set the value at. + * @param value The intVal to set. + * @return This builder for chaining. + */ + public Builder setIntVal(int index, int value) { + + ensureIntValIsMutable(); + intVal_.setInt(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param value The intVal to add. + * @return This builder for chaining. + */ + public Builder addIntVal(int value) { + + ensureIntValIsMutable(); + intVal_.addInt(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param values The intVal to add. + * @return This builder for chaining. + */ + public Builder addAllIntVal(java.lang.Iterable values) { + ensureIntValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, intVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return This builder for chaining. + */ + public Builder clearIntVal() { + intVal_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList int64Val_ = emptyLongList(); + + private void ensureInt64ValIsMutable() { + if (!((bitField0_ & 0x00000100) != 0)) { + int64Val_ = mutableCopy(int64Val_); + bitField0_ |= 0x00000100; + } + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + public java.util.List getInt64ValList() { + return ((bitField0_ & 0x00000100) != 0) + ? java.util.Collections.unmodifiableList(int64Val_) + : int64Val_; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + public int getInt64ValCount() { + return int64Val_.size(); + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + public long getInt64Val(int index) { + return int64Val_.getLong(index); + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index to set the value at. + * @param value The int64Val to set. + * @return This builder for chaining. + */ + public Builder setInt64Val(int index, long value) { + + ensureInt64ValIsMutable(); + int64Val_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param value The int64Val to add. + * @return This builder for chaining. + */ + public Builder addInt64Val(long value) { + + ensureInt64ValIsMutable(); + int64Val_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param values The int64Val to add. + * @return This builder for chaining. + */ + public Builder addAllInt64Val(java.lang.Iterable values) { + ensureInt64ValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, int64Val_); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return This builder for chaining. + */ + public Builder clearInt64Val() { + int64Val_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.IntList uintVal_ = emptyIntList(); + + private void ensureUintValIsMutable() { + if (!((bitField0_ & 0x00000200) != 0)) { + uintVal_ = mutableCopy(uintVal_); + bitField0_ |= 0x00000200; + } + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + public java.util.List getUintValList() { + return ((bitField0_ & 0x00000200) != 0) + ? java.util.Collections.unmodifiableList(uintVal_) + : uintVal_; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + public int getUintValCount() { + return uintVal_.size(); + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + public int getUintVal(int index) { + return uintVal_.getInt(index); + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index to set the value at. + * @param value The uintVal to set. + * @return This builder for chaining. + */ + public Builder setUintVal(int index, int value) { + + ensureUintValIsMutable(); + uintVal_.setInt(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param value The uintVal to add. + * @return This builder for chaining. + */ + public Builder addUintVal(int value) { + + ensureUintValIsMutable(); + uintVal_.addInt(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param values The uintVal to add. + * @return This builder for chaining. + */ + public Builder addAllUintVal(java.lang.Iterable values) { + ensureUintValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, uintVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return This builder for chaining. + */ + public Builder clearUintVal() { + uintVal_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000200); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList uint64Val_ = emptyLongList(); + + private void ensureUint64ValIsMutable() { + if (!((bitField0_ & 0x00000400) != 0)) { + uint64Val_ = mutableCopy(uint64Val_); + bitField0_ |= 0x00000400; + } + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + public java.util.List getUint64ValList() { + return ((bitField0_ & 0x00000400) != 0) + ? java.util.Collections.unmodifiableList(uint64Val_) + : uint64Val_; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + public int getUint64ValCount() { + return uint64Val_.size(); + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + public long getUint64Val(int index) { + return uint64Val_.getLong(index); + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index to set the value at. + * @param value The uint64Val to set. + * @return This builder for chaining. + */ + public Builder setUint64Val(int index, long value) { + + ensureUint64ValIsMutable(); + uint64Val_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param value The uint64Val to add. + * @return This builder for chaining. + */ + public Builder addUint64Val(long value) { + + ensureUint64ValIsMutable(); + uint64Val_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param values The uint64Val to add. + * @return This builder for chaining. + */ + public Builder addAllUint64Val(java.lang.Iterable values) { + ensureUint64ValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, uint64Val_); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return This builder for chaining. + */ + public Builder clearUint64Val() { + uint64Val_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000400); + onChanged(); + return this; + } + + private java.util.List listVal_ = + java.util.Collections.emptyList(); + + private void ensureListValIsMutable() { + if (!((bitField0_ & 0x00000800) != 0)) { + listVal_ = new java.util.ArrayList(listVal_); + bitField0_ |= 0x00000800; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + listValBuilder_; + + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public java.util.List getListValList() { + if (listValBuilder_ == null) { + return java.util.Collections.unmodifiableList(listVal_); + } else { + return listValBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public int getListValCount() { + if (listValBuilder_ == null) { + return listVal_.size(); + } else { + return listValBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1.Tensor getListVal(int index) { + if (listValBuilder_ == null) { + return listVal_.get(index); + } else { + return listValBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder setListVal(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.set(index, value); + onChanged(); + } else { + listValBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder setListVal( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.set(index, builderForValue.build()); + onChanged(); + } else { + listValBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder addListVal(com.google.cloud.aiplatform.v1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.add(value); + onChanged(); + } else { + listValBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder addListVal(int index, com.google.cloud.aiplatform.v1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.add(index, value); + onChanged(); + } else { + listValBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder addListVal(com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(builderForValue.build()); + onChanged(); + } else { + listValBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder addListVal( + int index, com.google.cloud.aiplatform.v1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(index, builderForValue.build()); + onChanged(); + } else { + listValBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder addAllListVal( + java.lang.Iterable values) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, listVal_); + onChanged(); + } else { + listValBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder clearListVal() { + if (listValBuilder_ == null) { + listVal_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000800); + onChanged(); + } else { + listValBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public Builder removeListVal(int index) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.remove(index); + onChanged(); + } else { + listValBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getListValBuilder(int index) { + return getListValFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getListValOrBuilder(int index) { + if (listValBuilder_ == null) { + return listVal_.get(index); + } else { + return listValBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public java.util.List + getListValOrBuilderList() { + if (listValBuilder_ != null) { + return listValBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(listVal_); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addListValBuilder() { + return getListValFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addListValBuilder(int index) { + return getListValFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + public java.util.List getListValBuilderList() { + return getListValFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getListValFieldBuilder() { + if (listValBuilder_ == null) { + listValBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + listVal_, ((bitField0_ & 0x00000800) != 0), getParentForChildren(), isClean()); + listVal_ = null; + } + return listValBuilder_; + } + + private com.google.protobuf.MapField + structVal_; + + private com.google.protobuf.MapField + internalGetStructVal() { + if (structVal_ == null) { + return com.google.protobuf.MapField.emptyMapField(StructValDefaultEntryHolder.defaultEntry); + } + return structVal_; + } + + private com.google.protobuf.MapField + internalGetMutableStructVal() { + if (structVal_ == null) { + structVal_ = + com.google.protobuf.MapField.newMapField(StructValDefaultEntryHolder.defaultEntry); + } + if (!structVal_.isMutable()) { + structVal_ = structVal_.copy(); + } + bitField0_ |= 0x00001000; + onChanged(); + return structVal_; + } + + public int getStructValCount() { + return internalGetStructVal().getMap().size(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public boolean containsStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetStructVal().getMap().containsKey(key); + } + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getStructVal() { + return getStructValMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public java.util.Map + getStructValMap() { + return internalGetStructVal().getMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public /* nullable */ com.google.cloud.aiplatform.v1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1.Tensor defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getStructValOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearStructVal() { + bitField0_ = (bitField0_ & ~0x00001000); + internalGetMutableStructVal().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + public Builder removeStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableStructVal().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableStructVal() { + bitField0_ |= 0x00001000; + return internalGetMutableStructVal().getMutableMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + public Builder putStructVal(java.lang.String key, com.google.cloud.aiplatform.v1.Tensor value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableStructVal().getMutableMap().put(key, value); + bitField0_ |= 0x00001000; + return this; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + public Builder putAllStructVal( + java.util.Map values) { + internalGetMutableStructVal().getMutableMap().putAll(values); + bitField0_ |= 0x00001000; + return this; + } + + private com.google.protobuf.ByteString tensorVal_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTensorVal() { + return tensorVal_; + } + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @param value The tensorVal to set. + * @return This builder for chaining. + */ + public Builder setTensorVal(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + tensorVal_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @return This builder for chaining. + */ + public Builder clearTensorVal() { + bitField0_ = (bitField0_ & ~0x00002000); + tensorVal_ = getDefaultInstance().getTensorVal(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.Tensor) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.Tensor) + private static final com.google.cloud.aiplatform.v1.Tensor DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.Tensor(); + } + + public static com.google.cloud.aiplatform.v1.Tensor getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Tensor parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TensorOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TensorOrBuilder.java new file mode 100644 index 000000000000..7d035f7153fa --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TensorOrBuilder.java @@ -0,0 +1,593 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/types.proto + +package com.google.cloud.aiplatform.v1; + +public interface TensorOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.Tensor) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + int getDtypeValue(); + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + com.google.cloud.aiplatform.v1.Tensor.DataType getDtype(); + + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + java.util.List getShapeList(); + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + int getShapeCount(); + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + long getShape(int index); + + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + java.util.List getBoolValList(); + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + int getBoolValCount(); + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + boolean getBoolVal(int index); + + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + java.util.List getStringValList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + int getStringValCount(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + java.lang.String getStringVal(int index); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + com.google.protobuf.ByteString getStringValBytes(int index); + + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + java.util.List getBytesValList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + int getBytesValCount(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + com.google.protobuf.ByteString getBytesVal(int index); + + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + java.util.List getFloatValList(); + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + int getFloatValCount(); + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + float getFloatVal(int index); + + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + java.util.List getDoubleValList(); + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + int getDoubleValCount(); + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + double getDoubleVal(int index); + + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + java.util.List getIntValList(); + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + int getIntValCount(); + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + int getIntVal(int index); + + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + java.util.List getInt64ValList(); + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + int getInt64ValCount(); + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + long getInt64Val(int index); + + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + java.util.List getUintValList(); + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + int getUintValCount(); + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + int getUintVal(int index); + + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + java.util.List getUint64ValList(); + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + int getUint64ValCount(); + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + long getUint64Val(int index); + + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + java.util.List getListValList(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + com.google.cloud.aiplatform.v1.Tensor getListVal(int index); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + int getListValCount(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + java.util.List + getListValOrBuilderList(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor list_val = 11; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getListValOrBuilder(int index); + + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + int getStructValCount(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + boolean containsStructVal(java.lang.String key); + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Deprecated + java.util.Map getStructVal(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + java.util.Map getStructValMap(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + /* nullable */ + com.google.cloud.aiplatform.v1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1.Tensor defaultValue); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1.Tensor> struct_val = 12; + */ + com.google.cloud.aiplatform.v1.Tensor getStructValOrThrow(java.lang.String key); + + /** + * + * + *
+   * Serialized raw tensor content.
+   * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + com.google.protobuf.ByteString getTensorVal(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TypesProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TypesProto.java index d848e5115e11..2be8fdb044cc 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TypesProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/TypesProto.java @@ -43,6 +43,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1_StringArray_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1_StringArray_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_Tensor_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_Tensor_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -56,12 +64,29 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\022\032google.cloud.aiplatform.v1\"\033\n\tBoolArra" + "y\022\016\n\006values\030\001 \003(\010\"\035\n\013DoubleArray\022\016\n\006valu" + "es\030\001 \003(\001\"\034\n\nInt64Array\022\016\n\006values\030\001 \003(\003\"\035" - + "\n\013StringArray\022\016\n\006values\030\001 \003(\tB\310\001\n\036com.go" - + "ogle.cloud.aiplatform.v1B\nTypesProtoP\001Z>" - + "cloud.google.com/go/aiplatform/apiv1/aip" - + "latformpb;aiplatformpb\252\002\032Google.Cloud.AI" - + "Platform.V1\312\002\032Google\\Cloud\\AIPlatform\\V1" - + "\352\002\035Google::Cloud::AIPlatform::V1b\006proto3" + + "\n\013StringArray\022\016\n\006values\030\001 \003(\t\"\223\005\n\006Tensor" + + "\022:\n\005dtype\030\001 \001(\0162+.google.cloud.aiplatfor" + + "m.v1.Tensor.DataType\022\r\n\005shape\030\002 \003(\003\022\020\n\010b" + + "ool_val\030\003 \003(\010\022\022\n\nstring_val\030\016 \003(\t\022\021\n\tbyt" + + "es_val\030\017 \003(\014\022\021\n\tfloat_val\030\005 \003(\002\022\022\n\ndoubl" + + "e_val\030\006 \003(\001\022\017\n\007int_val\030\007 \003(\005\022\021\n\tint64_va" + + "l\030\010 \003(\003\022\020\n\010uint_val\030\t \003(\r\022\022\n\nuint64_val\030" + + "\n \003(\004\0224\n\010list_val\030\013 \003(\0132\".google.cloud.a" + + "iplatform.v1.Tensor\022E\n\nstruct_val\030\014 \003(\0132" + + "1.google.cloud.aiplatform.v1.Tensor.Stru" + + "ctValEntry\022\022\n\ntensor_val\030\r \001(\014\032T\n\016Struct" + + "ValEntry\022\013\n\003key\030\001 \001(\t\0221\n\005value\030\002 \001(\0132\".g" + + "oogle.cloud.aiplatform.v1.Tensor:\0028\001\"\254\001\n" + + "\010DataType\022\031\n\025DATA_TYPE_UNSPECIFIED\020\000\022\010\n\004" + + "BOOL\020\001\022\n\n\006STRING\020\002\022\t\n\005FLOAT\020\003\022\n\n\006DOUBLE\020" + + "\004\022\010\n\004INT8\020\005\022\t\n\005INT16\020\006\022\t\n\005INT32\020\007\022\t\n\005INT" + + "64\020\010\022\t\n\005UINT8\020\t\022\n\n\006UINT16\020\n\022\n\n\006UINT32\020\013\022" + + "\n\n\006UINT64\020\014B\310\001\n\036com.google.cloud.aiplatf" + + "orm.v1B\nTypesProtoP\001Z>cloud.google.com/g" + + "o/aiplatform/apiv1/aiplatformpb;aiplatfo" + + "rmpb\252\002\032Google.Cloud.AIPlatform.V1\312\002\032Goog" + + "le\\Cloud\\AIPlatform\\V1\352\002\035Google::Cloud::" + + "AIPlatform::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -98,6 +123,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Values", }); + internal_static_google_cloud_aiplatform_v1_Tensor_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1_Tensor_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_Tensor_descriptor, + new java.lang.String[] { + "Dtype", + "Shape", + "BoolVal", + "StringVal", + "BytesVal", + "FloatVal", + "DoubleVal", + "IntVal", + "Int64Val", + "UintVal", + "Uint64Val", + "ListVal", + "StructVal", + "TensorVal", + }); + internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_descriptor = + internal_static_google_cloud_aiplatform_v1_Tensor_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_Tensor_StructValEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequest.java new file mode 100644 index 000000000000..8f8a307b7ae3 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequest.java @@ -0,0 +1,1051 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [ScheduleService.UpdateSchedule][google.cloud.aiplatform.v1.ScheduleService.UpdateSchedule].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.UpdateScheduleRequest} + */ +public final class UpdateScheduleRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.UpdateScheduleRequest) + UpdateScheduleRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateScheduleRequest.newBuilder() to construct. + private UpdateScheduleRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateScheduleRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateScheduleRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest.class, + com.google.cloud.aiplatform.v1.UpdateScheduleRequest.Builder.class); + } + + public static final int SCHEDULE_FIELD_NUMBER = 1; + private com.google.cloud.aiplatform.v1.Schedule schedule_; + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + @java.lang.Override + public boolean hasSchedule() { + return schedule_ != null; + } + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Schedule getSchedule() { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder() { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (schedule_ != null) { + output.writeMessage(1, getSchedule()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (schedule_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSchedule()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1.UpdateScheduleRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.UpdateScheduleRequest other = + (com.google.cloud.aiplatform.v1.UpdateScheduleRequest) obj; + + if (hasSchedule() != other.hasSchedule()) return false; + if (hasSchedule()) { + if (!getSchedule().equals(other.getSchedule())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasSchedule()) { + hash = (37 * hash) + SCHEDULE_FIELD_NUMBER; + hash = (53 * hash) + getSchedule().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1.UpdateScheduleRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [ScheduleService.UpdateSchedule][google.cloud.aiplatform.v1.ScheduleService.UpdateSchedule].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.UpdateScheduleRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.UpdateScheduleRequest) + com.google.cloud.aiplatform.v1.UpdateScheduleRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.UpdateScheduleRequest.class, + com.google.cloud.aiplatform.v1.UpdateScheduleRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.UpdateScheduleRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + schedule_ = null; + if (scheduleBuilder_ != null) { + scheduleBuilder_.dispose(); + scheduleBuilder_ = null; + } + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1.ScheduleServiceProto + .internal_static_google_cloud_aiplatform_v1_UpdateScheduleRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.UpdateScheduleRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.UpdateScheduleRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.UpdateScheduleRequest build() { + com.google.cloud.aiplatform.v1.UpdateScheduleRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.UpdateScheduleRequest buildPartial() { + com.google.cloud.aiplatform.v1.UpdateScheduleRequest result = + new com.google.cloud.aiplatform.v1.UpdateScheduleRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.UpdateScheduleRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.schedule_ = scheduleBuilder_ == null ? schedule_ : scheduleBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1.UpdateScheduleRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.UpdateScheduleRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.UpdateScheduleRequest other) { + if (other == com.google.cloud.aiplatform.v1.UpdateScheduleRequest.getDefaultInstance()) + return this; + if (other.hasSchedule()) { + mergeSchedule(other.getSchedule()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getScheduleFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.aiplatform.v1.Schedule schedule_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + scheduleBuilder_; + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + public boolean hasSchedule() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + public com.google.cloud.aiplatform.v1.Schedule getSchedule() { + if (scheduleBuilder_ == null) { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } else { + return scheduleBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSchedule(com.google.cloud.aiplatform.v1.Schedule value) { + if (scheduleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schedule_ = value; + } else { + scheduleBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSchedule(com.google.cloud.aiplatform.v1.Schedule.Builder builderForValue) { + if (scheduleBuilder_ == null) { + schedule_ = builderForValue.build(); + } else { + scheduleBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeSchedule(com.google.cloud.aiplatform.v1.Schedule value) { + if (scheduleBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && schedule_ != null + && schedule_ != com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance()) { + getScheduleBuilder().mergeFrom(value); + } else { + schedule_ = value; + } + } else { + scheduleBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearSchedule() { + bitField0_ = (bitField0_ & ~0x00000001); + schedule_ = null; + if (scheduleBuilder_ != null) { + scheduleBuilder_.dispose(); + scheduleBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.aiplatform.v1.Schedule.Builder getScheduleBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getScheduleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder() { + if (scheduleBuilder_ != null) { + return scheduleBuilder_.getMessageOrBuilder(); + } else { + return schedule_ == null + ? com.google.cloud.aiplatform.v1.Schedule.getDefaultInstance() + : schedule_; + } + } + /** + * + * + *
+     * Required. The Schedule which replaces the resource on the server.
+     * The following restrictions will be applied:
+     *   * The scheduled request type cannot be changed.
+     *   * The output_only fields will be ignored if specified.
+     * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder> + getScheduleFieldBuilder() { + if (scheduleBuilder_ == null) { + scheduleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Schedule, + com.google.cloud.aiplatform.v1.Schedule.Builder, + com.google.cloud.aiplatform.v1.ScheduleOrBuilder>( + getSchedule(), getParentForChildren(), isClean()); + schedule_ = null; + } + return scheduleBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + } else { + updateMaskBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); + } else { + updateMask_ = value; + } + } else { + updateMaskBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUpdateMask() { + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Required. The update mask applies to the resource. See
+     * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1.UpdateScheduleRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.UpdateScheduleRequest) + private static final com.google.cloud.aiplatform.v1.UpdateScheduleRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.UpdateScheduleRequest(); + } + + public static com.google.cloud.aiplatform.v1.UpdateScheduleRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateScheduleRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.UpdateScheduleRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequestOrBuilder.java new file mode 100644 index 000000000000..c88de1f1ec83 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/UpdateScheduleRequestOrBuilder.java @@ -0,0 +1,116 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1/schedule_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface UpdateScheduleRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.UpdateScheduleRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the schedule field is set. + */ + boolean hasSchedule(); + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The schedule. + */ + com.google.cloud.aiplatform.v1.Schedule getSchedule(); + /** + * + * + *
+   * Required. The Schedule which replaces the resource on the server.
+   * The following restrictions will be applied:
+   *   * The scheduled request type cannot be changed.
+   *   * The output_only fields will be ignored if specified.
+   * 
+ * + * + * .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.aiplatform.v1.ScheduleOrBuilder getScheduleOrBuilder(); + + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Required. The update mask applies to the resource. See
+   * [google.protobuf.FieldMask][google.protobuf.FieldMask].
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto index 16dadb28af81..52b5d6df6154 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; import "google/api/resource.proto"; import "google/cloud/aiplatform/v1/explanation.proto"; +import "google/cloud/aiplatform/v1/types.proto"; import "google/protobuf/struct.proto"; option csharp_namespace = "Google.Cloud.AIPlatform.V1"; @@ -74,6 +75,20 @@ service PredictionService { option (google.api.method_signature) = "endpoint,http_body"; } + // Perform a server-side streaming online prediction request for Vertex + // LLM streaming. + rpc ServerStreamingPredict(StreamingPredictRequest) + returns (stream StreamingPredictResponse) { + option (google.api.http) = { + post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:serverStreamingPredict" + body: "*" + additional_bindings { + post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:serverStreamingPredict" + body: "*" + } + }; + } + // Perform an online explanation. // // If @@ -158,6 +173,11 @@ message PredictResponse { // name][google.cloud.aiplatform.v1.Model.display_name] of the Model which is // deployed as the DeployedModel that this prediction hits. string model_display_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Request-level metadata returned by the model. The metadata + // type will be dependent upon the model implementation. + google.protobuf.Value metadata = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Request message for @@ -191,6 +211,40 @@ message RawPredictRequest { google.api.HttpBody http_body = 2; } +// Request message for +// [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict]. +// +// The first message must contain +// [endpoint][google.cloud.aiplatform.v1.StreamingPredictRequest.endpoint] field +// and optionally [input][]. The subsequent messages must contain [input][]. +message StreamingPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // The prediction input. + repeated Tensor inputs = 2; + + // The parameters that govern the prediction. + Tensor parameters = 3; +} + +// Response message for +// [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict]. +message StreamingPredictResponse { + // The prediction output. + repeated Tensor outputs = 1; + + // The parameters that govern the prediction. + Tensor parameters = 2; +} + // Request message for // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain]. message ExplainRequest { diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule.proto new file mode 100644 index 000000000000..b66e735ac64e --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule.proto @@ -0,0 +1,172 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.aiplatform.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/aiplatform/v1/pipeline_service.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.AIPlatform.V1"; +option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb"; +option java_multiple_files = true; +option java_outer_classname = "ScheduleProto"; +option java_package = "com.google.cloud.aiplatform.v1"; +option php_namespace = "Google\\Cloud\\AIPlatform\\V1"; +option ruby_package = "Google::Cloud::AIPlatform::V1"; + +// An instance of a Schedule periodically schedules runs to make API calls based +// on user specified time specification and API request type. +message Schedule { + option (google.api.resource) = { + type: "aiplatform.googleapis.com/Schedule" + pattern: "projects/{project}/locations/{location}/schedules/{schedule}" + }; + + // Status of a scheduled run. + message RunResponse { + // The scheduled run time based on the user-specified schedule. + google.protobuf.Timestamp scheduled_run_time = 1; + + // The response of the scheduled run. + string run_response = 2; + } + + // Possible state of the schedule. + enum State { + // Unspecified. + STATE_UNSPECIFIED = 0; + + // The Schedule is active. Runs are being scheduled on the user-specified + // timespec. + ACTIVE = 1; + + // The schedule is paused. No new runs will be created until the schedule + // is resumed. Already started runs will be allowed to complete. + PAUSED = 2; + + // The Schedule is completed. No new runs will be scheduled. Already started + // runs will be allowed to complete. Schedules in completed state cannot be + // paused or resumed. + COMPLETED = 3; + } + + // Required. + // The time specification to launch scheduled runs. + oneof time_specification { + // Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled + // runs. To explicitly set a timezone to the cron tab, apply a prefix in the + // cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}". + // The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone + // database. For example, "CRON_TZ=America/New_York 1 * * * *", or + // "TZ=America/New_York 1 * * * *". + string cron = 10; + } + + // Required. + // The API request template to launch the scheduled runs. + // User-specified ID is not supported in the request template. + oneof request { + // Request for + // [PipelineService.CreatePipelineJob][google.cloud.aiplatform.v1.PipelineService.CreatePipelineJob]. + // CreatePipelineJobRequest.parent field is required (format: + // projects/{project}/locations/{location}). + CreatePipelineJobRequest create_pipeline_job_request = 14; + } + + // Output only. The resource name of the Schedule. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. User provided name of the Schedule. + // The name can be up to 128 characters long and can consist of any UTF-8 + // characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Timestamp after which the first run can be scheduled. + // Default to Schedule create time if not specified. + google.protobuf.Timestamp start_time = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Timestamp after which no new runs can be scheduled. + // If specified, The schedule will be completed when either + // end_time is reached or when scheduled_run_count >= max_run_count. + // If not specified, new runs will keep getting scheduled until this Schedule + // is paused or deleted. Already scheduled runs will be allowed to complete. + // Unset if not specified. + google.protobuf.Timestamp end_time = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Maximum run count of the schedule. + // If specified, The schedule will be completed when either + // started_run_count >= max_run_count or when end_time is reached. + // If not specified, new runs will keep getting scheduled until this Schedule + // is paused or deleted. Already scheduled runs will be allowed to complete. + // Unset if not specified. + int64 max_run_count = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The number of runs started by this schedule. + int64 started_run_count = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this Schedule. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when this Schedule was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when this Schedule was updated. + google.protobuf.Timestamp update_time = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when this Schedule should schedule the next run. + // Having a next_run_time in the past means the runs are being started + // behind schedule. + google.protobuf.Timestamp next_run_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when this Schedule was last paused. + // Unset if never paused. + google.protobuf.Timestamp last_pause_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when this Schedule was last resumed. + // Unset if never resumed from pause. + google.protobuf.Timestamp last_resume_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Maximum number of runs that can be started concurrently for this + // Schedule. This is the limit for starting the scheduled requests and not the + // execution of the operations/jobs created by the requests (if applicable). + int64 max_concurrent_run_count = 11 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether new scheduled runs can be queued when max_concurrent_runs + // limit is reached. If set to true, new runs will be queued instead of + // skipped. Default to false. + bool allow_queueing = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Whether to backfill missed runs when the schedule is resumed + // from PAUSED state. If set to true, all missed runs will be scheduled. New + // runs will be scheduled after the backfill is complete. Default to false. + bool catch_up = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Response of the last scheduled run. + // This is the response for starting the scheduled requests and not the + // execution of the operations/jobs created by the requests (if applicable). + // Unset if no run has been scheduled yet. + RunResponse last_scheduled_run_response = 18 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule_service.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule_service.proto new file mode 100644 index 000000000000..19ffc2b89537 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/schedule_service.proto @@ -0,0 +1,307 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.aiplatform.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/aiplatform/v1/operation.proto"; +import "google/cloud/aiplatform/v1/schedule.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.AIPlatform.V1"; +option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb"; +option java_multiple_files = true; +option java_outer_classname = "ScheduleServiceProto"; +option java_package = "com.google.cloud.aiplatform.v1"; +option php_namespace = "Google\\Cloud\\AIPlatform\\V1"; +option ruby_package = "Google::Cloud::AIPlatform::V1"; + +// A service for creating and managing Vertex AI's Schedule resources to +// periodically launch shceudled runs to make API calls. +service ScheduleService { + option (google.api.default_host) = "aiplatform.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Schedule. + rpc CreateSchedule(CreateScheduleRequest) returns (Schedule) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/schedules" + body: "schedule" + }; + option (google.api.method_signature) = "parent,schedule"; + } + + // Deletes a Schedule. + rpc DeleteSchedule(DeleteScheduleRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/schedules/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteOperationMetadata" + }; + } + + // Gets a Schedule. + rpc GetSchedule(GetScheduleRequest) returns (Schedule) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/schedules/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Schedules in a Location. + rpc ListSchedules(ListSchedulesRequest) returns (ListSchedulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/schedules" + }; + option (google.api.method_signature) = "parent"; + } + + // Pauses a Schedule. Will mark + // [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If + // the schedule is paused, no new runs will be created. Already created runs + // will NOT be paused or canceled. + rpc PauseSchedule(PauseScheduleRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/schedules/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resumes a paused Schedule to start scheduling new runs. Will mark + // [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. + // Only paused Schedule can be resumed. + // + // When the Schedule is resumed, new runs will be scheduled starting from the + // next execution time after the current time based on the time_specification + // in the Schedule. If [Schedule.catchUp][] is set up true, all + // missed runs will be scheduled for backfill first. + rpc ResumeSchedule(ResumeScheduleRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/schedules/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,catch_up"; + } + + // Updates an active or paused Schedule. + // + // When the Schedule is updated, new runs will be scheduled starting from the + // updated next execution time after the update time based on the + // time_specification in the updated Schedule. All unstarted runs before the + // update time will be skipped while already created runs will NOT be paused + // or canceled. + rpc UpdateSchedule(UpdateScheduleRequest) returns (Schedule) { + option (google.api.http) = { + patch: "/v1/{schedule.name=projects/*/locations/*/schedules/*}" + body: "schedule" + }; + option (google.api.method_signature) = "schedule,update_mask"; + } +} + +// Request message for +// [ScheduleService.CreateSchedule][google.cloud.aiplatform.v1.ScheduleService.CreateSchedule]. +message CreateScheduleRequest { + // Required. The resource name of the Location to create the Schedule in. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The Schedule to create. + Schedule schedule = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ScheduleService.GetSchedule][google.cloud.aiplatform.v1.ScheduleService.GetSchedule]. +message GetScheduleRequest { + // Required. The name of the Schedule resource. + // Format: + // `projects/{project}/locations/{location}/schedules/{schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Schedule" + } + ]; +} + +// Request message for +// [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules]. +message ListSchedulesRequest { + // Required. The resource name of the Location to list the Schedules from. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Lists the Schedules that match the filter expression. The following + // fields are supported: + // + // * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard. + // * `state`: Supports `=` and `!=` comparisons. + // * `request`: Supports existence of the check. + // (e.g. `create_pipeline_job_request:*` --> Schedule has + // create_pipeline_job_request). + // * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. + // Values must be in RFC 3339 format. + // * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. + // Values must be in RFC 3339 format. + // * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*` + // existence check. Values must be in RFC 3339 format. + // * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` + // comparisons. Values must be in RFC 3339 format. + // + // + // Filter expressions can be combined together using logical operators + // (`NOT`, `AND` & `OR`). + // The syntax to define filter expression is based on + // https://google.aip.dev/160. + // + // Examples: + // + // * `state="ACTIVE" AND display_name:"my_schedule_*"` + // * `NOT display_name="my_schedule"` + // * `create_time>"2021-05-18T00:00:00Z"` + // * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*` + // * `create_pipeline_job_request:*` + string filter = 2; + + // The standard list page size. + // Default to 100 if not specified. + int32 page_size = 3; + + // The standard list page token. + // Typically obtained via + // [ListSchedulesResponse.next_page_token][google.cloud.aiplatform.v1.ListSchedulesResponse.next_page_token] + // of the previous + // [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules] + // call. + string page_token = 4; + + // A comma-separated list of fields to order by. The default sort order is in + // ascending order. Use "desc" after a field name for descending. You can have + // multiple order_by fields provided. + // + // For example, using "create_time desc, end_time" will order results by + // create time in descending order, and if there are multiple schedules having + // the same create time, order them by the end time in ascending order. + // + // If order_by is not specified, it will order by default with create_time in + // descending order. + // + // Supported fields: + // * `create_time` + // * `start_time` + // * `end_time` + // * `next_run_time` + string order_by = 5; +} + +// Response message for +// [ScheduleService.ListSchedules][google.cloud.aiplatform.v1.ScheduleService.ListSchedules] +message ListSchedulesResponse { + // List of Schedules in the requested page. + repeated Schedule schedules = 1; + + // A token to retrieve the next page of results. + // Pass to + // [ListSchedulesRequest.page_token][google.cloud.aiplatform.v1.ListSchedulesRequest.page_token] + // to obtain that page. + string next_page_token = 2; +} + +// Request message for +// [ScheduleService.DeleteSchedule][google.cloud.aiplatform.v1.ScheduleService.DeleteSchedule]. +message DeleteScheduleRequest { + // Required. The name of the Schedule resource to be deleted. + // Format: + // `projects/{project}/locations/{location}/schedules/{schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Schedule" + } + ]; +} + +// Request message for +// [ScheduleService.PauseSchedule][google.cloud.aiplatform.v1.ScheduleService.PauseSchedule]. +message PauseScheduleRequest { + // Required. The name of the Schedule resource to be paused. + // Format: + // `projects/{project}/locations/{location}/schedules/{schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Schedule" + } + ]; +} + +// Request message for +// [ScheduleService.ResumeSchedule][google.cloud.aiplatform.v1.ScheduleService.ResumeSchedule]. +message ResumeScheduleRequest { + // Required. The name of the Schedule resource to be resumed. + // Format: + // `projects/{project}/locations/{location}/schedules/{schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Schedule" + } + ]; + + // Optional. Whether to backfill missed runs when the schedule is resumed from + // PAUSED state. If set to true, all missed runs will be scheduled. New runs + // will be scheduled after the backfill is complete. This will also update + // [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field. + // Default to false. + bool catch_up = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [ScheduleService.UpdateSchedule][google.cloud.aiplatform.v1.ScheduleService.UpdateSchedule]. +message UpdateScheduleRequest { + // Required. The Schedule which replaces the resource on the server. + // The following restrictions will be applied: + // * The scheduled request type cannot be changed. + // * The output_only fields will be ignored if specified. + Schedule schedule = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The update mask applies to the resource. See + // [google.protobuf.FieldMask][google.protobuf.FieldMask]. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/types.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/types.proto index 532638e4474b..16ab0139d3c4 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/types.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/types.proto @@ -47,3 +47,90 @@ message StringArray { // A list of string values. repeated string values = 1; } + +// A tensor value type. +message Tensor { + // Data type of the tensor. + enum DataType { + // Not a legal value for DataType. Used to indicate a DataType field has not + // been set. + DATA_TYPE_UNSPECIFIED = 0; + + // Data types that all computation devices are expected to be + // capable to support. + BOOL = 1; + + STRING = 2; + + FLOAT = 3; + + DOUBLE = 4; + + INT8 = 5; + + INT16 = 6; + + INT32 = 7; + + INT64 = 8; + + UINT8 = 9; + + UINT16 = 10; + + UINT32 = 11; + + UINT64 = 12; + } + + // The data type of tensor. + DataType dtype = 1; + + // Shape of the tensor. + repeated int64 shape = 2; + + // Type specific representations that make it easy to create tensor protos in + // all languages. Only the representation corresponding to "dtype" can + // be set. The values hold the flattened representation of the tensor in + // row major order. + // + // [BOOL][google.aiplatform.master.Tensor.DataType.BOOL] + repeated bool bool_val = 3; + + // [STRING][google.aiplatform.master.Tensor.DataType.STRING] + repeated string string_val = 14; + + // [STRING][google.aiplatform.master.Tensor.DataType.STRING] + repeated bytes bytes_val = 15; + + // [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT] + repeated float float_val = 5; + + // [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE] + repeated double double_val = 6; + + // [INT_8][google.aiplatform.master.Tensor.DataType.INT8] + // [INT_16][google.aiplatform.master.Tensor.DataType.INT16] + // [INT_32][google.aiplatform.master.Tensor.DataType.INT32] + repeated int32 int_val = 7; + + // [INT64][google.aiplatform.master.Tensor.DataType.INT64] + repeated int64 int64_val = 8; + + // [UINT8][google.aiplatform.master.Tensor.DataType.UINT8] + // [UINT16][google.aiplatform.master.Tensor.DataType.UINT16] + // [UINT32][google.aiplatform.master.Tensor.DataType.UINT32] + repeated uint32 uint_val = 9; + + // [UINT64][google.aiplatform.master.Tensor.DataType.UINT64] + repeated uint64 uint64_val = 10; + + // A list of tensor values. + repeated Tensor list_val = 11; + + // A map of string to tensor. + map struct_val = 12; + + // Serialized raw tensor content. + bytes tensor_val = 13; +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResource.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResource.java index a4000ef6a631..0adb603014cc 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResource.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResource.java @@ -298,10 +298,10 @@ private State(int value) { * * *
-   * Output only. Resource name of a PersistentResource.
+   * Immutable. Resource name of a PersistentResource.
    * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The name. */ @@ -321,10 +321,10 @@ public java.lang.String getName() { * * *
-   * Output only. Resource name of a PersistentResource.
+   * Immutable. Resource name of a PersistentResource.
    * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The bytes for name. */ @@ -1053,6 +1053,63 @@ public com.google.cloud.aiplatform.v1beta1.ResourceRuntimeSpec getResourceRuntim : resourceRuntimeSpec_; } + public static final int RESOURCE_RUNTIME_FIELD_NUMBER = 14; + private com.google.cloud.aiplatform.v1beta1.ResourceRuntime resourceRuntime_; + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resourceRuntime field is set. + */ + @java.lang.Override + public boolean hasResourceRuntime() { + return resourceRuntime_ != null; + } + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resourceRuntime. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime getResourceRuntime() { + return resourceRuntime_ == null + ? com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance() + : resourceRuntime_; + } + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder + getResourceRuntimeOrBuilder() { + return resourceRuntime_ == null + ? com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance() + : resourceRuntime_; + } + public static final int RESERVED_IP_RANGES_FIELD_NUMBER = 15; @SuppressWarnings("serial") @@ -1196,6 +1253,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (resourceRuntimeSpec_ != null) { output.writeMessage(13, getResourceRuntimeSpec()); } + if (resourceRuntime_ != null) { + output.writeMessage(14, getResourceRuntime()); + } for (int i = 0; i < reservedIpRanges_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 15, reservedIpRanges_.getRaw(i)); } @@ -1254,6 +1314,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getResourceRuntimeSpec()); } + if (resourceRuntime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getResourceRuntime()); + } { int dataSize = 0; for (int i = 0; i < reservedIpRanges_.size(); i++) { @@ -1308,6 +1371,10 @@ public boolean equals(final java.lang.Object obj) { if (hasResourceRuntimeSpec()) { if (!getResourceRuntimeSpec().equals(other.getResourceRuntimeSpec())) return false; } + if (hasResourceRuntime() != other.hasResourceRuntime()) return false; + if (hasResourceRuntime()) { + if (!getResourceRuntime().equals(other.getResourceRuntime())) return false; + } if (!getReservedIpRangesList().equals(other.getReservedIpRangesList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; @@ -1360,6 +1427,10 @@ public int hashCode() { hash = (37 * hash) + RESOURCE_RUNTIME_SPEC_FIELD_NUMBER; hash = (53 * hash) + getResourceRuntimeSpec().hashCode(); } + if (hasResourceRuntime()) { + hash = (37 * hash) + RESOURCE_RUNTIME_FIELD_NUMBER; + hash = (53 * hash) + getResourceRuntime().hashCode(); + } if (getReservedIpRangesCount() > 0) { hash = (37 * hash) + RESERVED_IP_RANGES_FIELD_NUMBER; hash = (53 * hash) + getReservedIpRangesList().hashCode(); @@ -1569,6 +1640,11 @@ public Builder clear() { resourceRuntimeSpecBuilder_.dispose(); resourceRuntimeSpecBuilder_ = null; } + resourceRuntime_ = null; + if (resourceRuntimeBuilder_ != null) { + resourceRuntimeBuilder_.dispose(); + resourceRuntimeBuilder_ = null; + } reservedIpRanges_ = com.google.protobuf.LazyStringArrayList.emptyList(); return this; } @@ -1659,6 +1735,10 @@ private void buildPartial0(com.google.cloud.aiplatform.v1beta1.PersistentResourc : resourceRuntimeSpecBuilder_.build(); } if (((from_bitField0_ & 0x00001000) != 0)) { + result.resourceRuntime_ = + resourceRuntimeBuilder_ == null ? resourceRuntime_ : resourceRuntimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00002000) != 0)) { reservedIpRanges_.makeImmutable(); result.reservedIpRanges_ = reservedIpRanges_; } @@ -1775,10 +1855,13 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.PersistentResource if (other.hasResourceRuntimeSpec()) { mergeResourceRuntimeSpec(other.getResourceRuntimeSpec()); } + if (other.hasResourceRuntime()) { + mergeResourceRuntime(other.getResourceRuntime()); + } if (!other.reservedIpRanges_.isEmpty()) { if (reservedIpRanges_.isEmpty()) { reservedIpRanges_ = other.reservedIpRanges_; - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; } else { ensureReservedIpRangesIsMutable(); reservedIpRanges_.addAll(other.reservedIpRanges_); @@ -1898,6 +1981,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000800; break; } // case 106 + case 114: + { + input.readMessage(getResourceRuntimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00001000; + break; + } // case 114 case 122: { java.lang.String s = input.readStringRequireUtf8(); @@ -1929,10 +2018,10 @@ public Builder mergeFrom( * * *
-     * Output only. Resource name of a PersistentResource.
+     * Immutable. Resource name of a PersistentResource.
      * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The name. */ @@ -1951,10 +2040,10 @@ public java.lang.String getName() { * * *
-     * Output only. Resource name of a PersistentResource.
+     * Immutable. Resource name of a PersistentResource.
      * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The bytes for name. */ @@ -1973,10 +2062,10 @@ public com.google.protobuf.ByteString getNameBytes() { * * *
-     * Output only. Resource name of a PersistentResource.
+     * Immutable. Resource name of a PersistentResource.
      * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @param value The name to set. * @return This builder for chaining. @@ -1994,10 +2083,10 @@ public Builder setName(java.lang.String value) { * * *
-     * Output only. Resource name of a PersistentResource.
+     * Immutable. Resource name of a PersistentResource.
      * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return This builder for chaining. */ @@ -2011,10 +2100,10 @@ public Builder clearName() { * * *
-     * Output only. Resource name of a PersistentResource.
+     * Immutable. Resource name of a PersistentResource.
      * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @param value The bytes for name to set. * @return This builder for chaining. @@ -4262,6 +4351,210 @@ public Builder clearResourceRuntimeSpec() { return resourceRuntimeSpecBuilder_; } + private com.google.cloud.aiplatform.v1beta1.ResourceRuntime resourceRuntime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.ResourceRuntime, + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder, + com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder> + resourceRuntimeBuilder_; + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resourceRuntime field is set. + */ + public boolean hasResourceRuntime() { + return ((bitField0_ & 0x00001000) != 0); + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resourceRuntime. + */ + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime getResourceRuntime() { + if (resourceRuntimeBuilder_ == null) { + return resourceRuntime_ == null + ? com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance() + : resourceRuntime_; + } else { + return resourceRuntimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setResourceRuntime(com.google.cloud.aiplatform.v1beta1.ResourceRuntime value) { + if (resourceRuntimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resourceRuntime_ = value; + } else { + resourceRuntimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setResourceRuntime( + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder builderForValue) { + if (resourceRuntimeBuilder_ == null) { + resourceRuntime_ = builderForValue.build(); + } else { + resourceRuntimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeResourceRuntime(com.google.cloud.aiplatform.v1beta1.ResourceRuntime value) { + if (resourceRuntimeBuilder_ == null) { + if (((bitField0_ & 0x00001000) != 0) + && resourceRuntime_ != null + && resourceRuntime_ + != com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance()) { + getResourceRuntimeBuilder().mergeFrom(value); + } else { + resourceRuntime_ = value; + } + } else { + resourceRuntimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearResourceRuntime() { + bitField0_ = (bitField0_ & ~0x00001000); + resourceRuntime_ = null; + if (resourceRuntimeBuilder_ != null) { + resourceRuntimeBuilder_.dispose(); + resourceRuntimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder getResourceRuntimeBuilder() { + bitField0_ |= 0x00001000; + onChanged(); + return getResourceRuntimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder + getResourceRuntimeOrBuilder() { + if (resourceRuntimeBuilder_ != null) { + return resourceRuntimeBuilder_.getMessageOrBuilder(); + } else { + return resourceRuntime_ == null + ? com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance() + : resourceRuntime_; + } + } + /** + * + * + *
+     * Output only. Runtime information of the Persistent Resource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.ResourceRuntime, + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder, + com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder> + getResourceRuntimeFieldBuilder() { + if (resourceRuntimeBuilder_ == null) { + resourceRuntimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.ResourceRuntime, + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder, + com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder>( + getResourceRuntime(), getParentForChildren(), isClean()); + resourceRuntime_ = null; + } + return resourceRuntimeBuilder_; + } + private com.google.protobuf.LazyStringArrayList reservedIpRanges_ = com.google.protobuf.LazyStringArrayList.emptyList(); @@ -4269,7 +4562,7 @@ private void ensureReservedIpRangesIsMutable() { if (!reservedIpRanges_.isModifiable()) { reservedIpRanges_ = new com.google.protobuf.LazyStringArrayList(reservedIpRanges_); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; } /** * @@ -4389,7 +4682,7 @@ public Builder setReservedIpRanges(int index, java.lang.String value) { } ensureReservedIpRangesIsMutable(); reservedIpRanges_.set(index, value); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; onChanged(); return this; } @@ -4419,7 +4712,7 @@ public Builder addReservedIpRanges(java.lang.String value) { } ensureReservedIpRangesIsMutable(); reservedIpRanges_.add(value); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; onChanged(); return this; } @@ -4446,7 +4739,7 @@ public Builder addReservedIpRanges(java.lang.String value) { public Builder addAllReservedIpRanges(java.lang.Iterable values) { ensureReservedIpRangesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, reservedIpRanges_); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; onChanged(); return this; } @@ -4471,7 +4764,7 @@ public Builder addAllReservedIpRanges(java.lang.Iterable value */ public Builder clearReservedIpRanges() { reservedIpRanges_ = com.google.protobuf.LazyStringArrayList.emptyList(); - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00002000); ; onChanged(); return this; @@ -4503,7 +4796,7 @@ public Builder addReservedIpRangesBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureReservedIpRangesIsMutable(); reservedIpRanges_.add(value); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; onChanged(); return this; } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceOrBuilder.java index 22bc1ee22e31..03a056ce9c37 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceOrBuilder.java @@ -27,10 +27,10 @@ public interface PersistentResourceOrBuilder * * *
-   * Output only. Resource name of a PersistentResource.
+   * Immutable. Resource name of a PersistentResource.
    * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The name. */ @@ -39,10 +39,10 @@ public interface PersistentResourceOrBuilder * * *
-   * Output only. Resource name of a PersistentResource.
+   * Immutable. Resource name of a PersistentResource.
    * 
* - * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * * @return The bytes for name. */ @@ -565,6 +565,47 @@ java.lang.String getLabelsOrDefault( com.google.cloud.aiplatform.v1beta1.ResourceRuntimeSpecOrBuilder getResourceRuntimeSpecOrBuilder(); + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resourceRuntime field is set. + */ + boolean hasResourceRuntime(); + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resourceRuntime. + */ + com.google.cloud.aiplatform.v1beta1.ResourceRuntime getResourceRuntime(); + /** + * + * + *
+   * Output only. Runtime information of the Persistent Resource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder getResourceRuntimeOrBuilder(); + /** * * diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceProto.java index 30eb28943dd6..117364e8b1f1 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PersistentResourceProto.java @@ -47,6 +47,18 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntimeSpec_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntimeSpec_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_RaySpec_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1beta1_ServiceAccountSpec_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -68,8 +80,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "c.proto\0327google/cloud/aiplatform/v1beta1" + "/machine_resources.proto\032\037google/protobu" + "f/timestamp.proto\032\027google/rpc/status.pro" - + "to\"\233\010\n\022PersistentResource\022\022\n\004name\030\001 \001(\tB" - + "\004\342A\001\003\022\032\n\014display_name\030\002 \001(\tB\004\342A\001\001\022K\n\016res" + + "to\"\355\010\n\022PersistentResource\022\022\n\004name\030\001 \001(\tB" + + "\004\342A\001\005\022\032\n\014display_name\030\002 \001(\tB\004\342A\001\001\022K\n\016res" + "ource_pools\030\004 \003(\0132-.google.cloud.aiplatf" + "orm.v1beta1.ResourcePoolB\004\342A\001\002\022N\n\005state\030" + "\005 \001(\01629.google.cloud.aiplatform.v1beta1." @@ -86,40 +98,48 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\014 \001(\0132/.google.cloud.aiplatform.v1beta1." + "EncryptionSpecB\004\342A\001\001\022Y\n\025resource_runtime" + "_spec\030\r \001(\01324.google.cloud.aiplatform.v1" - + "beta1.ResourceRuntimeSpecB\004\342A\001\001\022 \n\022reser" - + "ved_ip_ranges\030\017 \003(\tB\004\342A\001\001\032-\n\013LabelsEntry" - + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"V\n\005Stat" - + "e\022\025\n\021STATE_UNSPECIFIED\020\000\022\020\n\014PROVISIONING" - + "\020\001\022\013\n\007RUNNING\020\003\022\014\n\010STOPPING\020\004\022\t\n\005ERROR\020\005" - + ":\205\001\352A\201\001\n,aiplatform.googleapis.com/Persi" - + "stentResource\022Qprojects/{project}/locati" - + "ons/{location}/persistentResources/{pers" - + "istent_resource}\"\224\004\n\014ResourcePool\022\020\n\002id\030" - + "\001 \001(\tB\004\342A\001\001\022I\n\014machine_spec\030\002 \001(\0132,.goog" - + "le.cloud.aiplatform.v1beta1.MachineSpecB" - + "\005\342A\002\002\005\022 \n\rreplica_count\030\003 \001(\003B\004\342A\001\001H\000\210\001\001" - + "\022B\n\tdisk_spec\030\004 \001(\0132).google.cloud.aipla" - + "tform.v1beta1.DiskSpecB\004\342A\001\001\022\"\n\022idle_rep" - + "lica_count\030\005 \001(\003B\006\030\001\342A\001\003\022 \n\022used_replica" - + "_count\030\006 \001(\003B\004\342A\001\003\022]\n\020autoscaling_spec\030\007" - + " \001(\0132=.google.cloud.aiplatform.v1beta1.R" - + "esourcePool.AutoscalingSpecB\004\342A\001\001\032\211\001\n\017Au" - + "toscalingSpec\022$\n\021min_replica_count\030\001 \001(\003" - + "B\004\342A\001\001H\000\210\001\001\022$\n\021max_replica_count\030\002 \001(\003B\004" - + "\342A\001\001H\001\210\001\001B\024\n\022_min_replica_countB\024\n\022_max_" - + "replica_countB\020\n\016_replica_count\"n\n\023Resou" - + "rceRuntimeSpec\022W\n\024service_account_spec\030\002" - + " \001(\01323.google.cloud.aiplatform.v1beta1.S" - + "erviceAccountSpecB\004\342A\001\001\"`\n\022ServiceAccoun" - + "tSpec\022+\n\035enable_custom_service_account\030\001" - + " \001(\010B\004\342A\001\002\022\035\n\017service_account\030\002 \001(\tB\004\342A\001" - + "\001B\356\001\n#com.google.cloud.aiplatform.v1beta" - + "1B\027PersistentResourceProtoP\001ZCcloud.goog" - + "le.com/go/aiplatform/apiv1beta1/aiplatfo" - + "rmpb;aiplatformpb\252\002\037Google.Cloud.AIPlatf" - + "orm.V1Beta1\312\002\037Google\\Cloud\\AIPlatform\\V1" - + "beta1\352\002\"Google::Cloud::AIPlatform::V1bet" - + "a1b\006proto3" + + "beta1.ResourceRuntimeSpecB\004\342A\001\001\022P\n\020resou" + + "rce_runtime\030\016 \001(\01320.google.cloud.aiplatf" + + "orm.v1beta1.ResourceRuntimeB\004\342A\001\003\022 \n\022res" + + "erved_ip_ranges\030\017 \003(\tB\004\342A\001\001\032-\n\013LabelsEnt" + + "ry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"V\n\005St" + + "ate\022\025\n\021STATE_UNSPECIFIED\020\000\022\020\n\014PROVISIONI" + + "NG\020\001\022\013\n\007RUNNING\020\003\022\014\n\010STOPPING\020\004\022\t\n\005ERROR" + + "\020\005:\205\001\352A\201\001\n,aiplatform.googleapis.com/Per" + + "sistentResource\022Qprojects/{project}/loca" + + "tions/{location}/persistentResources/{pe" + + "rsistent_resource}\"\224\004\n\014ResourcePool\022\020\n\002i" + + "d\030\001 \001(\tB\004\342A\001\001\022I\n\014machine_spec\030\002 \001(\0132,.go" + + "ogle.cloud.aiplatform.v1beta1.MachineSpe" + + "cB\005\342A\002\002\005\022 \n\rreplica_count\030\003 \001(\003B\004\342A\001\001H\000\210" + + "\001\001\022B\n\tdisk_spec\030\004 \001(\0132).google.cloud.aip" + + "latform.v1beta1.DiskSpecB\004\342A\001\001\022\"\n\022idle_r" + + "eplica_count\030\005 \001(\003B\006\030\001\342A\001\003\022 \n\022used_repli" + + "ca_count\030\006 \001(\003B\004\342A\001\003\022]\n\020autoscaling_spec" + + "\030\007 \001(\0132=.google.cloud.aiplatform.v1beta1" + + ".ResourcePool.AutoscalingSpecB\004\342A\001\001\032\211\001\n\017" + + "AutoscalingSpec\022$\n\021min_replica_count\030\001 \001" + + "(\003B\004\342A\001\001H\000\210\001\001\022$\n\021max_replica_count\030\002 \001(\003" + + "B\004\342A\001\001H\001\210\001\001B\024\n\022_min_replica_countB\024\n\022_ma" + + "x_replica_countB\020\n\016_replica_count\"\260\001\n\023Re" + + "sourceRuntimeSpec\022W\n\024service_account_spe" + + "c\030\002 \001(\01323.google.cloud.aiplatform.v1beta" + + "1.ServiceAccountSpecB\004\342A\001\001\022@\n\010ray_spec\030\001" + + " \001(\0132(.google.cloud.aiplatform.v1beta1.R" + + "aySpecB\004\342A\001\001\"\"\n\007RaySpec\022\027\n\timage_uri\030\001 \001" + + "(\tB\004\342A\001\001\"\241\001\n\017ResourceRuntime\022[\n\013access_u" + + "ris\030\001 \003(\0132@.google.cloud.aiplatform.v1be" + + "ta1.ResourceRuntime.AccessUrisEntryB\004\342A\001" + + "\003\0321\n\017AccessUrisEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005val" + + "ue\030\002 \001(\t:\0028\001\"`\n\022ServiceAccountSpec\022+\n\035en" + + "able_custom_service_account\030\001 \001(\010B\004\342A\001\002\022" + + "\035\n\017service_account\030\002 \001(\tB\004\342A\001\001B\356\001\n#com.g" + + "oogle.cloud.aiplatform.v1beta1B\027Persiste" + + "ntResourceProtoP\001ZCcloud.google.com/go/a" + + "iplatform/apiv1beta1/aiplatformpb;aiplat" + + "formpb\252\002\037Google.Cloud.AIPlatform.V1Beta1" + + "\312\002\037Google\\Cloud\\AIPlatform\\V1beta1\352\002\"Goo" + + "gle::Cloud::AIPlatform::V1beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -150,6 +170,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Network", "EncryptionSpec", "ResourceRuntimeSpec", + "ResourceRuntime", "ReservedIpRanges", }); internal_static_google_cloud_aiplatform_v1beta1_PersistentResource_LabelsEntry_descriptor = @@ -193,10 +214,36 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntimeSpec_descriptor, new java.lang.String[] { - "ServiceAccountSpec", + "ServiceAccountSpec", "RaySpec", }); - internal_static_google_cloud_aiplatform_v1beta1_ServiceAccountSpec_descriptor = + internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1beta1_RaySpec_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor, + new java.lang.String[] { + "ImageUri", + }); + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor, + new java.lang.String[] { + "AccessUris", + }); + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_descriptor = + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_aiplatform_v1beta1_ServiceAccountSpec_descriptor = + getDescriptor().getMessageTypes().get(5); internal_static_google_cloud_aiplatform_v1beta1_ServiceAccountSpec_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ServiceAccountSpec_descriptor, diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponse.java index f1e44e568901..872c344c51b4 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponse.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponse.java @@ -379,6 +379,55 @@ public com.google.protobuf.ByteString getModelDisplayNameBytes() { } } + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Value metadata_; + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return metadata_ != null; + } + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Value getMetadata() { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + @java.lang.Override + public com.google.protobuf.ValueOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -408,6 +457,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelVersionId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, modelVersionId_); } + if (metadata_ != null) { + output.writeMessage(6, getMetadata()); + } getUnknownFields().writeTo(output); } @@ -432,6 +484,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelVersionId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, modelVersionId_); } + if (metadata_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getMetadata()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -453,6 +508,10 @@ public boolean equals(final java.lang.Object obj) { if (!getModel().equals(other.getModel())) return false; if (!getModelVersionId().equals(other.getModelVersionId())) return false; if (!getModelDisplayName().equals(other.getModelDisplayName())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata().equals(other.getMetadata())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -476,6 +535,10 @@ public int hashCode() { hash = (53 * hash) + getModelVersionId().hashCode(); hash = (37 * hash) + MODEL_DISPLAY_NAME_FIELD_NUMBER; hash = (53 * hash) + getModelDisplayName().hashCode(); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -627,6 +690,11 @@ public Builder clear() { model_ = ""; modelVersionId_ = ""; modelDisplayName_ = ""; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } return this; } @@ -689,6 +757,9 @@ private void buildPartial0(com.google.cloud.aiplatform.v1beta1.PredictResponse r if (((from_bitField0_ & 0x00000010) != 0)) { result.modelDisplayName_ = modelDisplayName_; } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null ? metadata_ : metadataBuilder_.build(); + } } @java.lang.Override @@ -784,6 +855,9 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.PredictResponse oth bitField0_ |= 0x00000010; onChanged(); } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -846,6 +920,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000008; break; } // case 42 + case 50: + { + input.readMessage(getMetadataFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1755,6 +1835,203 @@ public Builder setModelDisplayNameBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.protobuf.Value metadata_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder> + metadataBuilder_; + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The metadata. + */ + public com.google.protobuf.Value getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMetadata(com.google.protobuf.Value value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMetadata(com.google.protobuf.Value.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeMetadata(com.google.protobuf.Value value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && metadata_ != null + && metadata_ != com.google.protobuf.Value.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Value.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.ValueOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? com.google.protobuf.Value.getDefaultInstance() : metadata_; + } + } + /** + * + * + *
+     * Output only. Request-level metadata returned by the model. The metadata
+     * type will be dependent upon the model implementation.
+     * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder> + getMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Value, + com.google.protobuf.Value.Builder, + com.google.protobuf.ValueOrBuilder>( + getMetadata(), getParentForChildren(), isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponseOrBuilder.java index b5f9a36fd19d..173086e7d5c9 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponseOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictResponseOrBuilder.java @@ -210,4 +210,42 @@ public interface PredictResponseOrBuilder * @return The bytes for modelDisplayName. */ com.google.protobuf.ByteString getModelDisplayNameBytes(); + + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The metadata. + */ + com.google.protobuf.Value getMetadata(); + /** + * + * + *
+   * Output only. Request-level metadata returned by the model. The metadata
+   * type will be dependent upon the model implementation.
+   * 
+ * + * .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + com.google.protobuf.ValueOrBuilder getMetadataOrBuilder(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java index 5c05b49fe10f..e93edc201865 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java @@ -39,6 +39,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1beta1_RawPredictRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1beta1_RawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -63,60 +71,80 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ield_behavior.proto\032\031google/api/httpbody" + ".proto\032\031google/api/resource.proto\0321googl" + "e/cloud/aiplatform/v1beta1/explanation.p" - + "roto\032\034google/protobuf/struct.proto\"\254\001\n\016P" - + "redictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$" - + "\n\"aiplatform.googleapis.com/Endpoint\022/\n\t" - + "instances\030\002 \003(\0132\026.google.protobuf.ValueB" - + "\004\342A\001\002\022*\n\nparameters\030\003 \001(\0132\026.google.proto" - + "buf.Value\"\324\001\n\017PredictResponse\022+\n\013predict" - + "ions\030\001 \003(\0132\026.google.protobuf.Value\022\031\n\021de" - + "ployed_model_id\030\002 \001(\t\0227\n\005model\030\003 \001(\tB(\342A" - + "\001\003\372A!\n\037aiplatform.googleapis.com/Model\022\036" - + "\n\020model_version_id\030\005 \001(\tB\004\342A\001\003\022 \n\022model_" - + "display_name\030\004 \001(\tB\004\342A\001\003\"{\n\021RawPredictRe" - + "quest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplat" - + "form.googleapis.com/Endpoint\022\'\n\thttp_bod" - + "y\030\002 \001(\0132\024.google.api.HttpBody\"\244\002\n\016Explai" - + "nRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aip" - + "latform.googleapis.com/Endpoint\022/\n\tinsta" - + "nces\030\002 \003(\0132\026.google.protobuf.ValueB\004\342A\001\002" - + "\022*\n\nparameters\030\004 \001(\0132\026.google.protobuf.V" - + "alue\022[\n\031explanation_spec_override\030\005 \001(\0132" - + "8.google.cloud.aiplatform.v1beta1.Explan" - + "ationSpecOverride\022\031\n\021deployed_model_id\030\003" - + " \001(\t\"\235\001\n\017ExplainResponse\022B\n\014explanations" - + "\030\001 \003(\0132,.google.cloud.aiplatform.v1beta1" - + ".Explanation\022\031\n\021deployed_model_id\030\002 \001(\t\022" - + "+\n\013predictions\030\003 \003(\0132\026.google.protobuf.V" - + "alue2\211\007\n\021PredictionService\022\250\002\n\007Predict\022/" - + ".google.cloud.aiplatform.v1beta1.Predict" - + "Request\0320.google.cloud.aiplatform.v1beta" - + "1.PredictResponse\"\271\001\332A\035endpoint,instance" - + "s,parameters\202\323\344\223\002\222\001\">/v1beta1/{endpoint=" - + "projects/*/locations/*/endpoints/*}:pred" - + "ict:\001*ZM\"H/v1beta1/{endpoint=projects/*/" - + "locations/*/publishers/*/models/*}:predi" - + "ct:\001*\022\215\002\n\nRawPredict\0222.google.cloud.aipl" - + "atform.v1beta1.RawPredictRequest\032\024.googl" - + "e.api.HttpBody\"\264\001\332A\022endpoint,http_body\202\323" - + "\344\223\002\230\001\"A/v1beta1/{endpoint=projects/*/loc" - + "ations/*/endpoints/*}:rawPredict:\001*ZP\"K/" - + "v1beta1/{endpoint=projects/*/locations/*" - + "/publishers/*/models/*}:rawPredict:\001*\022\351\001" - + "\n\007Explain\022/.google.cloud.aiplatform.v1be" - + "ta1.ExplainRequest\0320.google.cloud.aiplat" - + "form.v1beta1.ExplainResponse\"{\332A/endpoin" - + "t,instances,parameters,deployed_model_id" - + "\202\323\344\223\002C\">/v1beta1/{endpoint=projects/*/lo" - + "cations/*/endpoints/*}:explain:\001*\032M\312A\031ai" - + "platform.googleapis.com\322A.https://www.go" - + "ogleapis.com/auth/cloud-platformB\355\001\n#com" - + ".google.cloud.aiplatform.v1beta1B\026Predic" - + "tionServiceProtoP\001ZCcloud.google.com/go/" - + "aiplatform/apiv1beta1/aiplatformpb;aipla" - + "tformpb\252\002\037Google.Cloud.AIPlatform.V1Beta" - + "1\312\002\037Google\\Cloud\\AIPlatform\\V1beta1\352\002\"Go" - + "ogle::Cloud::AIPlatform::V1beta1b\006proto3" + + "roto\032+google/cloud/aiplatform/v1beta1/ty" + + "pes.proto\032\034google/protobuf/struct.proto\"" + + "\254\001\n\016PredictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" + + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" + + "t\022/\n\tinstances\030\002 \003(\0132\026.google.protobuf.V" + + "alueB\004\342A\001\002\022*\n\nparameters\030\003 \001(\0132\026.google." + + "protobuf.Value\"\204\002\n\017PredictResponse\022+\n\013pr" + + "edictions\030\001 \003(\0132\026.google.protobuf.Value\022" + + "\031\n\021deployed_model_id\030\002 \001(\t\0227\n\005model\030\003 \001(" + + "\tB(\342A\001\003\372A!\n\037aiplatform.googleapis.com/Mo" + + "del\022\036\n\020model_version_id\030\005 \001(\tB\004\342A\001\003\022 \n\022m" + + "odel_display_name\030\004 \001(\tB\004\342A\001\003\022.\n\010metadat" + + "a\030\006 \001(\0132\026.google.protobuf.ValueB\004\342A\001\003\"{\n" + + "\021RawPredictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" + + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" + + "t\022\'\n\thttp_body\030\002 \001(\0132\024.google.api.HttpBo" + + "dy\"\316\001\n\027StreamingPredictRequest\022=\n\010endpoi" + + "nt\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis" + + ".com/Endpoint\0227\n\006inputs\030\002 \003(\0132\'.google.c" + + "loud.aiplatform.v1beta1.Tensor\022;\n\nparame" + + "ters\030\003 \001(\0132\'.google.cloud.aiplatform.v1b" + + "eta1.Tensor\"\221\001\n\030StreamingPredictResponse" + + "\0228\n\007outputs\030\001 \003(\0132\'.google.cloud.aiplatf" + + "orm.v1beta1.Tensor\022;\n\nparameters\030\002 \001(\0132\'" + + ".google.cloud.aiplatform.v1beta1.Tensor\"" + + "\244\002\n\016ExplainRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" + + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" + + "t\022/\n\tinstances\030\002 \003(\0132\026.google.protobuf.V" + + "alueB\004\342A\001\002\022*\n\nparameters\030\004 \001(\0132\026.google." + + "protobuf.Value\022[\n\031explanation_spec_overr" + + "ide\030\005 \001(\01328.google.cloud.aiplatform.v1be" + + "ta1.ExplanationSpecOverride\022\031\n\021deployed_" + + "model_id\030\003 \001(\t\"\235\001\n\017ExplainResponse\022B\n\014ex" + + "planations\030\001 \003(\0132,.google.cloud.aiplatfo" + + "rm.v1beta1.Explanation\022\031\n\021deployed_model" + + "_id\030\002 \001(\t\022+\n\013predictions\030\003 \003(\0132\026.google." + + "protobuf.Value2\325\t\n\021PredictionService\022\250\002\n" + + "\007Predict\022/.google.cloud.aiplatform.v1bet" + + "a1.PredictRequest\0320.google.cloud.aiplatf" + + "orm.v1beta1.PredictResponse\"\271\001\332A\035endpoin" + + "t,instances,parameters\202\323\344\223\002\222\001\">/v1beta1/" + + "{endpoint=projects/*/locations/*/endpoin" + + "ts/*}:predict:\001*ZM\"H/v1beta1/{endpoint=p" + + "rojects/*/locations/*/publishers/*/model" + + "s/*}:predict:\001*\022\215\002\n\nRawPredict\0222.google." + + "cloud.aiplatform.v1beta1.RawPredictReque" + + "st\032\024.google.api.HttpBody\"\264\001\332A\022endpoint,h" + + "ttp_body\202\323\344\223\002\230\001\"A/v1beta1/{endpoint=proj" + + "ects/*/locations/*/endpoints/*}:rawPredi" + + "ct:\001*ZP\"K/v1beta1/{endpoint=projects/*/l" + + "ocations/*/publishers/*/models/*}:rawPre" + + "dict:\001*\022\311\002\n\026ServerStreamingPredict\0228.goo" + + "gle.cloud.aiplatform.v1beta1.StreamingPr" + + "edictRequest\0329.google.cloud.aiplatform.v" + + "1beta1.StreamingPredictResponse\"\267\001\202\323\344\223\002\260" + + "\001\"M/v1beta1/{endpoint=projects/*/locatio" + + "ns/*/endpoints/*}:serverStreamingPredict" + + ":\001*Z\\\"W/v1beta1/{endpoint=projects/*/loc" + + "ations/*/publishers/*/models/*}:serverSt" + + "reamingPredict:\001*0\001\022\351\001\n\007Explain\022/.google" + + ".cloud.aiplatform.v1beta1.ExplainRequest" + + "\0320.google.cloud.aiplatform.v1beta1.Expla" + + "inResponse\"{\332A/endpoint,instances,parame" + + "ters,deployed_model_id\202\323\344\223\002C\">/v1beta1/{" + + "endpoint=projects/*/locations/*/endpoint" + + "s/*}:explain:\001*\032M\312A\031aiplatform.googleapi" + + "s.com\322A.https://www.googleapis.com/auth/" + + "cloud-platformB\355\001\n#com.google.cloud.aipl" + + "atform.v1beta1B\026PredictionServiceProtoP\001" + + "ZCcloud.google.com/go/aiplatform/apiv1be" + + "ta1/aiplatformpb;aiplatformpb\252\002\037Google.C" + + "loud.AIPlatform.V1Beta1\312\002\037Google\\Cloud\\A" + + "IPlatform\\V1beta1\352\002\"Google::Cloud::AIPla" + + "tform::V1beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -128,6 +156,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.HttpBodyProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.cloud.aiplatform.v1beta1.ExplanationProto.getDescriptor(), + com.google.cloud.aiplatform.v1beta1.TypesProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), }); internal_static_google_cloud_aiplatform_v1beta1_PredictRequest_descriptor = @@ -144,7 +173,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_PredictResponse_descriptor, new java.lang.String[] { - "Predictions", "DeployedModelId", "Model", "ModelVersionId", "ModelDisplayName", + "Predictions", + "DeployedModelId", + "Model", + "ModelVersionId", + "ModelDisplayName", + "Metadata", }); internal_static_google_cloud_aiplatform_v1beta1_RawPredictRequest_descriptor = getDescriptor().getMessageTypes().get(2); @@ -154,8 +188,24 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Endpoint", "HttpBody", }); - internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor = + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "Inputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor, + new java.lang.String[] { + "Outputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor = + getDescriptor().getMessageTypes().get(5); internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor, @@ -163,7 +213,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Instances", "Parameters", "ExplanationSpecOverride", "DeployedModelId", }); internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(6); internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_descriptor, @@ -186,6 +236,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.HttpBodyProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.cloud.aiplatform.v1beta1.ExplanationProto.getDescriptor(); + com.google.cloud.aiplatform.v1beta1.TypesProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpec.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpec.java new file mode 100644 index 000000000000..aef767347e04 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpec.java @@ -0,0 +1,664 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/persistent_resource.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Configuration information for the Ray cluster.
+ * For experimental launch, Ray cluster creation and Persistent
+ * cluster creation are 1:1 mapping: We will provision all the nodes within the
+ * Persistent cluster as Ray nodes.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.RaySpec} + */ +public final class RaySpec extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.RaySpec) + RaySpecOrBuilder { + private static final long serialVersionUID = 0L; + // Use RaySpec.newBuilder() to construct. + private RaySpec(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RaySpec() { + imageUri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RaySpec(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_RaySpec_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.RaySpec.class, + com.google.cloud.aiplatform.v1beta1.RaySpec.Builder.class); + } + + public static final int IMAGE_URI_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object imageUri_ = ""; + /** + * + * + *
+   * Optional. Default image for user to choose a preferred ML framework(e.g.
+   * tensorflow or Pytorch) by choosing from Vertex prebuild
+   * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+   * Either this or the resource_pool_images is required. Use this field if
+   * you need all the resource pools to have the same Ray image, Otherwise, use
+   * the {@code resource_pool_images} field.
+   * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The imageUri. + */ + @java.lang.Override + public java.lang.String getImageUri() { + java.lang.Object ref = imageUri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + imageUri_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Default image for user to choose a preferred ML framework(e.g.
+   * tensorflow or Pytorch) by choosing from Vertex prebuild
+   * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+   * Either this or the resource_pool_images is required. Use this field if
+   * you need all the resource pools to have the same Ray image, Otherwise, use
+   * the {@code resource_pool_images} field.
+   * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for imageUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getImageUriBytes() { + java.lang.Object ref = imageUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + imageUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(imageUri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, imageUri_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(imageUri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, imageUri_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.RaySpec)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.RaySpec other = + (com.google.cloud.aiplatform.v1beta1.RaySpec) obj; + + if (!getImageUri().equals(other.getImageUri())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + IMAGE_URI_FIELD_NUMBER; + hash = (53 * hash) + getImageUri().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1beta1.RaySpec prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configuration information for the Ray cluster.
+   * For experimental launch, Ray cluster creation and Persistent
+   * cluster creation are 1:1 mapping: We will provision all the nodes within the
+   * Persistent cluster as Ray nodes.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.RaySpec} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.RaySpec) + com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_RaySpec_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.RaySpec.class, + com.google.cloud.aiplatform.v1beta1.RaySpec.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.RaySpec.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + imageUri_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_RaySpec_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpec getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpec build() { + com.google.cloud.aiplatform.v1beta1.RaySpec result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpec buildPartial() { + com.google.cloud.aiplatform.v1beta1.RaySpec result = + new com.google.cloud.aiplatform.v1beta1.RaySpec(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.RaySpec result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.imageUri_ = imageUri_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.RaySpec) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.RaySpec) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.RaySpec other) { + if (other == com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance()) return this; + if (!other.getImageUri().isEmpty()) { + imageUri_ = other.imageUri_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + imageUri_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object imageUri_ = ""; + /** + * + * + *
+     * Optional. Default image for user to choose a preferred ML framework(e.g.
+     * tensorflow or Pytorch) by choosing from Vertex prebuild
+     * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+     * Either this or the resource_pool_images is required. Use this field if
+     * you need all the resource pools to have the same Ray image, Otherwise, use
+     * the {@code resource_pool_images} field.
+     * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The imageUri. + */ + public java.lang.String getImageUri() { + java.lang.Object ref = imageUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + imageUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Default image for user to choose a preferred ML framework(e.g.
+     * tensorflow or Pytorch) by choosing from Vertex prebuild
+     * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+     * Either this or the resource_pool_images is required. Use this field if
+     * you need all the resource pools to have the same Ray image, Otherwise, use
+     * the {@code resource_pool_images} field.
+     * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for imageUri. + */ + public com.google.protobuf.ByteString getImageUriBytes() { + java.lang.Object ref = imageUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + imageUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Default image for user to choose a preferred ML framework(e.g.
+     * tensorflow or Pytorch) by choosing from Vertex prebuild
+     * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+     * Either this or the resource_pool_images is required. Use this field if
+     * you need all the resource pools to have the same Ray image, Otherwise, use
+     * the {@code resource_pool_images} field.
+     * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The imageUri to set. + * @return This builder for chaining. + */ + public Builder setImageUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + imageUri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Default image for user to choose a preferred ML framework(e.g.
+     * tensorflow or Pytorch) by choosing from Vertex prebuild
+     * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+     * Either this or the resource_pool_images is required. Use this field if
+     * you need all the resource pools to have the same Ray image, Otherwise, use
+     * the {@code resource_pool_images} field.
+     * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearImageUri() { + imageUri_ = getDefaultInstance().getImageUri(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Default image for user to choose a preferred ML framework(e.g.
+     * tensorflow or Pytorch) by choosing from Vertex prebuild
+     * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+     * Either this or the resource_pool_images is required. Use this field if
+     * you need all the resource pools to have the same Ray image, Otherwise, use
+     * the {@code resource_pool_images} field.
+     * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for imageUri to set. + * @return This builder for chaining. + */ + public Builder setImageUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + imageUri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.RaySpec) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.RaySpec) + private static final com.google.cloud.aiplatform.v1beta1.RaySpec DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.RaySpec(); + } + + public static com.google.cloud.aiplatform.v1beta1.RaySpec getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RaySpec parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpec getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpecOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpecOrBuilder.java new file mode 100644 index 000000000000..08c879d8e6d0 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/RaySpecOrBuilder.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/persistent_resource.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface RaySpecOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.RaySpec) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. Default image for user to choose a preferred ML framework(e.g.
+   * tensorflow or Pytorch) by choosing from Vertex prebuild
+   * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+   * Either this or the resource_pool_images is required. Use this field if
+   * you need all the resource pools to have the same Ray image, Otherwise, use
+   * the {@code resource_pool_images} field.
+   * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The imageUri. + */ + java.lang.String getImageUri(); + /** + * + * + *
+   * Optional. Default image for user to choose a preferred ML framework(e.g.
+   * tensorflow or Pytorch) by choosing from Vertex prebuild
+   * images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
+   * Either this or the resource_pool_images is required. Use this field if
+   * you need all the resource pools to have the same Ray image, Otherwise, use
+   * the {@code resource_pool_images} field.
+   * 
+ * + * string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for imageUri. + */ + com.google.protobuf.ByteString getImageUriBytes(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePool.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePool.java index 4dcfae2881f9..d0eeffa1010b 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePool.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePool.java @@ -1059,7 +1059,7 @@ public com.google.cloud.aiplatform.v1beta1.DiskSpecOrBuilder getDiskSpecOrBuilde * * * @deprecated google.cloud.aiplatform.v1beta1.ResourcePool.idle_replica_count is deprecated. See - * google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=183 + * google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=187 * @return The idleReplicaCount. */ @java.lang.Override @@ -2259,7 +2259,7 @@ public com.google.cloud.aiplatform.v1beta1.DiskSpecOrBuilder getDiskSpecOrBuilde * * * @deprecated google.cloud.aiplatform.v1beta1.ResourcePool.idle_replica_count is deprecated. - * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=183 + * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=187 * @return The idleReplicaCount. */ @java.lang.Override @@ -2280,7 +2280,7 @@ public long getIdleReplicaCount() { * * * @deprecated google.cloud.aiplatform.v1beta1.ResourcePool.idle_replica_count is deprecated. - * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=183 + * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=187 * @param value The idleReplicaCount to set. * @return This builder for chaining. */ @@ -2305,7 +2305,7 @@ public Builder setIdleReplicaCount(long value) { * * * @deprecated google.cloud.aiplatform.v1beta1.ResourcePool.idle_replica_count is deprecated. - * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=183 + * See google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=187 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePoolOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePoolOrBuilder.java index f175fc376a0e..40492f788a34 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePoolOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourcePoolOrBuilder.java @@ -172,7 +172,7 @@ public interface ResourcePoolOrBuilder * * * @deprecated google.cloud.aiplatform.v1beta1.ResourcePool.idle_replica_count is deprecated. See - * google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=183 + * google/cloud/aiplatform/v1beta1/persistent_resource.proto;l=187 * @return The idleReplicaCount. */ @java.lang.Deprecated diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntime.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntime.java new file mode 100644 index 000000000000..5d2b8494999a --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntime.java @@ -0,0 +1,842 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/persistent_resource.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Persistent Cluster runtime information as output
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.ResourceRuntime} + */ +public final class ResourceRuntime extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.ResourceRuntime) + ResourceRuntimeOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResourceRuntime.newBuilder() to construct. + private ResourceRuntime(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResourceRuntime() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResourceRuntime(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetAccessUris(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.class, + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder.class); + } + + public static final int ACCESS_URIS_FIELD_NUMBER = 1; + + private static final class AccessUrisDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_AccessUrisEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField accessUris_; + + private com.google.protobuf.MapField internalGetAccessUris() { + if (accessUris_ == null) { + return com.google.protobuf.MapField.emptyMapField(AccessUrisDefaultEntryHolder.defaultEntry); + } + return accessUris_; + } + + public int getAccessUrisCount() { + return internalGetAccessUris().getMap().size(); + } + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public boolean containsAccessUris(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAccessUris().getMap().containsKey(key); + } + /** Use {@link #getAccessUrisMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAccessUris() { + return getAccessUrisMap(); + } + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.Map getAccessUrisMap() { + return internalGetAccessUris().getMap(); + } + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getAccessUrisOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAccessUris().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.lang.String getAccessUrisOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAccessUris().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAccessUris(), AccessUrisDefaultEntryHolder.defaultEntry, 1); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry : + internalGetAccessUris().getMap().entrySet()) { + com.google.protobuf.MapEntry accessUris__ = + AccessUrisDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, accessUris__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.ResourceRuntime)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.ResourceRuntime other = + (com.google.cloud.aiplatform.v1beta1.ResourceRuntime) obj; + + if (!internalGetAccessUris().equals(other.internalGetAccessUris())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetAccessUris().getMap().isEmpty()) { + hash = (37 * hash) + ACCESS_URIS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAccessUris().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1beta1.ResourceRuntime prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Persistent Cluster runtime information as output
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.ResourceRuntime} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.ResourceRuntime) + com.google.cloud.aiplatform.v1beta1.ResourceRuntimeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetAccessUris(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutableAccessUris(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.class, + com.google.cloud.aiplatform.v1beta1.ResourceRuntime.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.ResourceRuntime.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + internalGetMutableAccessUris().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PersistentResourceProto + .internal_static_google_cloud_aiplatform_v1beta1_ResourceRuntime_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime build() { + com.google.cloud.aiplatform.v1beta1.ResourceRuntime result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime buildPartial() { + com.google.cloud.aiplatform.v1beta1.ResourceRuntime result = + new com.google.cloud.aiplatform.v1beta1.ResourceRuntime(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.ResourceRuntime result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.accessUris_ = internalGetAccessUris(); + result.accessUris_.makeImmutable(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.ResourceRuntime) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.ResourceRuntime) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.ResourceRuntime other) { + if (other == com.google.cloud.aiplatform.v1beta1.ResourceRuntime.getDefaultInstance()) + return this; + internalGetMutableAccessUris().mergeFrom(other.internalGetAccessUris()); + bitField0_ |= 0x00000001; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.MapEntry accessUris__ = + input.readMessage( + AccessUrisDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAccessUris() + .getMutableMap() + .put(accessUris__.getKey(), accessUris__.getValue()); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField accessUris_; + + private com.google.protobuf.MapField + internalGetAccessUris() { + if (accessUris_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AccessUrisDefaultEntryHolder.defaultEntry); + } + return accessUris_; + } + + private com.google.protobuf.MapField + internalGetMutableAccessUris() { + if (accessUris_ == null) { + accessUris_ = + com.google.protobuf.MapField.newMapField(AccessUrisDefaultEntryHolder.defaultEntry); + } + if (!accessUris_.isMutable()) { + accessUris_ = accessUris_.copy(); + } + bitField0_ |= 0x00000001; + onChanged(); + return accessUris_; + } + + public int getAccessUrisCount() { + return internalGetAccessUris().getMap().size(); + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public boolean containsAccessUris(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAccessUris().getMap().containsKey(key); + } + /** Use {@link #getAccessUrisMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAccessUris() { + return getAccessUrisMap(); + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.Map getAccessUrisMap() { + return internalGetAccessUris().getMap(); + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getAccessUrisOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAccessUris().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.lang.String getAccessUrisOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAccessUris().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAccessUris() { + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutableAccessUris().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeAccessUris(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAccessUris().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAccessUris() { + bitField0_ |= 0x00000001; + return internalGetMutableAccessUris().getMutableMap(); + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder putAccessUris(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableAccessUris().getMutableMap().put(key, value); + bitField0_ |= 0x00000001; + return this; + } + /** + * + * + *
+     * Output only. URIs for user to connect to the Cluster.
+     * Example:
+     * {
+     *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+     *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+     * }
+     * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder putAllAccessUris(java.util.Map values) { + internalGetMutableAccessUris().getMutableMap().putAll(values); + bitField0_ |= 0x00000001; + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.ResourceRuntime) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.ResourceRuntime) + private static final com.google.cloud.aiplatform.v1beta1.ResourceRuntime DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.ResourceRuntime(); + } + + public static com.google.cloud.aiplatform.v1beta1.ResourceRuntime getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResourceRuntime parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.ResourceRuntime getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeOrBuilder.java new file mode 100644 index 000000000000..6678fa920ae1 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/persistent_resource.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface ResourceRuntimeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.ResourceRuntime) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getAccessUrisCount(); + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + boolean containsAccessUris(java.lang.String key); + /** Use {@link #getAccessUrisMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAccessUris(); + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.Map getAccessUrisMap(); + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + /* nullable */ + java.lang.String getAccessUrisOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Output only. URIs for user to connect to the Cluster.
+   * Example:
+   * {
+   *   "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001"
+   *   "RAY_DASHBOARD_URI": "ray-dashboard-address:8888"
+   * }
+   * 
+ * + * map<string, string> access_uris = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.lang.String getAccessUrisOrThrow(java.lang.String key); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpec.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpec.java index 47b84abc0c32..b7ff5f41c8a9 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpec.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpec.java @@ -120,6 +120,65 @@ public com.google.cloud.aiplatform.v1beta1.ServiceAccountSpec getServiceAccountS : serviceAccountSpec_; } + public static final int RAY_SPEC_FIELD_NUMBER = 1; + private com.google.cloud.aiplatform.v1beta1.RaySpec raySpec_; + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the raySpec field is set. + */ + @java.lang.Override + public boolean hasRaySpec() { + return raySpec_ != null; + } + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The raySpec. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpec getRaySpec() { + return raySpec_ == null + ? com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance() + : raySpec_; + } + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder getRaySpecOrBuilder() { + return raySpec_ == null + ? com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance() + : raySpec_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -134,6 +193,9 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (raySpec_ != null) { + output.writeMessage(1, getRaySpec()); + } if (serviceAccountSpec_ != null) { output.writeMessage(2, getServiceAccountSpec()); } @@ -146,6 +208,9 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; + if (raySpec_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getRaySpec()); + } if (serviceAccountSpec_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getServiceAccountSpec()); } @@ -169,6 +234,10 @@ public boolean equals(final java.lang.Object obj) { if (hasServiceAccountSpec()) { if (!getServiceAccountSpec().equals(other.getServiceAccountSpec())) return false; } + if (hasRaySpec() != other.hasRaySpec()) return false; + if (hasRaySpec()) { + if (!getRaySpec().equals(other.getRaySpec())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -184,6 +253,10 @@ public int hashCode() { hash = (37 * hash) + SERVICE_ACCOUNT_SPEC_FIELD_NUMBER; hash = (53 * hash) + getServiceAccountSpec().hashCode(); } + if (hasRaySpec()) { + hash = (37 * hash) + RAY_SPEC_FIELD_NUMBER; + hash = (53 * hash) + getRaySpec().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -332,6 +405,11 @@ public Builder clear() { serviceAccountSpecBuilder_.dispose(); serviceAccountSpecBuilder_ = null; } + raySpec_ = null; + if (raySpecBuilder_ != null) { + raySpecBuilder_.dispose(); + raySpecBuilder_ = null; + } return this; } @@ -374,6 +452,9 @@ private void buildPartial0(com.google.cloud.aiplatform.v1beta1.ResourceRuntimeSp ? serviceAccountSpec_ : serviceAccountSpecBuilder_.build(); } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.raySpec_ = raySpecBuilder_ == null ? raySpec_ : raySpecBuilder_.build(); + } } @java.lang.Override @@ -425,6 +506,9 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.ResourceRuntimeSpec if (other.hasServiceAccountSpec()) { mergeServiceAccountSpec(other.getServiceAccountSpec()); } + if (other.hasRaySpec()) { + mergeRaySpec(other.getRaySpec()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -451,6 +535,12 @@ public Builder mergeFrom( case 0: done = true; break; + case 10: + { + input.readMessage(getRaySpecFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 10 case 18: { input.readMessage( @@ -684,6 +774,216 @@ public Builder clearServiceAccountSpec() { return serviceAccountSpecBuilder_; } + private com.google.cloud.aiplatform.v1beta1.RaySpec raySpec_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.RaySpec, + com.google.cloud.aiplatform.v1beta1.RaySpec.Builder, + com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder> + raySpecBuilder_; + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the raySpec field is set. + */ + public boolean hasRaySpec() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The raySpec. + */ + public com.google.cloud.aiplatform.v1beta1.RaySpec getRaySpec() { + if (raySpecBuilder_ == null) { + return raySpec_ == null + ? com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance() + : raySpec_; + } else { + return raySpecBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setRaySpec(com.google.cloud.aiplatform.v1beta1.RaySpec value) { + if (raySpecBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + raySpec_ = value; + } else { + raySpecBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setRaySpec(com.google.cloud.aiplatform.v1beta1.RaySpec.Builder builderForValue) { + if (raySpecBuilder_ == null) { + raySpec_ = builderForValue.build(); + } else { + raySpecBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeRaySpec(com.google.cloud.aiplatform.v1beta1.RaySpec value) { + if (raySpecBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && raySpec_ != null + && raySpec_ != com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance()) { + getRaySpecBuilder().mergeFrom(value); + } else { + raySpec_ = value; + } + } else { + raySpecBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearRaySpec() { + bitField0_ = (bitField0_ & ~0x00000002); + raySpec_ = null; + if (raySpecBuilder_ != null) { + raySpecBuilder_.dispose(); + raySpecBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.aiplatform.v1beta1.RaySpec.Builder getRaySpecBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getRaySpecFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder getRaySpecOrBuilder() { + if (raySpecBuilder_ != null) { + return raySpecBuilder_.getMessageOrBuilder(); + } else { + return raySpec_ == null + ? com.google.cloud.aiplatform.v1beta1.RaySpec.getDefaultInstance() + : raySpec_; + } + } + /** + * + * + *
+     * Ray cluster configuration.
+     * Required when creating a dedicated RayCluster on the PersistentResource.
+     * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.RaySpec, + com.google.cloud.aiplatform.v1beta1.RaySpec.Builder, + com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder> + getRaySpecFieldBuilder() { + if (raySpecBuilder_ == null) { + raySpecBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.RaySpec, + com.google.cloud.aiplatform.v1beta1.RaySpec.Builder, + com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder>( + getRaySpec(), getParentForChildren(), isClean()); + raySpec_ = null; + } + return raySpecBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpecOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpecOrBuilder.java index 04325413e19e..7b2840c4a386 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpecOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ResourceRuntimeSpecOrBuilder.java @@ -63,4 +63,48 @@ public interface ResourceRuntimeSpecOrBuilder * */ com.google.cloud.aiplatform.v1beta1.ServiceAccountSpecOrBuilder getServiceAccountSpecOrBuilder(); + + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the raySpec field is set. + */ + boolean hasRaySpec(); + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The raySpec. + */ + com.google.cloud.aiplatform.v1beta1.RaySpec getRaySpec(); + /** + * + * + *
+   * Ray cluster configuration.
+   * Required when creating a dedicated RayCluster on the PersistentResource.
+   * 
+ * + * + * .google.cloud.aiplatform.v1beta1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.aiplatform.v1beta1.RaySpecOrBuilder getRaySpecOrBuilder(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequest.java new file mode 100644 index 000000000000..a596127f1b5e --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequest.java @@ -0,0 +1,1423 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict].
+ *
+ * The first message must contain
+ * [endpoint][google.cloud.aiplatform.v1beta1.StreamingPredictRequest.endpoint]
+ * field and optionally [input][]. The subsequent messages must contain
+ * [input][].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingPredictRequest} + */ +public final class StreamingPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.StreamingPredictRequest) + StreamingPredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingPredictRequest.newBuilder() to construct. + private StreamingPredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingPredictRequest() { + endpoint_ = ""; + inputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingPredictRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.Builder.class); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUTS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List inputs_; + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List getInputsList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List + getInputsOrBuilderList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public int getInputsCount() { + return inputs_.size(); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index) { + return inputs_.get(index); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index) { + return inputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 3; + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + output.writeMessage(2, inputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(3, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, inputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest other = + (com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getInputsList().equals(other.getInputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + if (getInputsCount() > 0) { + hash = (37 * hash) + INPUTS_FIELD_NUMBER; + hash = (53 * hash) + getInputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict].
+   *
+   * The first message must contain
+   * [endpoint][google.cloud.aiplatform.v1beta1.StreamingPredictRequest.endpoint]
+   * field and optionally [input][]. The subsequent messages must contain
+   * [input][].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.StreamingPredictRequest) + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + } else { + inputs_ = null; + inputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest build() { + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest result = + new com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest result) { + if (inputsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + inputs_ = java.util.Collections.unmodifiableList(inputs_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.inputs_ = inputs_; + } else { + result.inputs_ = inputsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.getDefaultInstance()) + return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (inputsBuilder_ == null) { + if (!other.inputs_.isEmpty()) { + if (inputs_.isEmpty()) { + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureInputsIsMutable(); + inputs_.addAll(other.inputs_); + } + onChanged(); + } + } else { + if (!other.inputs_.isEmpty()) { + if (inputsBuilder_.isEmpty()) { + inputsBuilder_.dispose(); + inputsBuilder_ = null; + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + inputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInputsFieldBuilder() + : null; + } else { + inputsBuilder_.addAllMessages(other.inputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.cloud.aiplatform.v1beta1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Tensor.parser(), extensionRegistry); + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(m); + } else { + inputsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Endpoint requested to serve the prediction.
+     * Format:
+     * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+     * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List inputs_ = + java.util.Collections.emptyList(); + + private void ensureInputsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + inputs_ = new java.util.ArrayList(inputs_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + inputsBuilder_; + + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List getInputsList() { + if (inputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(inputs_); + } else { + return inputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public int getInputsCount() { + if (inputsBuilder_ == null) { + return inputs_.size(); + } else { + return inputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder setInputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.set(index, value); + onChanged(); + } else { + inputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder setInputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.set(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(value); + onChanged(); + } else { + inputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(index, value); + onChanged(); + } else { + inputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addAllInputs( + java.lang.Iterable values) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputs_); + onChanged(); + } else { + inputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder clearInputs() { + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + inputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder removeInputs(int index) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.remove(index); + onChanged(); + } else { + inputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getInputsBuilder(int index) { + return getInputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List + getInputsOrBuilderList() { + if (inputsBuilder_ != null) { + return inputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(inputs_); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addInputsBuilder() { + return getInputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addInputsBuilder(int index) { + return getInputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List + getInputsBuilderList() { + return getInputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getInputsFieldBuilder() { + if (inputsBuilder_ == null) { + inputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + inputs_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + inputs_ = null; + } + return inputsBuilder_; + } + + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder setParameters( + com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000004); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.StreamingPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.StreamingPredictRequest) + private static final com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingPredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequestOrBuilder.java new file mode 100644 index 000000000000..9be64a5acb27 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictRequestOrBuilder.java @@ -0,0 +1,145 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface StreamingPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.StreamingPredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + /** + * + * + *
+   * Required. The name of the Endpoint requested to serve the prediction.
+   * Format:
+   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
+   * 
+ * + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + java.util.List getInputsList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + int getInputsCount(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + java.util.List + getInputsOrBuilderList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1beta1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponse.java new file mode 100644 index 000000000000..37230c0d84a5 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponse.java @@ -0,0 +1,1207 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingPredictResponse} + */ +public final class StreamingPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.StreamingPredictResponse) + StreamingPredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingPredictResponse.newBuilder() to construct. + private StreamingPredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingPredictResponse() { + outputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingPredictResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.Builder.class); + } + + public static final int OUTPUTS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List outputs_; + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List getOutputsList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List + getOutputsOrBuilderList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public int getOutputsCount() { + return outputs_.size(); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index) { + return outputs_.get(index); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index) { + return outputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 2; + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < outputs_.size(); i++) { + output.writeMessage(1, outputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(2, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < outputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, outputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse other = + (com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse) obj; + + if (!getOutputsList().equals(other.getOutputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getOutputsCount() > 0) { + hash = (37 * hash) + OUTPUTS_FIELD_NUMBER; + hash = (53 * hash) + getOutputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.StreamingPredictResponse) + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + } else { + outputs_ = null; + outputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse build() { + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse result = + new com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse result) { + if (outputsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + outputs_ = java.util.Collections.unmodifiableList(outputs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.outputs_ = outputs_; + } else { + result.outputs_ = outputsBuilder_.build(); + } + } + + private void buildPartial0( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse other) { + if (other + == com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.getDefaultInstance()) + return this; + if (outputsBuilder_ == null) { + if (!other.outputs_.isEmpty()) { + if (outputs_.isEmpty()) { + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureOutputsIsMutable(); + outputs_.addAll(other.outputs_); + } + onChanged(); + } + } else { + if (!other.outputs_.isEmpty()) { + if (outputsBuilder_.isEmpty()) { + outputsBuilder_.dispose(); + outputsBuilder_ = null; + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + outputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOutputsFieldBuilder() + : null; + } else { + outputsBuilder_.addAllMessages(other.outputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.aiplatform.v1beta1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Tensor.parser(), extensionRegistry); + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(m); + } else { + outputsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List outputs_ = + java.util.Collections.emptyList(); + + private void ensureOutputsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + outputs_ = new java.util.ArrayList(outputs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + outputsBuilder_; + + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List getOutputsList() { + if (outputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(outputs_); + } else { + return outputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public int getOutputsCount() { + if (outputsBuilder_ == null) { + return outputs_.size(); + } else { + return outputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder setOutputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.set(index, value); + onChanged(); + } else { + outputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder setOutputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.set(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(value); + onChanged(); + } else { + outputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(index, value); + onChanged(); + } else { + outputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addAllOutputs( + java.lang.Iterable values) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, outputs_); + onChanged(); + } else { + outputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder clearOutputs() { + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + outputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder removeOutputs(int index) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.remove(index); + onChanged(); + } else { + outputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getOutputsBuilder(int index) { + return getOutputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List + getOutputsOrBuilderList() { + if (outputsBuilder_ != null) { + return outputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(outputs_); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addOutputsBuilder() { + return getOutputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addOutputsBuilder(int index) { + return getOutputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List + getOutputsBuilderList() { + return getOutputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getOutputsFieldBuilder() { + if (outputsBuilder_ == null) { + outputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + outputs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + outputs_ = null; + } + return outputsBuilder_; + } + + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder setParameters( + com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.StreamingPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.StreamingPredictResponse) + private static final com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingPredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponseOrBuilder.java new file mode 100644 index 000000000000..337708a33ee9 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingPredictResponseOrBuilder.java @@ -0,0 +1,112 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface StreamingPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.StreamingPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + java.util.List getOutputsList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + int getOutputsCount(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + java.util.List + getOutputsOrBuilderList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1beta1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/Tensor.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/Tensor.java new file mode 100644 index 000000000000..3df17776e613 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/Tensor.java @@ -0,0 +1,4237 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/types.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * A tensor value type.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.Tensor} + */ +public final class Tensor extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.Tensor) + TensorOrBuilder { + private static final long serialVersionUID = 0L; + // Use Tensor.newBuilder() to construct. + private Tensor(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Tensor() { + dtype_ = 0; + shape_ = emptyLongList(); + boolVal_ = emptyBooleanList(); + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bytesVal_ = java.util.Collections.emptyList(); + floatVal_ = emptyFloatList(); + doubleVal_ = emptyDoubleList(); + intVal_ = emptyIntList(); + int64Val_ = emptyLongList(); + uintVal_ = emptyIntList(); + uint64Val_ = emptyLongList(); + listVal_ = java.util.Collections.emptyList(); + tensorVal_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Tensor(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.Tensor.class, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder.class); + } + + /** + * + * + *
+   * Data type of the tensor.
+   * 
+ * + * Protobuf enum {@code google.cloud.aiplatform.v1beta1.Tensor.DataType} + */ + public enum DataType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Not a legal value for DataType. Used to indicate a DataType field has not
+     * been set.
+     * 
+ * + * DATA_TYPE_UNSPECIFIED = 0; + */ + DATA_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * Data types that all computation devices are expected to be
+     * capable to support.
+     * 
+ * + * BOOL = 1; + */ + BOOL(1), + /** STRING = 2; */ + STRING(2), + /** FLOAT = 3; */ + FLOAT(3), + /** DOUBLE = 4; */ + DOUBLE(4), + /** INT8 = 5; */ + INT8(5), + /** INT16 = 6; */ + INT16(6), + /** INT32 = 7; */ + INT32(7), + /** INT64 = 8; */ + INT64(8), + /** UINT8 = 9; */ + UINT8(9), + /** UINT16 = 10; */ + UINT16(10), + /** UINT32 = 11; */ + UINT32(11), + /** UINT64 = 12; */ + UINT64(12), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Not a legal value for DataType. Used to indicate a DataType field has not
+     * been set.
+     * 
+ * + * DATA_TYPE_UNSPECIFIED = 0; + */ + public static final int DATA_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Data types that all computation devices are expected to be
+     * capable to support.
+     * 
+ * + * BOOL = 1; + */ + public static final int BOOL_VALUE = 1; + /** STRING = 2; */ + public static final int STRING_VALUE = 2; + /** FLOAT = 3; */ + public static final int FLOAT_VALUE = 3; + /** DOUBLE = 4; */ + public static final int DOUBLE_VALUE = 4; + /** INT8 = 5; */ + public static final int INT8_VALUE = 5; + /** INT16 = 6; */ + public static final int INT16_VALUE = 6; + /** INT32 = 7; */ + public static final int INT32_VALUE = 7; + /** INT64 = 8; */ + public static final int INT64_VALUE = 8; + /** UINT8 = 9; */ + public static final int UINT8_VALUE = 9; + /** UINT16 = 10; */ + public static final int UINT16_VALUE = 10; + /** UINT32 = 11; */ + public static final int UINT32_VALUE = 11; + /** UINT64 = 12; */ + public static final int UINT64_VALUE = 12; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DataType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DataType forNumber(int value) { + switch (value) { + case 0: + return DATA_TYPE_UNSPECIFIED; + case 1: + return BOOL; + case 2: + return STRING; + case 3: + return FLOAT; + case 4: + return DOUBLE; + case 5: + return INT8; + case 6: + return INT16; + case 7: + return INT32; + case 8: + return INT64; + case 9: + return UINT8; + case 10: + return UINT16; + case 11: + return UINT32; + case 12: + return UINT64; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DataType findValueByNumber(int number) { + return DataType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.Tensor.getDescriptor().getEnumTypes().get(0); + } + + private static final DataType[] VALUES = values(); + + public static DataType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DataType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.aiplatform.v1beta1.Tensor.DataType) + } + + public static final int DTYPE_FIELD_NUMBER = 1; + private int dtype_ = 0; + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + @java.lang.Override + public int getDtypeValue() { + return dtype_; + } + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor.DataType getDtype() { + com.google.cloud.aiplatform.v1beta1.Tensor.DataType result = + com.google.cloud.aiplatform.v1beta1.Tensor.DataType.forNumber(dtype_); + return result == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.DataType.UNRECOGNIZED + : result; + } + + public static final int SHAPE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList shape_; + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + @java.lang.Override + public java.util.List getShapeList() { + return shape_; + } + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + public int getShapeCount() { + return shape_.size(); + } + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + public long getShape(int index) { + return shape_.getLong(index); + } + + private int shapeMemoizedSerializedSize = -1; + + public static final int BOOL_VAL_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.BooleanList boolVal_; + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + @java.lang.Override + public java.util.List getBoolValList() { + return boolVal_; + } + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + public int getBoolValCount() { + return boolVal_.size(); + } + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + public boolean getBoolVal(int index) { + return boolVal_.getBoolean(index); + } + + private int boolValMemoizedSerializedSize = -1; + + public static final int STRING_VAL_FIELD_NUMBER = 14; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList stringVal_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + public com.google.protobuf.ProtocolStringList getStringValList() { + return stringVal_; + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + public int getStringValCount() { + return stringVal_.size(); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + public java.lang.String getStringVal(int index) { + return stringVal_.get(index); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + public com.google.protobuf.ByteString getStringValBytes(int index) { + return stringVal_.getByteString(index); + } + + public static final int BYTES_VAL_FIELD_NUMBER = 15; + + @SuppressWarnings("serial") + private java.util.List bytesVal_; + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + @java.lang.Override + public java.util.List getBytesValList() { + return bytesVal_; + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + public int getBytesValCount() { + return bytesVal_.size(); + } + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + public com.google.protobuf.ByteString getBytesVal(int index) { + return bytesVal_.get(index); + } + + public static final int FLOAT_VAL_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.FloatList floatVal_; + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + @java.lang.Override + public java.util.List getFloatValList() { + return floatVal_; + } + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + public int getFloatValCount() { + return floatVal_.size(); + } + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + public float getFloatVal(int index) { + return floatVal_.getFloat(index); + } + + private int floatValMemoizedSerializedSize = -1; + + public static final int DOUBLE_VAL_FIELD_NUMBER = 6; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.DoubleList doubleVal_; + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + @java.lang.Override + public java.util.List getDoubleValList() { + return doubleVal_; + } + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + public int getDoubleValCount() { + return doubleVal_.size(); + } + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + public double getDoubleVal(int index) { + return doubleVal_.getDouble(index); + } + + private int doubleValMemoizedSerializedSize = -1; + + public static final int INT_VAL_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList intVal_; + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + @java.lang.Override + public java.util.List getIntValList() { + return intVal_; + } + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + public int getIntValCount() { + return intVal_.size(); + } + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + public int getIntVal(int index) { + return intVal_.getInt(index); + } + + private int intValMemoizedSerializedSize = -1; + + public static final int INT64_VAL_FIELD_NUMBER = 8; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList int64Val_; + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + @java.lang.Override + public java.util.List getInt64ValList() { + return int64Val_; + } + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + public int getInt64ValCount() { + return int64Val_.size(); + } + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + public long getInt64Val(int index) { + return int64Val_.getLong(index); + } + + private int int64ValMemoizedSerializedSize = -1; + + public static final int UINT_VAL_FIELD_NUMBER = 9; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList uintVal_; + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + @java.lang.Override + public java.util.List getUintValList() { + return uintVal_; + } + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + public int getUintValCount() { + return uintVal_.size(); + } + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + public int getUintVal(int index) { + return uintVal_.getInt(index); + } + + private int uintValMemoizedSerializedSize = -1; + + public static final int UINT64_VAL_FIELD_NUMBER = 10; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.LongList uint64Val_; + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + @java.lang.Override + public java.util.List getUint64ValList() { + return uint64Val_; + } + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + public int getUint64ValCount() { + return uint64Val_.size(); + } + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + public long getUint64Val(int index) { + return uint64Val_.getLong(index); + } + + private int uint64ValMemoizedSerializedSize = -1; + + public static final int LIST_VAL_FIELD_NUMBER = 11; + + @SuppressWarnings("serial") + private java.util.List listVal_; + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + @java.lang.Override + public java.util.List getListValList() { + return listVal_; + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + @java.lang.Override + public java.util.List + getListValOrBuilderList() { + return listVal_; + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + @java.lang.Override + public int getListValCount() { + return listVal_.size(); + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getListVal(int index) { + return listVal_.get(index); + } + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getListValOrBuilder(int index) { + return listVal_.get(index); + } + + public static final int STRUCT_VAL_FIELD_NUMBER = 12; + + private static final class StructValDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.aiplatform.v1beta1.Tensor> + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField + structVal_; + + private com.google.protobuf.MapField + internalGetStructVal() { + if (structVal_ == null) { + return com.google.protobuf.MapField.emptyMapField(StructValDefaultEntryHolder.defaultEntry); + } + return structVal_; + } + + public int getStructValCount() { + return internalGetStructVal().getMap().size(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public boolean containsStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetStructVal().getMap().containsKey(key); + } + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getStructVal() { + return getStructValMap(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public java.util.Map + getStructValMap() { + return internalGetStructVal().getMap(); + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public /* nullable */ com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1beta1.Tensor defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int TENSOR_VAL_FIELD_NUMBER = 13; + private com.google.protobuf.ByteString tensorVal_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * Serialized raw tensor content.
+   * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTensorVal() { + return tensorVal_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (dtype_ + != com.google.cloud.aiplatform.v1beta1.Tensor.DataType.DATA_TYPE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, dtype_); + } + if (getShapeList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(shapeMemoizedSerializedSize); + } + for (int i = 0; i < shape_.size(); i++) { + output.writeInt64NoTag(shape_.getLong(i)); + } + if (getBoolValList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(boolValMemoizedSerializedSize); + } + for (int i = 0; i < boolVal_.size(); i++) { + output.writeBoolNoTag(boolVal_.getBoolean(i)); + } + if (getFloatValList().size() > 0) { + output.writeUInt32NoTag(42); + output.writeUInt32NoTag(floatValMemoizedSerializedSize); + } + for (int i = 0; i < floatVal_.size(); i++) { + output.writeFloatNoTag(floatVal_.getFloat(i)); + } + if (getDoubleValList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(doubleValMemoizedSerializedSize); + } + for (int i = 0; i < doubleVal_.size(); i++) { + output.writeDoubleNoTag(doubleVal_.getDouble(i)); + } + if (getIntValList().size() > 0) { + output.writeUInt32NoTag(58); + output.writeUInt32NoTag(intValMemoizedSerializedSize); + } + for (int i = 0; i < intVal_.size(); i++) { + output.writeInt32NoTag(intVal_.getInt(i)); + } + if (getInt64ValList().size() > 0) { + output.writeUInt32NoTag(66); + output.writeUInt32NoTag(int64ValMemoizedSerializedSize); + } + for (int i = 0; i < int64Val_.size(); i++) { + output.writeInt64NoTag(int64Val_.getLong(i)); + } + if (getUintValList().size() > 0) { + output.writeUInt32NoTag(74); + output.writeUInt32NoTag(uintValMemoizedSerializedSize); + } + for (int i = 0; i < uintVal_.size(); i++) { + output.writeUInt32NoTag(uintVal_.getInt(i)); + } + if (getUint64ValList().size() > 0) { + output.writeUInt32NoTag(82); + output.writeUInt32NoTag(uint64ValMemoizedSerializedSize); + } + for (int i = 0; i < uint64Val_.size(); i++) { + output.writeUInt64NoTag(uint64Val_.getLong(i)); + } + for (int i = 0; i < listVal_.size(); i++) { + output.writeMessage(11, listVal_.get(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetStructVal(), StructValDefaultEntryHolder.defaultEntry, 12); + if (!tensorVal_.isEmpty()) { + output.writeBytes(13, tensorVal_); + } + for (int i = 0; i < stringVal_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 14, stringVal_.getRaw(i)); + } + for (int i = 0; i < bytesVal_.size(); i++) { + output.writeBytes(15, bytesVal_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (dtype_ + != com.google.cloud.aiplatform.v1beta1.Tensor.DataType.DATA_TYPE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, dtype_); + } + { + int dataSize = 0; + for (int i = 0; i < shape_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag(shape_.getLong(i)); + } + size += dataSize; + if (!getShapeList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + shapeMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * getBoolValList().size(); + size += dataSize; + if (!getBoolValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + boolValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * getFloatValList().size(); + size += dataSize; + if (!getFloatValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + floatValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * getDoubleValList().size(); + size += dataSize; + if (!getDoubleValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + doubleValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < intVal_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intVal_.getInt(i)); + } + size += dataSize; + if (!getIntValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + intValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < int64Val_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag(int64Val_.getLong(i)); + } + size += dataSize; + if (!getInt64ValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + int64ValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < uintVal_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uintVal_.getInt(i)); + } + size += dataSize; + if (!getUintValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + uintValMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < uint64Val_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeUInt64SizeNoTag(uint64Val_.getLong(i)); + } + size += dataSize; + if (!getUint64ValList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + uint64ValMemoizedSerializedSize = dataSize; + } + for (int i = 0; i < listVal_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, listVal_.get(i)); + } + for (java.util.Map.Entry entry : + internalGetStructVal().getMap().entrySet()) { + com.google.protobuf.MapEntry + structVal__ = + StructValDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, structVal__); + } + if (!tensorVal_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(13, tensorVal_); + } + { + int dataSize = 0; + for (int i = 0; i < stringVal_.size(); i++) { + dataSize += computeStringSizeNoTag(stringVal_.getRaw(i)); + } + size += dataSize; + size += 1 * getStringValList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < bytesVal_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeBytesSizeNoTag(bytesVal_.get(i)); + } + size += dataSize; + size += 1 * getBytesValList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.Tensor)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.Tensor other = + (com.google.cloud.aiplatform.v1beta1.Tensor) obj; + + if (dtype_ != other.dtype_) return false; + if (!getShapeList().equals(other.getShapeList())) return false; + if (!getBoolValList().equals(other.getBoolValList())) return false; + if (!getStringValList().equals(other.getStringValList())) return false; + if (!getBytesValList().equals(other.getBytesValList())) return false; + if (!getFloatValList().equals(other.getFloatValList())) return false; + if (!getDoubleValList().equals(other.getDoubleValList())) return false; + if (!getIntValList().equals(other.getIntValList())) return false; + if (!getInt64ValList().equals(other.getInt64ValList())) return false; + if (!getUintValList().equals(other.getUintValList())) return false; + if (!getUint64ValList().equals(other.getUint64ValList())) return false; + if (!getListValList().equals(other.getListValList())) return false; + if (!internalGetStructVal().equals(other.internalGetStructVal())) return false; + if (!getTensorVal().equals(other.getTensorVal())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DTYPE_FIELD_NUMBER; + hash = (53 * hash) + dtype_; + if (getShapeCount() > 0) { + hash = (37 * hash) + SHAPE_FIELD_NUMBER; + hash = (53 * hash) + getShapeList().hashCode(); + } + if (getBoolValCount() > 0) { + hash = (37 * hash) + BOOL_VAL_FIELD_NUMBER; + hash = (53 * hash) + getBoolValList().hashCode(); + } + if (getStringValCount() > 0) { + hash = (37 * hash) + STRING_VAL_FIELD_NUMBER; + hash = (53 * hash) + getStringValList().hashCode(); + } + if (getBytesValCount() > 0) { + hash = (37 * hash) + BYTES_VAL_FIELD_NUMBER; + hash = (53 * hash) + getBytesValList().hashCode(); + } + if (getFloatValCount() > 0) { + hash = (37 * hash) + FLOAT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getFloatValList().hashCode(); + } + if (getDoubleValCount() > 0) { + hash = (37 * hash) + DOUBLE_VAL_FIELD_NUMBER; + hash = (53 * hash) + getDoubleValList().hashCode(); + } + if (getIntValCount() > 0) { + hash = (37 * hash) + INT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getIntValList().hashCode(); + } + if (getInt64ValCount() > 0) { + hash = (37 * hash) + INT64_VAL_FIELD_NUMBER; + hash = (53 * hash) + getInt64ValList().hashCode(); + } + if (getUintValCount() > 0) { + hash = (37 * hash) + UINT_VAL_FIELD_NUMBER; + hash = (53 * hash) + getUintValList().hashCode(); + } + if (getUint64ValCount() > 0) { + hash = (37 * hash) + UINT64_VAL_FIELD_NUMBER; + hash = (53 * hash) + getUint64ValList().hashCode(); + } + if (getListValCount() > 0) { + hash = (37 * hash) + LIST_VAL_FIELD_NUMBER; + hash = (53 * hash) + getListValList().hashCode(); + } + if (!internalGetStructVal().getMap().isEmpty()) { + hash = (37 * hash) + STRUCT_VAL_FIELD_NUMBER; + hash = (53 * hash) + internalGetStructVal().hashCode(); + } + hash = (37 * hash) + TENSOR_VAL_FIELD_NUMBER; + hash = (53 * hash) + getTensorVal().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.aiplatform.v1beta1.Tensor prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A tensor value type.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.Tensor} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.Tensor) + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 12: + return internalGetMutableStructVal(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.Tensor.class, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.Tensor.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + dtype_ = 0; + shape_ = emptyLongList(); + boolVal_ = emptyBooleanList(); + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bytesVal_ = java.util.Collections.emptyList(); + floatVal_ = emptyFloatList(); + doubleVal_ = emptyDoubleList(); + intVal_ = emptyIntList(); + int64Val_ = emptyLongList(); + uintVal_ = emptyIntList(); + uint64Val_ = emptyLongList(); + if (listValBuilder_ == null) { + listVal_ = java.util.Collections.emptyList(); + } else { + listVal_ = null; + listValBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000800); + internalGetMutableStructVal().clear(); + tensorVal_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.TypesProto + .internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor build() { + com.google.cloud.aiplatform.v1beta1.Tensor result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor buildPartial() { + com.google.cloud.aiplatform.v1beta1.Tensor result = + new com.google.cloud.aiplatform.v1beta1.Tensor(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.cloud.aiplatform.v1beta1.Tensor result) { + if (((bitField0_ & 0x00000002) != 0)) { + shape_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.shape_ = shape_; + if (((bitField0_ & 0x00000004) != 0)) { + boolVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.boolVal_ = boolVal_; + if (((bitField0_ & 0x00000010) != 0)) { + bytesVal_ = java.util.Collections.unmodifiableList(bytesVal_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.bytesVal_ = bytesVal_; + if (((bitField0_ & 0x00000020) != 0)) { + floatVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.floatVal_ = floatVal_; + if (((bitField0_ & 0x00000040) != 0)) { + doubleVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.doubleVal_ = doubleVal_; + if (((bitField0_ & 0x00000080) != 0)) { + intVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.intVal_ = intVal_; + if (((bitField0_ & 0x00000100) != 0)) { + int64Val_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000100); + } + result.int64Val_ = int64Val_; + if (((bitField0_ & 0x00000200) != 0)) { + uintVal_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000200); + } + result.uintVal_ = uintVal_; + if (((bitField0_ & 0x00000400) != 0)) { + uint64Val_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000400); + } + result.uint64Val_ = uint64Val_; + if (listValBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0)) { + listVal_ = java.util.Collections.unmodifiableList(listVal_); + bitField0_ = (bitField0_ & ~0x00000800); + } + result.listVal_ = listVal_; + } else { + result.listVal_ = listValBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.Tensor result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.dtype_ = dtype_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + stringVal_.makeImmutable(); + result.stringVal_ = stringVal_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.structVal_ = internalGetStructVal(); + result.structVal_.makeImmutable(); + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.tensorVal_ = tensorVal_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.Tensor) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.Tensor) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.Tensor other) { + if (other == com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()) return this; + if (other.dtype_ != 0) { + setDtypeValue(other.getDtypeValue()); + } + if (!other.shape_.isEmpty()) { + if (shape_.isEmpty()) { + shape_ = other.shape_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureShapeIsMutable(); + shape_.addAll(other.shape_); + } + onChanged(); + } + if (!other.boolVal_.isEmpty()) { + if (boolVal_.isEmpty()) { + boolVal_ = other.boolVal_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureBoolValIsMutable(); + boolVal_.addAll(other.boolVal_); + } + onChanged(); + } + if (!other.stringVal_.isEmpty()) { + if (stringVal_.isEmpty()) { + stringVal_ = other.stringVal_; + bitField0_ |= 0x00000008; + } else { + ensureStringValIsMutable(); + stringVal_.addAll(other.stringVal_); + } + onChanged(); + } + if (!other.bytesVal_.isEmpty()) { + if (bytesVal_.isEmpty()) { + bytesVal_ = other.bytesVal_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureBytesValIsMutable(); + bytesVal_.addAll(other.bytesVal_); + } + onChanged(); + } + if (!other.floatVal_.isEmpty()) { + if (floatVal_.isEmpty()) { + floatVal_ = other.floatVal_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureFloatValIsMutable(); + floatVal_.addAll(other.floatVal_); + } + onChanged(); + } + if (!other.doubleVal_.isEmpty()) { + if (doubleVal_.isEmpty()) { + doubleVal_ = other.doubleVal_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureDoubleValIsMutable(); + doubleVal_.addAll(other.doubleVal_); + } + onChanged(); + } + if (!other.intVal_.isEmpty()) { + if (intVal_.isEmpty()) { + intVal_ = other.intVal_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureIntValIsMutable(); + intVal_.addAll(other.intVal_); + } + onChanged(); + } + if (!other.int64Val_.isEmpty()) { + if (int64Val_.isEmpty()) { + int64Val_ = other.int64Val_; + bitField0_ = (bitField0_ & ~0x00000100); + } else { + ensureInt64ValIsMutable(); + int64Val_.addAll(other.int64Val_); + } + onChanged(); + } + if (!other.uintVal_.isEmpty()) { + if (uintVal_.isEmpty()) { + uintVal_ = other.uintVal_; + bitField0_ = (bitField0_ & ~0x00000200); + } else { + ensureUintValIsMutable(); + uintVal_.addAll(other.uintVal_); + } + onChanged(); + } + if (!other.uint64Val_.isEmpty()) { + if (uint64Val_.isEmpty()) { + uint64Val_ = other.uint64Val_; + bitField0_ = (bitField0_ & ~0x00000400); + } else { + ensureUint64ValIsMutable(); + uint64Val_.addAll(other.uint64Val_); + } + onChanged(); + } + if (listValBuilder_ == null) { + if (!other.listVal_.isEmpty()) { + if (listVal_.isEmpty()) { + listVal_ = other.listVal_; + bitField0_ = (bitField0_ & ~0x00000800); + } else { + ensureListValIsMutable(); + listVal_.addAll(other.listVal_); + } + onChanged(); + } + } else { + if (!other.listVal_.isEmpty()) { + if (listValBuilder_.isEmpty()) { + listValBuilder_.dispose(); + listValBuilder_ = null; + listVal_ = other.listVal_; + bitField0_ = (bitField0_ & ~0x00000800); + listValBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getListValFieldBuilder() + : null; + } else { + listValBuilder_.addAllMessages(other.listVal_); + } + } + } + internalGetMutableStructVal().mergeFrom(other.internalGetStructVal()); + bitField0_ |= 0x00001000; + if (other.getTensorVal() != com.google.protobuf.ByteString.EMPTY) { + setTensorVal(other.getTensorVal()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + dtype_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + long v = input.readInt64(); + ensureShapeIsMutable(); + shape_.addLong(v); + break; + } // case 16 + case 18: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureShapeIsMutable(); + while (input.getBytesUntilLimit() > 0) { + shape_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } // case 18 + case 24: + { + boolean v = input.readBool(); + ensureBoolValIsMutable(); + boolVal_.addBoolean(v); + break; + } // case 24 + case 26: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureBoolValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + boolVal_.addBoolean(input.readBool()); + } + input.popLimit(limit); + break; + } // case 26 + case 45: + { + float v = input.readFloat(); + ensureFloatValIsMutable(); + floatVal_.addFloat(v); + break; + } // case 45 + case 42: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureFloatValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + floatVal_.addFloat(input.readFloat()); + } + input.popLimit(limit); + break; + } // case 42 + case 49: + { + double v = input.readDouble(); + ensureDoubleValIsMutable(); + doubleVal_.addDouble(v); + break; + } // case 49 + case 50: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureDoubleValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + doubleVal_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } // case 50 + case 56: + { + int v = input.readInt32(); + ensureIntValIsMutable(); + intVal_.addInt(v); + break; + } // case 56 + case 58: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureIntValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + intVal_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } // case 58 + case 64: + { + long v = input.readInt64(); + ensureInt64ValIsMutable(); + int64Val_.addLong(v); + break; + } // case 64 + case 66: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureInt64ValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + int64Val_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } // case 66 + case 72: + { + int v = input.readUInt32(); + ensureUintValIsMutable(); + uintVal_.addInt(v); + break; + } // case 72 + case 74: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureUintValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + uintVal_.addInt(input.readUInt32()); + } + input.popLimit(limit); + break; + } // case 74 + case 80: + { + long v = input.readUInt64(); + ensureUint64ValIsMutable(); + uint64Val_.addLong(v); + break; + } // case 80 + case 82: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureUint64ValIsMutable(); + while (input.getBytesUntilLimit() > 0) { + uint64Val_.addLong(input.readUInt64()); + } + input.popLimit(limit); + break; + } // case 82 + case 90: + { + com.google.cloud.aiplatform.v1beta1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Tensor.parser(), extensionRegistry); + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(m); + } else { + listValBuilder_.addMessage(m); + } + break; + } // case 90 + case 98: + { + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.aiplatform.v1beta1.Tensor> + structVal__ = + input.readMessage( + StructValDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableStructVal() + .getMutableMap() + .put(structVal__.getKey(), structVal__.getValue()); + bitField0_ |= 0x00001000; + break; + } // case 98 + case 106: + { + tensorVal_ = input.readBytes(); + bitField0_ |= 0x00002000; + break; + } // case 106 + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureStringValIsMutable(); + stringVal_.add(s); + break; + } // case 114 + case 122: + { + com.google.protobuf.ByteString v = input.readBytes(); + ensureBytesValIsMutable(); + bytesVal_.add(v); + break; + } // case 122 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int dtype_ = 0; + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + @java.lang.Override + public int getDtypeValue() { + return dtype_; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @param value The enum numeric value on the wire for dtype to set. + * @return This builder for chaining. + */ + public Builder setDtypeValue(int value) { + dtype_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor.DataType getDtype() { + com.google.cloud.aiplatform.v1beta1.Tensor.DataType result = + com.google.cloud.aiplatform.v1beta1.Tensor.DataType.forNumber(dtype_); + return result == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.DataType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @param value The dtype to set. + * @return This builder for chaining. + */ + public Builder setDtype(com.google.cloud.aiplatform.v1beta1.Tensor.DataType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + dtype_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The data type of tensor.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return This builder for chaining. + */ + public Builder clearDtype() { + bitField0_ = (bitField0_ & ~0x00000001); + dtype_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList shape_ = emptyLongList(); + + private void ensureShapeIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + shape_ = mutableCopy(shape_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + public java.util.List getShapeList() { + return ((bitField0_ & 0x00000002) != 0) + ? java.util.Collections.unmodifiableList(shape_) + : shape_; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + public int getShapeCount() { + return shape_.size(); + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + public long getShape(int index) { + return shape_.getLong(index); + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param index The index to set the value at. + * @param value The shape to set. + * @return This builder for chaining. + */ + public Builder setShape(int index, long value) { + + ensureShapeIsMutable(); + shape_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param value The shape to add. + * @return This builder for chaining. + */ + public Builder addShape(long value) { + + ensureShapeIsMutable(); + shape_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @param values The shape to add. + * @return This builder for chaining. + */ + public Builder addAllShape(java.lang.Iterable values) { + ensureShapeIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, shape_); + onChanged(); + return this; + } + /** + * + * + *
+     * Shape of the tensor.
+     * 
+ * + * repeated int64 shape = 2; + * + * @return This builder for chaining. + */ + public Builder clearShape() { + shape_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.BooleanList boolVal_ = emptyBooleanList(); + + private void ensureBoolValIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + boolVal_ = mutableCopy(boolVal_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + public java.util.List getBoolValList() { + return ((bitField0_ & 0x00000004) != 0) + ? java.util.Collections.unmodifiableList(boolVal_) + : boolVal_; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + public int getBoolValCount() { + return boolVal_.size(); + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + public boolean getBoolVal(int index) { + return boolVal_.getBoolean(index); + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index to set the value at. + * @param value The boolVal to set. + * @return This builder for chaining. + */ + public Builder setBoolVal(int index, boolean value) { + + ensureBoolValIsMutable(); + boolVal_.setBoolean(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param value The boolVal to add. + * @return This builder for chaining. + */ + public Builder addBoolVal(boolean value) { + + ensureBoolValIsMutable(); + boolVal_.addBoolean(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @param values The boolVal to add. + * @return This builder for chaining. + */ + public Builder addAllBoolVal(java.lang.Iterable values) { + ensureBoolValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, boolVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * Type specific representations that make it easy to create tensor protos in
+     * all languages.  Only the representation corresponding to "dtype" can
+     * be set.  The values hold the flattened representation of the tensor in
+     * row major order.
+     *
+     * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+     * 
+ * + * repeated bool bool_val = 3; + * + * @return This builder for chaining. + */ + public Builder clearBoolVal() { + boolVal_ = emptyBooleanList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList stringVal_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureStringValIsMutable() { + if (!stringVal_.isModifiable()) { + stringVal_ = new com.google.protobuf.LazyStringArrayList(stringVal_); + } + bitField0_ |= 0x00000008; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + public com.google.protobuf.ProtocolStringList getStringValList() { + stringVal_.makeImmutable(); + return stringVal_; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + public int getStringValCount() { + return stringVal_.size(); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + public java.lang.String getStringVal(int index) { + return stringVal_.get(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + public com.google.protobuf.ByteString getStringValBytes(int index) { + return stringVal_.getByteString(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param index The index to set the value at. + * @param value The stringVal to set. + * @return This builder for chaining. + */ + public Builder setStringVal(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringValIsMutable(); + stringVal_.set(index, value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param value The stringVal to add. + * @return This builder for chaining. + */ + public Builder addStringVal(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringValIsMutable(); + stringVal_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param values The stringVal to add. + * @return This builder for chaining. + */ + public Builder addAllStringVal(java.lang.Iterable values) { + ensureStringValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, stringVal_); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @return This builder for chaining. + */ + public Builder clearStringVal() { + stringVal_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated string string_val = 14; + * + * @param value The bytes of the stringVal to add. + * @return This builder for chaining. + */ + public Builder addStringValBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureStringValIsMutable(); + stringVal_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.util.List bytesVal_ = + java.util.Collections.emptyList(); + + private void ensureBytesValIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + bytesVal_ = new java.util.ArrayList(bytesVal_); + bitField0_ |= 0x00000010; + } + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + public java.util.List getBytesValList() { + return ((bitField0_ & 0x00000010) != 0) + ? java.util.Collections.unmodifiableList(bytesVal_) + : bytesVal_; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + public int getBytesValCount() { + return bytesVal_.size(); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + public com.google.protobuf.ByteString getBytesVal(int index) { + return bytesVal_.get(index); + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index to set the value at. + * @param value The bytesVal to set. + * @return This builder for chaining. + */ + public Builder setBytesVal(int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBytesValIsMutable(); + bytesVal_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param value The bytesVal to add. + * @return This builder for chaining. + */ + public Builder addBytesVal(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBytesValIsMutable(); + bytesVal_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @param values The bytesVal to add. + * @return This builder for chaining. + */ + public Builder addAllBytesVal( + java.lang.Iterable values) { + ensureBytesValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, bytesVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+     * 
+ * + * repeated bytes bytes_val = 15; + * + * @return This builder for chaining. + */ + public Builder clearBytesVal() { + bytesVal_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.FloatList floatVal_ = emptyFloatList(); + + private void ensureFloatValIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + floatVal_ = mutableCopy(floatVal_); + bitField0_ |= 0x00000020; + } + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + public java.util.List getFloatValList() { + return ((bitField0_ & 0x00000020) != 0) + ? java.util.Collections.unmodifiableList(floatVal_) + : floatVal_; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + public int getFloatValCount() { + return floatVal_.size(); + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + public float getFloatVal(int index) { + return floatVal_.getFloat(index); + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param index The index to set the value at. + * @param value The floatVal to set. + * @return This builder for chaining. + */ + public Builder setFloatVal(int index, float value) { + + ensureFloatValIsMutable(); + floatVal_.setFloat(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param value The floatVal to add. + * @return This builder for chaining. + */ + public Builder addFloatVal(float value) { + + ensureFloatValIsMutable(); + floatVal_.addFloat(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @param values The floatVal to add. + * @return This builder for chaining. + */ + public Builder addAllFloatVal(java.lang.Iterable values) { + ensureFloatValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, floatVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+     * 
+ * + * repeated float float_val = 5; + * + * @return This builder for chaining. + */ + public Builder clearFloatVal() { + floatVal_ = emptyFloatList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList doubleVal_ = emptyDoubleList(); + + private void ensureDoubleValIsMutable() { + if (!((bitField0_ & 0x00000040) != 0)) { + doubleVal_ = mutableCopy(doubleVal_); + bitField0_ |= 0x00000040; + } + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + public java.util.List getDoubleValList() { + return ((bitField0_ & 0x00000040) != 0) + ? java.util.Collections.unmodifiableList(doubleVal_) + : doubleVal_; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + public int getDoubleValCount() { + return doubleVal_.size(); + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + public double getDoubleVal(int index) { + return doubleVal_.getDouble(index); + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param index The index to set the value at. + * @param value The doubleVal to set. + * @return This builder for chaining. + */ + public Builder setDoubleVal(int index, double value) { + + ensureDoubleValIsMutable(); + doubleVal_.setDouble(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param value The doubleVal to add. + * @return This builder for chaining. + */ + public Builder addDoubleVal(double value) { + + ensureDoubleValIsMutable(); + doubleVal_.addDouble(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @param values The doubleVal to add. + * @return This builder for chaining. + */ + public Builder addAllDoubleVal(java.lang.Iterable values) { + ensureDoubleValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, doubleVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+     * 
+ * + * repeated double double_val = 6; + * + * @return This builder for chaining. + */ + public Builder clearDoubleVal() { + doubleVal_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.IntList intVal_ = emptyIntList(); + + private void ensureIntValIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + intVal_ = mutableCopy(intVal_); + bitField0_ |= 0x00000080; + } + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + public java.util.List getIntValList() { + return ((bitField0_ & 0x00000080) != 0) + ? java.util.Collections.unmodifiableList(intVal_) + : intVal_; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + public int getIntValCount() { + return intVal_.size(); + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + public int getIntVal(int index) { + return intVal_.getInt(index); + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index to set the value at. + * @param value The intVal to set. + * @return This builder for chaining. + */ + public Builder setIntVal(int index, int value) { + + ensureIntValIsMutable(); + intVal_.setInt(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param value The intVal to add. + * @return This builder for chaining. + */ + public Builder addIntVal(int value) { + + ensureIntValIsMutable(); + intVal_.addInt(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @param values The intVal to add. + * @return This builder for chaining. + */ + public Builder addAllIntVal(java.lang.Iterable values) { + ensureIntValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, intVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+     * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+     * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+     * 
+ * + * repeated int32 int_val = 7; + * + * @return This builder for chaining. + */ + public Builder clearIntVal() { + intVal_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList int64Val_ = emptyLongList(); + + private void ensureInt64ValIsMutable() { + if (!((bitField0_ & 0x00000100) != 0)) { + int64Val_ = mutableCopy(int64Val_); + bitField0_ |= 0x00000100; + } + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + public java.util.List getInt64ValList() { + return ((bitField0_ & 0x00000100) != 0) + ? java.util.Collections.unmodifiableList(int64Val_) + : int64Val_; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + public int getInt64ValCount() { + return int64Val_.size(); + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + public long getInt64Val(int index) { + return int64Val_.getLong(index); + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index to set the value at. + * @param value The int64Val to set. + * @return This builder for chaining. + */ + public Builder setInt64Val(int index, long value) { + + ensureInt64ValIsMutable(); + int64Val_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param value The int64Val to add. + * @return This builder for chaining. + */ + public Builder addInt64Val(long value) { + + ensureInt64ValIsMutable(); + int64Val_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @param values The int64Val to add. + * @return This builder for chaining. + */ + public Builder addAllInt64Val(java.lang.Iterable values) { + ensureInt64ValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, int64Val_); + onChanged(); + return this; + } + /** + * + * + *
+     * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+     * 
+ * + * repeated int64 int64_val = 8; + * + * @return This builder for chaining. + */ + public Builder clearInt64Val() { + int64Val_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.IntList uintVal_ = emptyIntList(); + + private void ensureUintValIsMutable() { + if (!((bitField0_ & 0x00000200) != 0)) { + uintVal_ = mutableCopy(uintVal_); + bitField0_ |= 0x00000200; + } + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + public java.util.List getUintValList() { + return ((bitField0_ & 0x00000200) != 0) + ? java.util.Collections.unmodifiableList(uintVal_) + : uintVal_; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + public int getUintValCount() { + return uintVal_.size(); + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + public int getUintVal(int index) { + return uintVal_.getInt(index); + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index to set the value at. + * @param value The uintVal to set. + * @return This builder for chaining. + */ + public Builder setUintVal(int index, int value) { + + ensureUintValIsMutable(); + uintVal_.setInt(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param value The uintVal to add. + * @return This builder for chaining. + */ + public Builder addUintVal(int value) { + + ensureUintValIsMutable(); + uintVal_.addInt(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @param values The uintVal to add. + * @return This builder for chaining. + */ + public Builder addAllUintVal(java.lang.Iterable values) { + ensureUintValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, uintVal_); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+     * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+     * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+     * 
+ * + * repeated uint32 uint_val = 9; + * + * @return This builder for chaining. + */ + public Builder clearUintVal() { + uintVal_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000200); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList uint64Val_ = emptyLongList(); + + private void ensureUint64ValIsMutable() { + if (!((bitField0_ & 0x00000400) != 0)) { + uint64Val_ = mutableCopy(uint64Val_); + bitField0_ |= 0x00000400; + } + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + public java.util.List getUint64ValList() { + return ((bitField0_ & 0x00000400) != 0) + ? java.util.Collections.unmodifiableList(uint64Val_) + : uint64Val_; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + public int getUint64ValCount() { + return uint64Val_.size(); + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + public long getUint64Val(int index) { + return uint64Val_.getLong(index); + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index to set the value at. + * @param value The uint64Val to set. + * @return This builder for chaining. + */ + public Builder setUint64Val(int index, long value) { + + ensureUint64ValIsMutable(); + uint64Val_.setLong(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param value The uint64Val to add. + * @return This builder for chaining. + */ + public Builder addUint64Val(long value) { + + ensureUint64ValIsMutable(); + uint64Val_.addLong(value); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param values The uint64Val to add. + * @return This builder for chaining. + */ + public Builder addAllUint64Val(java.lang.Iterable values) { + ensureUint64ValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, uint64Val_); + onChanged(); + return this; + } + /** + * + * + *
+     * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+     * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return This builder for chaining. + */ + public Builder clearUint64Val() { + uint64Val_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000400); + onChanged(); + return this; + } + + private java.util.List listVal_ = + java.util.Collections.emptyList(); + + private void ensureListValIsMutable() { + if (!((bitField0_ & 0x00000800) != 0)) { + listVal_ = new java.util.ArrayList(listVal_); + bitField0_ |= 0x00000800; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + listValBuilder_; + + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public java.util.List getListValList() { + if (listValBuilder_ == null) { + return java.util.Collections.unmodifiableList(listVal_); + } else { + return listValBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public int getListValCount() { + if (listValBuilder_ == null) { + return listVal_.size(); + } else { + return listValBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getListVal(int index) { + if (listValBuilder_ == null) { + return listVal_.get(index); + } else { + return listValBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder setListVal(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.set(index, value); + onChanged(); + } else { + listValBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder setListVal( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.set(index, builderForValue.build()); + onChanged(); + } else { + listValBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder addListVal(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.add(value); + onChanged(); + } else { + listValBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder addListVal(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (listValBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureListValIsMutable(); + listVal_.add(index, value); + onChanged(); + } else { + listValBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder addListVal(com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(builderForValue.build()); + onChanged(); + } else { + listValBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder addListVal( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.add(index, builderForValue.build()); + onChanged(); + } else { + listValBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder addAllListVal( + java.lang.Iterable values) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, listVal_); + onChanged(); + } else { + listValBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder clearListVal() { + if (listValBuilder_ == null) { + listVal_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000800); + onChanged(); + } else { + listValBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public Builder removeListVal(int index) { + if (listValBuilder_ == null) { + ensureListValIsMutable(); + listVal_.remove(index); + onChanged(); + } else { + listValBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getListValBuilder(int index) { + return getListValFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getListValOrBuilder(int index) { + if (listValBuilder_ == null) { + return listVal_.get(index); + } else { + return listValBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public java.util.List + getListValOrBuilderList() { + if (listValBuilder_ != null) { + return listValBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(listVal_); + } + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addListValBuilder() { + return getListValFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addListValBuilder(int index) { + return getListValFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * A list of tensor values.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + public java.util.List + getListValBuilderList() { + return getListValFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getListValFieldBuilder() { + if (listValBuilder_ == null) { + listValBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + listVal_, ((bitField0_ & 0x00000800) != 0), getParentForChildren(), isClean()); + listVal_ = null; + } + return listValBuilder_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.aiplatform.v1beta1.Tensor> + structVal_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.aiplatform.v1beta1.Tensor> + internalGetStructVal() { + if (structVal_ == null) { + return com.google.protobuf.MapField.emptyMapField(StructValDefaultEntryHolder.defaultEntry); + } + return structVal_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.aiplatform.v1beta1.Tensor> + internalGetMutableStructVal() { + if (structVal_ == null) { + structVal_ = + com.google.protobuf.MapField.newMapField(StructValDefaultEntryHolder.defaultEntry); + } + if (!structVal_.isMutable()) { + structVal_ = structVal_.copy(); + } + bitField0_ |= 0x00001000; + onChanged(); + return structVal_; + } + + public int getStructValCount() { + return internalGetStructVal().getMap().size(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public boolean containsStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetStructVal().getMap().containsKey(key); + } + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getStructVal() { + return getStructValMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public java.util.Map + getStructValMap() { + return internalGetStructVal().getMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public /* nullable */ com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1beta1.Tensor defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetStructVal().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearStructVal() { + bitField0_ = (bitField0_ & ~0x00001000); + internalGetMutableStructVal().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + public Builder removeStructVal(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableStructVal().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableStructVal() { + bitField0_ |= 0x00001000; + return internalGetMutableStructVal().getMutableMap(); + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + public Builder putStructVal( + java.lang.String key, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableStructVal().getMutableMap().put(key, value); + bitField0_ |= 0x00001000; + return this; + } + /** + * + * + *
+     * A map of string to tensor.
+     * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + public Builder putAllStructVal( + java.util.Map values) { + internalGetMutableStructVal().getMutableMap().putAll(values); + bitField0_ |= 0x00001000; + return this; + } + + private com.google.protobuf.ByteString tensorVal_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTensorVal() { + return tensorVal_; + } + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @param value The tensorVal to set. + * @return This builder for chaining. + */ + public Builder setTensorVal(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + tensorVal_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Serialized raw tensor content.
+     * 
+ * + * bytes tensor_val = 13; + * + * @return This builder for chaining. + */ + public Builder clearTensorVal() { + bitField0_ = (bitField0_ & ~0x00002000); + tensorVal_ = getDefaultInstance().getTensorVal(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.Tensor) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.Tensor) + private static final com.google.cloud.aiplatform.v1beta1.Tensor DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.Tensor(); + } + + public static com.google.cloud.aiplatform.v1beta1.Tensor getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Tensor parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TensorOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TensorOrBuilder.java new file mode 100644 index 000000000000..a0c0ed5c2f6b --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TensorOrBuilder.java @@ -0,0 +1,593 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/types.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface TensorOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.Tensor) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The enum numeric value on the wire for dtype. + */ + int getDtypeValue(); + /** + * + * + *
+   * The data type of tensor.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor.DataType dtype = 1; + * + * @return The dtype. + */ + com.google.cloud.aiplatform.v1beta1.Tensor.DataType getDtype(); + + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return A list containing the shape. + */ + java.util.List getShapeList(); + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @return The count of shape. + */ + int getShapeCount(); + /** + * + * + *
+   * Shape of the tensor.
+   * 
+ * + * repeated int64 shape = 2; + * + * @param index The index of the element to return. + * @return The shape at the given index. + */ + long getShape(int index); + + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return A list containing the boolVal. + */ + java.util.List getBoolValList(); + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @return The count of boolVal. + */ + int getBoolValCount(); + /** + * + * + *
+   * Type specific representations that make it easy to create tensor protos in
+   * all languages.  Only the representation corresponding to "dtype" can
+   * be set.  The values hold the flattened representation of the tensor in
+   * row major order.
+   *
+   * [BOOL][google.aiplatform.master.Tensor.DataType.BOOL]
+   * 
+ * + * repeated bool bool_val = 3; + * + * @param index The index of the element to return. + * @return The boolVal at the given index. + */ + boolean getBoolVal(int index); + + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return A list containing the stringVal. + */ + java.util.List getStringValList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @return The count of stringVal. + */ + int getStringValCount(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the element to return. + * @return The stringVal at the given index. + */ + java.lang.String getStringVal(int index); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated string string_val = 14; + * + * @param index The index of the value to return. + * @return The bytes of the stringVal at the given index. + */ + com.google.protobuf.ByteString getStringValBytes(int index); + + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return A list containing the bytesVal. + */ + java.util.List getBytesValList(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @return The count of bytesVal. + */ + int getBytesValCount(); + /** + * + * + *
+   * [STRING][google.aiplatform.master.Tensor.DataType.STRING]
+   * 
+ * + * repeated bytes bytes_val = 15; + * + * @param index The index of the element to return. + * @return The bytesVal at the given index. + */ + com.google.protobuf.ByteString getBytesVal(int index); + + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return A list containing the floatVal. + */ + java.util.List getFloatValList(); + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @return The count of floatVal. + */ + int getFloatValCount(); + /** + * + * + *
+   * [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT]
+   * 
+ * + * repeated float float_val = 5; + * + * @param index The index of the element to return. + * @return The floatVal at the given index. + */ + float getFloatVal(int index); + + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return A list containing the doubleVal. + */ + java.util.List getDoubleValList(); + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @return The count of doubleVal. + */ + int getDoubleValCount(); + /** + * + * + *
+   * [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE]
+   * 
+ * + * repeated double double_val = 6; + * + * @param index The index of the element to return. + * @return The doubleVal at the given index. + */ + double getDoubleVal(int index); + + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return A list containing the intVal. + */ + java.util.List getIntValList(); + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @return The count of intVal. + */ + int getIntValCount(); + /** + * + * + *
+   * [INT_8][google.aiplatform.master.Tensor.DataType.INT8]
+   * [INT_16][google.aiplatform.master.Tensor.DataType.INT16]
+   * [INT_32][google.aiplatform.master.Tensor.DataType.INT32]
+   * 
+ * + * repeated int32 int_val = 7; + * + * @param index The index of the element to return. + * @return The intVal at the given index. + */ + int getIntVal(int index); + + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return A list containing the int64Val. + */ + java.util.List getInt64ValList(); + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @return The count of int64Val. + */ + int getInt64ValCount(); + /** + * + * + *
+   * [INT64][google.aiplatform.master.Tensor.DataType.INT64]
+   * 
+ * + * repeated int64 int64_val = 8; + * + * @param index The index of the element to return. + * @return The int64Val at the given index. + */ + long getInt64Val(int index); + + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return A list containing the uintVal. + */ + java.util.List getUintValList(); + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @return The count of uintVal. + */ + int getUintValCount(); + /** + * + * + *
+   * [UINT8][google.aiplatform.master.Tensor.DataType.UINT8]
+   * [UINT16][google.aiplatform.master.Tensor.DataType.UINT16]
+   * [UINT32][google.aiplatform.master.Tensor.DataType.UINT32]
+   * 
+ * + * repeated uint32 uint_val = 9; + * + * @param index The index of the element to return. + * @return The uintVal at the given index. + */ + int getUintVal(int index); + + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return A list containing the uint64Val. + */ + java.util.List getUint64ValList(); + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @return The count of uint64Val. + */ + int getUint64ValCount(); + /** + * + * + *
+   * [UINT64][google.aiplatform.master.Tensor.DataType.UINT64]
+   * 
+ * + * repeated uint64 uint64_val = 10; + * + * @param index The index of the element to return. + * @return The uint64Val at the given index. + */ + long getUint64Val(int index); + + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + java.util.List getListValList(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getListVal(int index); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + int getListValCount(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + java.util.List + getListValOrBuilderList(); + /** + * + * + *
+   * A list of tensor values.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor list_val = 11; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getListValOrBuilder(int index); + + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + int getStructValCount(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + boolean containsStructVal(java.lang.String key); + /** Use {@link #getStructValMap()} instead. */ + @java.lang.Deprecated + java.util.Map getStructVal(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + java.util.Map getStructValMap(); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + /* nullable */ + com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.aiplatform.v1beta1.Tensor defaultValue); + /** + * + * + *
+   * A map of string to tensor.
+   * 
+ * + * map<string, .google.cloud.aiplatform.v1beta1.Tensor> struct_val = 12; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getStructValOrThrow(java.lang.String key); + + /** + * + * + *
+   * Serialized raw tensor content.
+   * 
+ * + * bytes tensor_val = 13; + * + * @return The tensorVal. + */ + com.google.protobuf.ByteString getTensorVal(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TypesProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TypesProto.java index fea09a07fc6e..3750250aa4f9 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TypesProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/TypesProto.java @@ -43,6 +43,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1beta1_StringArray_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1beta1_StringArray_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_Tensor_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -56,13 +64,30 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "proto\022\037google.cloud.aiplatform.v1beta1\"\033" + "\n\tBoolArray\022\016\n\006values\030\001 \003(\010\"\035\n\013DoubleArr" + "ay\022\016\n\006values\030\001 \003(\001\"\034\n\nInt64Array\022\016\n\006valu" - + "es\030\001 \003(\003\"\035\n\013StringArray\022\016\n\006values\030\001 \003(\tB" - + "\341\001\n#com.google.cloud.aiplatform.v1beta1B" - + "\nTypesProtoP\001ZCcloud.google.com/go/aipla" - + "tform/apiv1beta1/aiplatformpb;aiplatform" - + "pb\252\002\037Google.Cloud.AIPlatform.V1Beta1\312\002\037G" - + "oogle\\Cloud\\AIPlatform\\V1beta1\352\002\"Google:" - + ":Cloud::AIPlatform::V1beta1b\006proto3" + + "es\030\001 \003(\003\"\035\n\013StringArray\022\016\n\006values\030\001 \003(\t\"" + + "\247\005\n\006Tensor\022?\n\005dtype\030\001 \001(\01620.google.cloud" + + ".aiplatform.v1beta1.Tensor.DataType\022\r\n\005s" + + "hape\030\002 \003(\003\022\020\n\010bool_val\030\003 \003(\010\022\022\n\nstring_v" + + "al\030\016 \003(\t\022\021\n\tbytes_val\030\017 \003(\014\022\021\n\tfloat_val" + + "\030\005 \003(\002\022\022\n\ndouble_val\030\006 \003(\001\022\017\n\007int_val\030\007 " + + "\003(\005\022\021\n\tint64_val\030\010 \003(\003\022\020\n\010uint_val\030\t \003(\r" + + "\022\022\n\nuint64_val\030\n \003(\004\0229\n\010list_val\030\013 \003(\0132\'" + + ".google.cloud.aiplatform.v1beta1.Tensor\022" + + "J\n\nstruct_val\030\014 \003(\01326.google.cloud.aipla" + + "tform.v1beta1.Tensor.StructValEntry\022\022\n\nt" + + "ensor_val\030\r \001(\014\032Y\n\016StructValEntry\022\013\n\003key" + + "\030\001 \001(\t\0226\n\005value\030\002 \001(\0132\'.google.cloud.aip" + + "latform.v1beta1.Tensor:\0028\001\"\254\001\n\010DataType\022" + + "\031\n\025DATA_TYPE_UNSPECIFIED\020\000\022\010\n\004BOOL\020\001\022\n\n\006" + + "STRING\020\002\022\t\n\005FLOAT\020\003\022\n\n\006DOUBLE\020\004\022\010\n\004INT8\020" + + "\005\022\t\n\005INT16\020\006\022\t\n\005INT32\020\007\022\t\n\005INT64\020\010\022\t\n\005UI" + + "NT8\020\t\022\n\n\006UINT16\020\n\022\n\n\006UINT32\020\013\022\n\n\006UINT64\020" + + "\014B\341\001\n#com.google.cloud.aiplatform.v1beta" + + "1B\nTypesProtoP\001ZCcloud.google.com/go/aip" + + "latform/apiv1beta1/aiplatformpb;aiplatfo" + + "rmpb\252\002\037Google.Cloud.AIPlatform.V1Beta1\312\002" + + "\037Google\\Cloud\\AIPlatform\\V1beta1\352\002\"Googl" + + "e::Cloud::AIPlatform::V1beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -99,6 +124,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Values", }); + internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1beta1_Tensor_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor, + new java.lang.String[] { + "Dtype", + "Shape", + "BoolVal", + "StringVal", + "BytesVal", + "FloatVal", + "DoubleVal", + "IntVal", + "Int64Val", + "UintVal", + "Uint64Val", + "ListVal", + "StructVal", + "TensorVal", + }); + internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_descriptor = + internal_static_google_cloud_aiplatform_v1beta1_Tensor_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_Tensor_StructValEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/persistent_resource.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/persistent_resource.proto index 9982102cfb4b..44ce3e0a723a 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/persistent_resource.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/persistent_resource.proto @@ -62,8 +62,8 @@ message PersistentResource { ERROR = 5; } - // Output only. Resource name of a PersistentResource. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Immutable. Resource name of a PersistentResource. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Optional. The display name of the PersistentResource. // The name can be up to 128 characters long and can consist of any UTF-8 @@ -134,6 +134,10 @@ message PersistentResource { ResourceRuntimeSpec resource_runtime_spec = 13 [(google.api.field_behavior) = OPTIONAL]; + // Output only. Runtime information of the Persistent Resource. + ResourceRuntime resource_runtime = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // Optional. A list of names for the reserved ip ranges under the VPC network // that can be used for this persistent resource. // @@ -200,6 +204,36 @@ message ResourceRuntimeSpec { // Optional. Configure the use of workload identity on the PersistentResource ServiceAccountSpec service_account_spec = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Ray cluster configuration. + // Required when creating a dedicated RayCluster on the PersistentResource. + RaySpec ray_spec = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration information for the Ray cluster. +// For experimental launch, Ray cluster creation and Persistent +// cluster creation are 1:1 mapping: We will provision all the nodes within the +// Persistent cluster as Ray nodes. +message RaySpec { + // Optional. Default image for user to choose a preferred ML framework(e.g. + // tensorflow or Pytorch) by choosing from Vertex prebuild + // images(https://cloud.google.com/vertex-ai/docs/training/pre-built-containers). + // Either this or the resource_pool_images is required. Use this field if + // you need all the resource pools to have the same Ray image, Otherwise, use + // the {@code resource_pool_images} field. + string image_uri = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Persistent Cluster runtime information as output +message ResourceRuntime { + // Output only. URIs for user to connect to the Cluster. + // Example: + // { + // "RAY_HEAD_NODE_INTERNAL_IP": "head-node-IP:10001" + // "RAY_DASHBOARD_URI": "ray-dashboard-address:8888" + // } + map access_uris = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Configuration for the use of custom service account to run the workloads. diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto index c96f0f241124..6a1c720d2403 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; import "google/api/resource.proto"; import "google/cloud/aiplatform/v1beta1/explanation.proto"; +import "google/cloud/aiplatform/v1beta1/types.proto"; import "google/protobuf/struct.proto"; option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1"; @@ -74,6 +75,20 @@ service PredictionService { option (google.api.method_signature) = "endpoint,http_body"; } + // Perform a server-side streaming online prediction request for Vertex + // LLM streaming. + rpc ServerStreamingPredict(StreamingPredictRequest) + returns (stream StreamingPredictResponse) { + option (google.api.http) = { + post: "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:serverStreamingPredict" + body: "*" + additional_bindings { + post: "/v1beta1/{endpoint=projects/*/locations/*/publishers/*/models/*}:serverStreamingPredict" + body: "*" + } + }; + } + // Perform an online explanation. // // If @@ -160,6 +175,11 @@ message PredictResponse { // name][google.cloud.aiplatform.v1beta1.Model.display_name] of the Model // which is deployed as the DeployedModel that this prediction hits. string model_display_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Request-level metadata returned by the model. The metadata + // type will be dependent upon the model implementation. + google.protobuf.Value metadata = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Request message for @@ -193,6 +213,41 @@ message RawPredictRequest { google.api.HttpBody http_body = 2; } +// Request message for +// [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict]. +// +// The first message must contain +// [endpoint][google.cloud.aiplatform.v1beta1.StreamingPredictRequest.endpoint] +// field and optionally [input][]. The subsequent messages must contain +// [input][]. +message StreamingPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // The prediction input. + repeated Tensor inputs = 2; + + // The parameters that govern the prediction. + Tensor parameters = 3; +} + +// Response message for +// [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict]. +message StreamingPredictResponse { + // The prediction output. + repeated Tensor outputs = 1; + + // The parameters that govern the prediction. + Tensor parameters = 2; +} + // Request message for // [PredictionService.Explain][google.cloud.aiplatform.v1beta1.PredictionService.Explain]. message ExplainRequest { diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/types.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/types.proto index 48e3d118ef99..721f13f9297b 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/types.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/types.proto @@ -47,3 +47,90 @@ message StringArray { // A list of string values. repeated string values = 1; } + +// A tensor value type. +message Tensor { + // Data type of the tensor. + enum DataType { + // Not a legal value for DataType. Used to indicate a DataType field has not + // been set. + DATA_TYPE_UNSPECIFIED = 0; + + // Data types that all computation devices are expected to be + // capable to support. + BOOL = 1; + + STRING = 2; + + FLOAT = 3; + + DOUBLE = 4; + + INT8 = 5; + + INT16 = 6; + + INT32 = 7; + + INT64 = 8; + + UINT8 = 9; + + UINT16 = 10; + + UINT32 = 11; + + UINT64 = 12; + } + + // The data type of tensor. + DataType dtype = 1; + + // Shape of the tensor. + repeated int64 shape = 2; + + // Type specific representations that make it easy to create tensor protos in + // all languages. Only the representation corresponding to "dtype" can + // be set. The values hold the flattened representation of the tensor in + // row major order. + // + // [BOOL][google.aiplatform.master.Tensor.DataType.BOOL] + repeated bool bool_val = 3; + + // [STRING][google.aiplatform.master.Tensor.DataType.STRING] + repeated string string_val = 14; + + // [STRING][google.aiplatform.master.Tensor.DataType.STRING] + repeated bytes bytes_val = 15; + + // [FLOAT][google.aiplatform.master.Tensor.DataType.FLOAT] + repeated float float_val = 5; + + // [DOUBLE][google.aiplatform.master.Tensor.DataType.DOUBLE] + repeated double double_val = 6; + + // [INT_8][google.aiplatform.master.Tensor.DataType.INT8] + // [INT_16][google.aiplatform.master.Tensor.DataType.INT16] + // [INT_32][google.aiplatform.master.Tensor.DataType.INT32] + repeated int32 int_val = 7; + + // [INT64][google.aiplatform.master.Tensor.DataType.INT64] + repeated int64 int64_val = 8; + + // [UINT8][google.aiplatform.master.Tensor.DataType.UINT8] + // [UINT16][google.aiplatform.master.Tensor.DataType.UINT16] + // [UINT32][google.aiplatform.master.Tensor.DataType.UINT32] + repeated uint32 uint_val = 9; + + // [UINT64][google.aiplatform.master.Tensor.DataType.UINT64] + repeated uint64 uint64_val = 10; + + // A list of tensor values. + repeated Tensor list_val = 11; + + // A map of string to tensor. + map struct_val = 12; + + // Serialized raw tensor content. + bytes tensor_val = 13; +} diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..33d78dcc76f7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DatasetServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + DatasetServiceSettings datasetServiceSettings = + DatasetServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings); + } +} +// [END aiplatform_v1_generated_DatasetService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..9d0df28da118 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DatasetServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + DatasetServiceSettings datasetServiceSettings = + DatasetServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings); + } +} +// [END aiplatform_v1_generated_DatasetService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDataset.java new file mode 100644 index 000000000000..3dafcbf2860e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDataset.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_CreateDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateDataset { + + public static void main(String[] args) throws Exception { + asyncCreateDataset(); + } + + public static void asyncCreateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + ApiFuture future = + datasetServiceClient.createDatasetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_CreateDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDatasetLRO.java new file mode 100644 index 000000000000..3b95ef90b6d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/AsyncCreateDatasetLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_CreateDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateDatasetOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncCreateDatasetLRO(); + } + + public static void asyncCreateDatasetLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + OperationFuture future = + datasetServiceClient.createDatasetOperationCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_CreateDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDataset.java new file mode 100644 index 000000000000..60039dbd345c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDataset.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_CreateDataset_sync] +import com.google.cloud.aiplatform.v1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDataset { + + public static void main(String[] args) throws Exception { + syncCreateDataset(); + } + + public static void syncCreateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.createDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_CreateDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java new file mode 100644 index 000000000000..5990814e62e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_CreateDataset_LocationnameDataset_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDatasetLocationnameDataset { + + public static void main(String[] args) throws Exception { + syncCreateDatasetLocationnameDataset(); + } + + public static void syncCreateDatasetLocationnameDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Dataset dataset = Dataset.newBuilder().build(); + Dataset response = datasetServiceClient.createDatasetAsync(parent, dataset).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_CreateDataset_LocationnameDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java new file mode 100644 index 000000000000..410bd25d545d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_CreateDataset_StringDataset_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDatasetStringDataset { + + public static void main(String[] args) throws Exception { + syncCreateDatasetStringDataset(); + } + + public static void syncCreateDatasetStringDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Dataset dataset = Dataset.newBuilder().build(); + Dataset response = datasetServiceClient.createDatasetAsync(parent, dataset).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_CreateDataset_StringDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDataset.java new file mode 100644 index 000000000000..797a2040fa29 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDataset.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteDatasetRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteDataset { + + public static void main(String[] args) throws Exception { + asyncDeleteDataset(); + } + + public static void asyncDeleteDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + ApiFuture future = + datasetServiceClient.deleteDatasetCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java new file mode 100644 index 000000000000..662404de3b34 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteDatasetRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDatasetLRO(); + } + + public static void asyncDeleteDatasetLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + OperationFuture future = + datasetServiceClient.deleteDatasetOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDataset.java new file mode 100644 index 000000000000..02f880a2127a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDataset.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteDataset_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteDatasetRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteDataset { + + public static void main(String[] args) throws Exception { + syncDeleteDataset(); + } + + public static void syncDeleteDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + datasetServiceClient.deleteDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java new file mode 100644 index 000000000000..db9d7e533ba4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteDataset_Datasetname_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDatasetDatasetname { + + public static void main(String[] args) throws Exception { + syncDeleteDatasetDatasetname(); + } + + public static void syncDeleteDatasetDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + datasetServiceClient.deleteDatasetAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteDataset_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetString.java new file mode 100644 index 000000000000..08e674947902 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletedataset/SyncDeleteDatasetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteDataset_String_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDatasetString { + + public static void main(String[] args) throws Exception { + syncDeleteDatasetString(); + } + + public static void syncDeleteDatasetString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + datasetServiceClient.deleteDatasetAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java new file mode 100644 index 000000000000..f49904e48d63 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteSavedQuery_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.longrunning.Operation; + +public class AsyncDeleteSavedQuery { + + public static void main(String[] args) throws Exception { + asyncDeleteSavedQuery(); + } + + public static void asyncDeleteSavedQuery() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + ApiFuture future = + datasetServiceClient.deleteSavedQueryCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteSavedQuery_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java new file mode 100644 index 000000000000..f58cd352a9e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteSavedQuery_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.protobuf.Empty; + +public class AsyncDeleteSavedQueryLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSavedQueryLRO(); + } + + public static void asyncDeleteSavedQueryLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + OperationFuture future = + datasetServiceClient.deleteSavedQueryOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteSavedQuery_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java new file mode 100644 index 000000000000..9cc1cd546fbc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteSavedQuery_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQuery { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQuery(); + } + + public static void syncDeleteSavedQuery() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + datasetServiceClient.deleteSavedQueryAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteSavedQuery_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java new file mode 100644 index 000000000000..e4e08f862695 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteSavedQuery_Savedqueryname_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQuerySavedqueryname { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQuerySavedqueryname(); + } + + public static void syncDeleteSavedQuerySavedqueryname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SavedQueryName name = + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]"); + datasetServiceClient.deleteSavedQueryAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteSavedQuery_Savedqueryname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java new file mode 100644 index 000000000000..0d10890bda0f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_DeleteSavedQuery_String_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQueryString { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQueryString(); + } + + public static void syncDeleteSavedQueryString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]").toString(); + datasetServiceClient.deleteSavedQueryAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_DeleteSavedQuery_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportData.java new file mode 100644 index 000000000000..e3e3f4b6dcba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportData.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ExportData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ExportDataConfig; +import com.google.cloud.aiplatform.v1.ExportDataRequest; +import com.google.longrunning.Operation; + +public class AsyncExportData { + + public static void main(String[] args) throws Exception { + asyncExportData(); + } + + public static void asyncExportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.exportDataCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ExportData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportDataLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportDataLRO.java new file mode 100644 index 000000000000..78c0162fc71a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/AsyncExportDataLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ExportData_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ExportDataConfig; +import com.google.cloud.aiplatform.v1.ExportDataOperationMetadata; +import com.google.cloud.aiplatform.v1.ExportDataRequest; +import com.google.cloud.aiplatform.v1.ExportDataResponse; + +public class AsyncExportDataLRO { + + public static void main(String[] args) throws Exception { + asyncExportDataLRO(); + } + + public static void asyncExportDataLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + OperationFuture future = + datasetServiceClient.exportDataOperationCallable().futureCall(request); + // Do something. + ExportDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ExportData_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportData.java new file mode 100644 index 000000000000..c736a51524db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportData.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ExportData_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ExportDataConfig; +import com.google.cloud.aiplatform.v1.ExportDataRequest; +import com.google.cloud.aiplatform.v1.ExportDataResponse; + +public class SyncExportData { + + public static void main(String[] args) throws Exception { + syncExportData(); + } + + public static void syncExportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ExportData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java new file mode 100644 index 000000000000..916e1a19e225 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ExportData_DatasetnameExportdataconfig_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ExportDataConfig; +import com.google.cloud.aiplatform.v1.ExportDataResponse; + +public class SyncExportDataDatasetnameExportdataconfig { + + public static void main(String[] args) throws Exception { + syncExportDataDatasetnameExportdataconfig(); + } + + public static void syncExportDataDatasetnameExportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + ExportDataConfig exportConfig = ExportDataConfig.newBuilder().build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(name, exportConfig).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ExportData_DatasetnameExportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java new file mode 100644 index 000000000000..2cc23496a244 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ExportData_StringExportdataconfig_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ExportDataConfig; +import com.google.cloud.aiplatform.v1.ExportDataResponse; + +public class SyncExportDataStringExportdataconfig { + + public static void main(String[] args) throws Exception { + syncExportDataStringExportdataconfig(); + } + + public static void syncExportDataStringExportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + ExportDataConfig exportConfig = ExportDataConfig.newBuilder().build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(name, exportConfig).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ExportData_StringExportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java new file mode 100644 index 000000000000..2aa61a9a5018 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetAnnotationSpec_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.AnnotationSpec; +import com.google.cloud.aiplatform.v1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.GetAnnotationSpecRequest; +import com.google.protobuf.FieldMask; + +public class AsyncGetAnnotationSpec { + + public static void main(String[] args) throws Exception { + asyncGetAnnotationSpec(); + } + + public static void asyncGetAnnotationSpec() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetAnnotationSpecRequest request = + GetAnnotationSpecRequest.newBuilder() + .setName( + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + datasetServiceClient.getAnnotationSpecCallable().futureCall(request); + // Do something. + AnnotationSpec response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetAnnotationSpec_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java new file mode 100644 index 000000000000..e1d9375d7bb2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetAnnotationSpec_sync] +import com.google.cloud.aiplatform.v1.AnnotationSpec; +import com.google.cloud.aiplatform.v1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.GetAnnotationSpecRequest; +import com.google.protobuf.FieldMask; + +public class SyncGetAnnotationSpec { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpec(); + } + + public static void syncGetAnnotationSpec() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetAnnotationSpecRequest request = + GetAnnotationSpecRequest.newBuilder() + .setName( + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetAnnotationSpec_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java new file mode 100644 index 000000000000..a497abd46b1b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetAnnotationSpec_Annotationspecname_sync] +import com.google.cloud.aiplatform.v1.AnnotationSpec; +import com.google.cloud.aiplatform.v1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncGetAnnotationSpecAnnotationspecname { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpecAnnotationspecname(); + } + + public static void syncGetAnnotationSpecAnnotationspecname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + AnnotationSpecName name = + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(name); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetAnnotationSpec_Annotationspecname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java new file mode 100644 index 000000000000..117e31e37cdc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetAnnotationSpec_String_sync] +import com.google.cloud.aiplatform.v1.AnnotationSpec; +import com.google.cloud.aiplatform.v1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncGetAnnotationSpecString { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpecString(); + } + + public static void syncGetAnnotationSpecString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString(); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(name); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetAnnotationSpec_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/AsyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/AsyncGetDataset.java new file mode 100644 index 000000000000..138f91c4ced1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/AsyncGetDataset.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.GetDatasetRequest; +import com.google.protobuf.FieldMask; + +public class AsyncGetDataset { + + public static void main(String[] args) throws Exception { + asyncGetDataset(); + } + + public static void asyncGetDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetDatasetRequest request = + GetDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.getDatasetCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..e37bf349c82a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDataset.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetDataset_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.GetDatasetRequest; +import com.google.protobuf.FieldMask; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetDatasetRequest request = + GetDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.getDataset(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetDatasetname.java new file mode 100644 index 000000000000..fbf74f602ff7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetDatasetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetDataset_Datasetname_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncGetDatasetDatasetname { + + public static void main(String[] args) throws Exception { + syncGetDatasetDatasetname(); + } + + public static void syncGetDatasetDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + Dataset response = datasetServiceClient.getDataset(name); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetDataset_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetString.java new file mode 100644 index 000000000000..840cddddff14 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getdataset/SyncGetDatasetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetDataset_String_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncGetDatasetString { + + public static void main(String[] args) throws Exception { + syncGetDatasetString(); + } + + public static void syncGetDatasetString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + Dataset response = datasetServiceClient.getDataset(name); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..941d1be175af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..b3392994bef3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = datasetServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..8ead75463080 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = datasetServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..a8ac084a72d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = datasetServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportData.java new file mode 100644 index 000000000000..8b1406ff6d3d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportData.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ImportData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ImportDataConfig; +import com.google.cloud.aiplatform.v1.ImportDataRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncImportData { + + public static void main(String[] args) throws Exception { + asyncImportData(); + } + + public static void asyncImportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + ApiFuture future = datasetServiceClient.importDataCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ImportData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportDataLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportDataLRO.java new file mode 100644 index 000000000000..f38509a9edf9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/AsyncImportDataLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ImportData_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ImportDataConfig; +import com.google.cloud.aiplatform.v1.ImportDataOperationMetadata; +import com.google.cloud.aiplatform.v1.ImportDataRequest; +import com.google.cloud.aiplatform.v1.ImportDataResponse; +import java.util.ArrayList; + +public class AsyncImportDataLRO { + + public static void main(String[] args) throws Exception { + asyncImportDataLRO(); + } + + public static void asyncImportDataLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + OperationFuture future = + datasetServiceClient.importDataOperationCallable().futureCall(request); + // Do something. + ImportDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ImportData_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportData.java new file mode 100644 index 000000000000..a0c62580ef26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportData.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ImportData_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ImportDataConfig; +import com.google.cloud.aiplatform.v1.ImportDataRequest; +import com.google.cloud.aiplatform.v1.ImportDataResponse; +import java.util.ArrayList; + +public class SyncImportData { + + public static void main(String[] args) throws Exception { + syncImportData(); + } + + public static void syncImportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + ImportDataResponse response = datasetServiceClient.importDataAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ImportData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java new file mode 100644 index 000000000000..94281cdbdbc9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ImportData_DatasetnameListimportdataconfig_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ImportDataConfig; +import com.google.cloud.aiplatform.v1.ImportDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncImportDataDatasetnameListimportdataconfig { + + public static void main(String[] args) throws Exception { + syncImportDataDatasetnameListimportdataconfig(); + } + + public static void syncImportDataDatasetnameListimportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + List importConfigs = new ArrayList<>(); + ImportDataResponse response = datasetServiceClient.importDataAsync(name, importConfigs).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ImportData_DatasetnameListimportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java new file mode 100644 index 000000000000..beca588c7000 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ImportData_StringListimportdataconfig_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ImportDataConfig; +import com.google.cloud.aiplatform.v1.ImportDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncImportDataStringListimportdataconfig { + + public static void main(String[] args) throws Exception { + syncImportDataStringListimportdataconfig(); + } + + public static void syncImportDataStringListimportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + List importConfigs = new ArrayList<>(); + ImportDataResponse response = datasetServiceClient.importDataAsync(name, importConfigs).get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_ImportData_StringListimportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotations.java new file mode 100644 index 000000000000..2d474f420923 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotations.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListAnnotations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Annotation; +import com.google.cloud.aiplatform.v1.DataItemName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListAnnotationsRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListAnnotations { + + public static void main(String[] args) throws Exception { + asyncListAnnotations(); + } + + public static void asyncListAnnotations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listAnnotationsPagedCallable().futureCall(request); + // Do something. + for (Annotation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListAnnotations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotationsPaged.java new file mode 100644 index 000000000000..0f3be692bfa0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/AsyncListAnnotationsPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListAnnotations_Paged_async] +import com.google.cloud.aiplatform.v1.Annotation; +import com.google.cloud.aiplatform.v1.DataItemName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListAnnotationsRequest; +import com.google.cloud.aiplatform.v1.ListAnnotationsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListAnnotationsPaged { + + public static void main(String[] args) throws Exception { + asyncListAnnotationsPaged(); + } + + public static void asyncListAnnotationsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListAnnotationsResponse response = + datasetServiceClient.listAnnotationsCallable().call(request); + for (Annotation element : response.getAnnotationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListAnnotations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotations.java new file mode 100644 index 000000000000..c1b7842e7f7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListAnnotations_sync] +import com.google.cloud.aiplatform.v1.Annotation; +import com.google.cloud.aiplatform.v1.DataItemName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListAnnotationsRequest; +import com.google.protobuf.FieldMask; + +public class SyncListAnnotations { + + public static void main(String[] args) throws Exception { + syncListAnnotations(); + } + + public static void syncListAnnotations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Annotation element : datasetServiceClient.listAnnotations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListAnnotations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java new file mode 100644 index 000000000000..790f406756df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListAnnotations_Dataitemname_sync] +import com.google.cloud.aiplatform.v1.Annotation; +import com.google.cloud.aiplatform.v1.DataItemName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncListAnnotationsDataitemname { + + public static void main(String[] args) throws Exception { + syncListAnnotationsDataitemname(); + } + + public static void syncListAnnotationsDataitemname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]"); + for (Annotation element : datasetServiceClient.listAnnotations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListAnnotations_Dataitemname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsString.java new file mode 100644 index 000000000000..bf9f07cad08e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listannotations/SyncListAnnotationsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListAnnotations_String_sync] +import com.google.cloud.aiplatform.v1.Annotation; +import com.google.cloud.aiplatform.v1.DataItemName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncListAnnotationsString { + + public static void main(String[] args) throws Exception { + syncListAnnotationsString(); + } + + public static void syncListAnnotationsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString(); + for (Annotation element : datasetServiceClient.listAnnotations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListAnnotations_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItems.java new file mode 100644 index 000000000000..d8d51fa61a63 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItems.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDataItems_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DataItem; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDataItemsRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListDataItems { + + public static void main(String[] args) throws Exception { + asyncListDataItems(); + } + + public static void asyncListDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listDataItemsPagedCallable().futureCall(request); + // Do something. + for (DataItem element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDataItems_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItemsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItemsPaged.java new file mode 100644 index 000000000000..90c2e4bd7793 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/AsyncListDataItemsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDataItems_Paged_async] +import com.google.cloud.aiplatform.v1.DataItem; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDataItemsRequest; +import com.google.cloud.aiplatform.v1.ListDataItemsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDataItemsPaged { + + public static void main(String[] args) throws Exception { + asyncListDataItemsPaged(); + } + + public static void asyncListDataItemsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDataItemsResponse response = datasetServiceClient.listDataItemsCallable().call(request); + for (DataItem element : response.getDataItemsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDataItems_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItems.java new file mode 100644 index 000000000000..aa585da54538 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItems.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDataItems_sync] +import com.google.cloud.aiplatform.v1.DataItem; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDataItemsRequest; +import com.google.protobuf.FieldMask; + +public class SyncListDataItems { + + public static void main(String[] args) throws Exception { + syncListDataItems(); + } + + public static void syncListDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (DataItem element : datasetServiceClient.listDataItems(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDataItems_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java new file mode 100644 index 000000000000..2225dabaae6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDataItems_Datasetname_sync] +import com.google.cloud.aiplatform.v1.DataItem; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncListDataItemsDatasetname { + + public static void main(String[] args) throws Exception { + syncListDataItemsDatasetname(); + } + + public static void syncListDataItemsDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + for (DataItem element : datasetServiceClient.listDataItems(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDataItems_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsString.java new file mode 100644 index 000000000000..eab79210dc26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdataitems/SyncListDataItemsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDataItems_String_sync] +import com.google.cloud.aiplatform.v1.DataItem; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; + +public class SyncListDataItemsString { + + public static void main(String[] args) throws Exception { + syncListDataItemsString(); + } + + public static void syncListDataItemsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + for (DataItem element : datasetServiceClient.listDataItems(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDataItems_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasets.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasets.java new file mode 100644 index 000000000000..61ea8ceec35b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasets.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDatasets_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListDatasets { + + public static void main(String[] args) throws Exception { + asyncListDatasets(); + } + + public static void asyncListDatasets() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listDatasetsPagedCallable().futureCall(request); + // Do something. + for (Dataset element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDatasets_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasetsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasetsPaged.java new file mode 100644 index 000000000000..74fbd1f52783 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/AsyncListDatasetsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDatasets_Paged_async] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1.ListDatasetsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDatasetsPaged { + + public static void main(String[] args) throws Exception { + asyncListDatasetsPaged(); + } + + public static void asyncListDatasetsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDatasetsResponse response = datasetServiceClient.listDatasetsCallable().call(request); + for (Dataset element : response.getDatasetsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDatasets_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasets.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasets.java new file mode 100644 index 000000000000..31819b465b8c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasets.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDatasets_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListDatasets { + + public static void main(String[] args) throws Exception { + syncListDatasets(); + } + + public static void syncListDatasets() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Dataset element : datasetServiceClient.listDatasets(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDatasets_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsLocationname.java new file mode 100644 index 000000000000..7159ea0b0bec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDatasets_Locationname_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListDatasetsLocationname { + + public static void main(String[] args) throws Exception { + syncListDatasetsLocationname(); + } + + public static void syncListDatasetsLocationname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Dataset element : datasetServiceClient.listDatasets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDatasets_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsString.java new file mode 100644 index 000000000000..e5fe7ae2c0a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listdatasets/SyncListDatasetsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListDatasets_String_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListDatasetsString { + + public static void main(String[] args) throws Exception { + syncListDatasetsString(); + } + + public static void syncListDatasetsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Dataset element : datasetServiceClient.listDatasets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListDatasets_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..52fbbac45b42 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datasetServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..492fdff6f020 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = datasetServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..26f7dce8cd0d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : datasetServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueries.java new file mode 100644 index 000000000000..e54e51db7472 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListSavedQueries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1.SavedQuery; +import com.google.protobuf.FieldMask; + +public class AsyncListSavedQueries { + + public static void main(String[] args) throws Exception { + asyncListSavedQueries(); + } + + public static void asyncListSavedQueries() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listSavedQueriesPagedCallable().futureCall(request); + // Do something. + for (SavedQuery element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListSavedQueries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java new file mode 100644 index 000000000000..5d84608cee01 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListSavedQueries_Paged_async] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1.ListSavedQueriesResponse; +import com.google.cloud.aiplatform.v1.SavedQuery; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListSavedQueriesPaged { + + public static void main(String[] args) throws Exception { + asyncListSavedQueriesPaged(); + } + + public static void asyncListSavedQueriesPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSavedQueriesResponse response = + datasetServiceClient.listSavedQueriesCallable().call(request); + for (SavedQuery element : response.getSavedQueriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListSavedQueries_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueries.java new file mode 100644 index 000000000000..e9c609dde55e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListSavedQueries_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1.SavedQuery; +import com.google.protobuf.FieldMask; + +public class SyncListSavedQueries { + + public static void main(String[] args) throws Exception { + syncListSavedQueries(); + } + + public static void syncListSavedQueries() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (SavedQuery element : datasetServiceClient.listSavedQueries(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListSavedQueries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java new file mode 100644 index 000000000000..a7f5141bf78d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListSavedQueries_Datasetname_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQuery; + +public class SyncListSavedQueriesDatasetname { + + public static void main(String[] args) throws Exception { + syncListSavedQueriesDatasetname(); + } + + public static void syncListSavedQueriesDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListSavedQueries_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java new file mode 100644 index 000000000000..944fb3c1593a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_ListSavedQueries_String_sync] +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQuery; + +public class SyncListSavedQueriesString { + + public static void main(String[] args) throws Exception { + syncListSavedQueriesString(); + } + + public static void syncListSavedQueriesString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_ListSavedQueries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItems.java new file mode 100644 index 000000000000..daed4b327950 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItems.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_SearchDataItems_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DataItemView; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.cloud.aiplatform.v1.SearchDataItemsRequest; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncSearchDataItems { + + public static void main(String[] args) throws Exception { + asyncSearchDataItems(); + } + + public static void asyncSearchDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datasetServiceClient.searchDataItemsPagedCallable().futureCall(request); + // Do something. + for (DataItemView element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_SearchDataItems_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java new file mode 100644 index 000000000000..a5df877cbbc7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_SearchDataItems_Paged_async] +import com.google.cloud.aiplatform.v1.DataItemView; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.cloud.aiplatform.v1.SearchDataItemsRequest; +import com.google.cloud.aiplatform.v1.SearchDataItemsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncSearchDataItemsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchDataItemsPaged(); + } + + public static void asyncSearchDataItemsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchDataItemsResponse response = + datasetServiceClient.searchDataItemsCallable().call(request); + for (DataItemView element : response.getDataItemViewsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_SearchDataItems_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/SyncSearchDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/SyncSearchDataItems.java new file mode 100644 index 000000000000..7a6a85c761fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/searchdataitems/SyncSearchDataItems.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_SearchDataItems_sync] +import com.google.cloud.aiplatform.v1.DataItemView; +import com.google.cloud.aiplatform.v1.DatasetName; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.SavedQueryName; +import com.google.cloud.aiplatform.v1.SearchDataItemsRequest; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncSearchDataItems { + + public static void main(String[] args) throws Exception { + syncSearchDataItems(); + } + + public static void syncSearchDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + for (DataItemView element : datasetServiceClient.searchDataItems(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_DatasetService_SearchDataItems_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..fc7b8ebe736e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..d161362d89dc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = datasetServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..8339dfb28a38 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + datasetServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..6af6ba8dac4e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = datasetServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/AsyncUpdateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/AsyncUpdateDataset.java new file mode 100644 index 000000000000..1c30f25fa4be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/AsyncUpdateDataset.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_UpdateDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.UpdateDatasetRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateDataset { + + public static void main(String[] args) throws Exception { + asyncUpdateDataset(); + } + + public static void asyncUpdateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + UpdateDatasetRequest request = + UpdateDatasetRequest.newBuilder() + .setDataset(Dataset.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.updateDatasetCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1_generated_DatasetService_UpdateDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDataset.java new file mode 100644 index 000000000000..0c12670afc7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDataset.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_UpdateDataset_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1.UpdateDatasetRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDataset { + + public static void main(String[] args) throws Exception { + syncUpdateDataset(); + } + + public static void syncUpdateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + UpdateDatasetRequest request = + UpdateDatasetRequest.newBuilder() + .setDataset(Dataset.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.updateDataset(request); + } + } +} +// [END aiplatform_v1_generated_DatasetService_UpdateDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java new file mode 100644 index 000000000000..5b2eba40db49 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetService_UpdateDataset_DatasetFieldmask_sync] +import com.google.cloud.aiplatform.v1.Dataset; +import com.google.cloud.aiplatform.v1.DatasetServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDatasetDatasetFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateDatasetDatasetFieldmask(); + } + + public static void syncUpdateDatasetDatasetFieldmask() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + Dataset dataset = Dataset.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Dataset response = datasetServiceClient.updateDataset(dataset, updateMask); + } + } +} +// [END aiplatform_v1_generated_DatasetService_UpdateDataset_DatasetFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservicesettings/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservicesettings/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..6acad175d5a1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/datasetservicesettings/getdataset/SyncGetDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_DatasetServiceSettings_GetDataset_sync] +import com.google.cloud.aiplatform.v1.DatasetServiceSettings; +import java.time.Duration; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 + DatasetServiceSettings.Builder datasetServiceSettingsBuilder = + DatasetServiceSettings.newBuilder(); + datasetServiceSettingsBuilder + .getDatasetSettings() + .setRetrySettings( + datasetServiceSettingsBuilder + .getDatasetSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatasetServiceSettings datasetServiceSettings = datasetServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_DatasetServiceSettings_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..31f46e985273 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.EndpointServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + EndpointServiceSettings endpointServiceSettings = + EndpointServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + EndpointServiceClient endpointServiceClient = + EndpointServiceClient.create(endpointServiceSettings); + } +} +// [END aiplatform_v1_generated_EndpointService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a09191aa1fec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.EndpointServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + EndpointServiceSettings endpointServiceSettings = + EndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + EndpointServiceClient endpointServiceClient = + EndpointServiceClient.create(endpointServiceSettings); + } +} +// [END aiplatform_v1_generated_EndpointService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpoint.java new file mode 100644 index 000000000000..7f135494fc8a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateEndpoint { + + public static void main(String[] args) throws Exception { + asyncCreateEndpoint(); + } + + public static void asyncCreateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + CreateEndpointRequest request = + CreateEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setEndpoint(Endpoint.newBuilder().build()) + .setEndpointId("endpointId-1837754992") + .build(); + ApiFuture future = + endpointServiceClient.createEndpointCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java new file mode 100644 index 000000000000..9f8058450384 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateEndpointOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncCreateEndpointLRO(); + } + + public static void asyncCreateEndpointLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + CreateEndpointRequest request = + CreateEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setEndpoint(Endpoint.newBuilder().build()) + .setEndpointId("endpointId-1837754992") + .build(); + OperationFuture future = + endpointServiceClient.createEndpointOperationCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpoint.java new file mode 100644 index 000000000000..85861f8d0835 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_sync] +import com.google.cloud.aiplatform.v1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpoint(); + } + + public static void syncCreateEndpoint() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java new file mode 100644 index 000000000000..44ed327e3057 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_LocationnameEndpoint_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateEndpointLocationnameEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpointLocationnameEndpoint(); + } + + public static void syncCreateEndpointLocationnameEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Endpoint endpoint = Endpoint.newBuilder().build(); + Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_LocationnameEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java new file mode 100644 index 000000000000..fa2ca2cc6af8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_LocationnameEndpointString_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateEndpointLocationnameEndpointString { + + public static void main(String[] args) throws Exception { + syncCreateEndpointLocationnameEndpointString(); + } + + public static void syncCreateEndpointLocationnameEndpointString() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_LocationnameEndpointString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java new file mode 100644 index 000000000000..5547a0e7418f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_StringEndpoint_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateEndpointStringEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpointStringEndpoint(); + } + + public static void syncCreateEndpointStringEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Endpoint endpoint = Endpoint.newBuilder().build(); + Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_StringEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java new file mode 100644 index 000000000000..3f76deaa822f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_CreateEndpoint_StringEndpointString_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateEndpointStringEndpointString { + + public static void main(String[] args) throws Exception { + syncCreateEndpointStringEndpointString(); + } + + public static void syncCreateEndpointStringEndpointString() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_CreateEndpoint_StringEndpointString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java new file mode 100644 index 000000000000..0ad35c8adb50 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeleteEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteEndpoint { + + public static void main(String[] args) throws Exception { + asyncDeleteEndpoint(); + } + + public static void asyncDeleteEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + ApiFuture future = + endpointServiceClient.deleteEndpointCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeleteEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java new file mode 100644 index 000000000000..152e3befa220 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeleteEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteEndpointLRO(); + } + + public static void asyncDeleteEndpointLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + OperationFuture future = + endpointServiceClient.deleteEndpointOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeleteEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java new file mode 100644 index 000000000000..75b7ee77c743 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeleteEndpoint_sync] +import com.google.cloud.aiplatform.v1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpoint { + + public static void main(String[] args) throws Exception { + syncDeleteEndpoint(); + } + + public static void syncDeleteEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + endpointServiceClient.deleteEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeleteEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java new file mode 100644 index 000000000000..5bf3a2c14c30 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeleteEndpoint_Endpointname_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpointEndpointname { + + public static void main(String[] args) throws Exception { + syncDeleteEndpointEndpointname(); + } + + public static void syncDeleteEndpointEndpointname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + endpointServiceClient.deleteEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeleteEndpoint_Endpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java new file mode 100644 index 000000000000..0930d8ae3e94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeleteEndpoint_String_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpointString { + + public static void main(String[] args) throws Exception { + syncDeleteEndpointString(); + } + + public static void syncDeleteEndpointString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + endpointServiceClient.deleteEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeleteEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModel.java new file mode 100644 index 000000000000..a70391196bfb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModel.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeployModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeployModelRequest; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.longrunning.Operation; +import java.util.HashMap; + +public class AsyncDeployModel { + + public static void main(String[] args) throws Exception { + asyncDeployModel(); + } + + public static void asyncDeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + ApiFuture future = endpointServiceClient.deployModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeployModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModelLRO.java new file mode 100644 index 000000000000..59958727fb47 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/AsyncDeployModelLRO.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeployModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeployModelOperationMetadata; +import com.google.cloud.aiplatform.v1.DeployModelRequest; +import com.google.cloud.aiplatform.v1.DeployModelResponse; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import java.util.HashMap; + +public class AsyncDeployModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeployModelLRO(); + } + + public static void asyncDeployModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + OperationFuture future = + endpointServiceClient.deployModelOperationCallable().futureCall(request); + // Do something. + DeployModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeployModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModel.java new file mode 100644 index 000000000000..ececa6b1ca74 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeployModel_sync] +import com.google.cloud.aiplatform.v1.DeployModelRequest; +import com.google.cloud.aiplatform.v1.DeployModelResponse; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import java.util.HashMap; + +public class SyncDeployModel { + + public static void main(String[] args) throws Exception { + syncDeployModel(); + } + + public static void syncDeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + DeployModelResponse response = endpointServiceClient.deployModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeployModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java new file mode 100644 index 000000000000..7f6bf1e5ad72 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeployModel_EndpointnameDeployedmodelMapstringinteger_sync] +import com.google.cloud.aiplatform.v1.DeployModelResponse; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import java.util.HashMap; +import java.util.Map; + +public class SyncDeployModelEndpointnameDeployedmodelMapstringinteger { + + public static void main(String[] args) throws Exception { + syncDeployModelEndpointnameDeployedmodelMapstringinteger(); + } + + public static void syncDeployModelEndpointnameDeployedmodelMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + Map trafficSplit = new HashMap<>(); + DeployModelResponse response = + endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeployModel_EndpointnameDeployedmodelMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java new file mode 100644 index 000000000000..c391b11d29c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_DeployModel_StringDeployedmodelMapstringinteger_sync] +import com.google.cloud.aiplatform.v1.DeployModelResponse; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import java.util.HashMap; +import java.util.Map; + +public class SyncDeployModelStringDeployedmodelMapstringinteger { + + public static void main(String[] args) throws Exception { + syncDeployModelStringDeployedmodelMapstringinteger(); + } + + public static void syncDeployModelStringDeployedmodelMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + Map trafficSplit = new HashMap<>(); + DeployModelResponse response = + endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_DeployModel_StringDeployedmodelMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/AsyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/AsyncGetEndpoint.java new file mode 100644 index 000000000000..ea9f62356899 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/AsyncGetEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.GetEndpointRequest; + +public class AsyncGetEndpoint { + + public static void main(String[] args) throws Exception { + asyncGetEndpoint(); + } + + public static void asyncGetEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetEndpointRequest request = + GetEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + ApiFuture future = endpointServiceClient.getEndpointCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..279919f73445 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.GetEndpointRequest; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetEndpointRequest request = + GetEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + Endpoint response = endpointServiceClient.getEndpoint(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java new file mode 100644 index 000000000000..6a2afd905baa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetEndpoint_Endpointname_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; + +public class SyncGetEndpointEndpointname { + + public static void main(String[] args) throws Exception { + syncGetEndpointEndpointname(); + } + + public static void syncGetEndpointEndpointname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + Endpoint response = endpointServiceClient.getEndpoint(name); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetEndpoint_Endpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointString.java new file mode 100644 index 000000000000..a5bcf3c3dc74 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getendpoint/SyncGetEndpointString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetEndpoint_String_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; + +public class SyncGetEndpointString { + + public static void main(String[] args) throws Exception { + syncGetEndpointString(); + } + + public static void syncGetEndpointString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + Endpoint response = endpointServiceClient.getEndpoint(name); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..48ee566c39ca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = endpointServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..acfce20e5b2b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = endpointServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..5e1fd3ff0af8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = endpointServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..5ef1c8d57f83 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = endpointServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpoints.java new file mode 100644 index 000000000000..f6c9c6090db3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpoints.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListEndpoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListEndpoints { + + public static void main(String[] args) throws Exception { + asyncListEndpoints(); + } + + public static void asyncListEndpoints() throws Exception { + // 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 (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()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + endpointServiceClient.listEndpointsPagedCallable().futureCall(request); + // Do something. + for (Endpoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListEndpoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpointsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpointsPaged.java new file mode 100644 index 000000000000..41e0952f073e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/AsyncListEndpointsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListEndpoints_Paged_async] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1.ListEndpointsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListEndpointsPaged { + + public static void main(String[] args) throws Exception { + asyncListEndpointsPaged(); + } + + public static void asyncListEndpointsPaged() throws Exception { + // 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 (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()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListEndpointsResponse response = + endpointServiceClient.listEndpointsCallable().call(request); + for (Endpoint element : response.getEndpointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListEndpoints_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpoints.java new file mode 100644 index 000000000000..52ae6b67768c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpoints.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListEndpoints_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListEndpoints { + + public static void main(String[] args) throws Exception { + syncListEndpoints(); + } + + public static void syncListEndpoints() throws Exception { + // 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 (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()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Endpoint element : endpointServiceClient.listEndpoints(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListEndpoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsLocationname.java new file mode 100644 index 000000000000..6323c4cbe2f7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListEndpoints_Locationname_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListEndpointsLocationname { + + public static void main(String[] args) throws Exception { + syncListEndpointsLocationname(); + } + + public static void syncListEndpointsLocationname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListEndpoints_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsString.java new file mode 100644 index 000000000000..bd3da0df87e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listendpoints/SyncListEndpointsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListEndpoints_String_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListEndpointsString { + + public static void main(String[] args) throws Exception { + syncListEndpointsString(); + } + + public static void syncListEndpointsString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListEndpoints_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..7086a4876252 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + endpointServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..4883097d46f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + endpointServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..21fc11122d3d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : endpointServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_EndpointService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java new file mode 100644 index 000000000000..282b65ceed81 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_MutateDeployedModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedModelRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncMutateDeployedModel { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedModel(); + } + + public static void asyncMutateDeployedModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + endpointServiceClient.mutateDeployedModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_MutateDeployedModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java new file mode 100644 index 000000000000..465ccc260ea2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_MutateDeployedModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedModelOperationMetadata; +import com.google.cloud.aiplatform.v1.MutateDeployedModelRequest; +import com.google.cloud.aiplatform.v1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class AsyncMutateDeployedModelLRO { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedModelLRO(); + } + + public static void asyncMutateDeployedModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + endpointServiceClient.mutateDeployedModelOperationCallable().futureCall(request); + // Do something. + MutateDeployedModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_MutateDeployedModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java new file mode 100644 index 000000000000..563ead298f04 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_MutateDeployedModel_sync] +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedModelRequest; +import com.google.cloud.aiplatform.v1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModel { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModel(); + } + + public static void syncMutateDeployedModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_MutateDeployedModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java new file mode 100644 index 000000000000..17fd681d6bac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_MutateDeployedModel_EndpointnameDeployedmodelFieldmask_sync] +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModelEndpointnameDeployedmodelFieldmask(); + } + + public static void syncMutateDeployedModelEndpointnameDeployedmodelFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_MutateDeployedModel_EndpointnameDeployedmodelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java new file mode 100644 index 000000000000..6010770615cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_MutateDeployedModel_StringDeployedmodelFieldmask_sync] +import com.google.cloud.aiplatform.v1.DeployedModel; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModelStringDeployedmodelFieldmask { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModelStringDeployedmodelFieldmask(); + } + + public static void syncMutateDeployedModelStringDeployedmodelFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_MutateDeployedModel_StringDeployedmodelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..35b5a407a68a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = endpointServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..f69a702e3bab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = endpointServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..e0af0bedf329 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + endpointServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..ed16e1cd1095 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = endpointServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModel.java new file mode 100644 index 000000000000..f574c7b11f89 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModel.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UndeployModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployModelRequest; +import com.google.longrunning.Operation; +import java.util.HashMap; + +public class AsyncUndeployModel { + + public static void main(String[] args) throws Exception { + asyncUndeployModel(); + } + + public static void asyncUndeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + ApiFuture future = + endpointServiceClient.undeployModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UndeployModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java new file mode 100644 index 000000000000..fb84f56919cb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UndeployModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployModelOperationMetadata; +import com.google.cloud.aiplatform.v1.UndeployModelRequest; +import com.google.cloud.aiplatform.v1.UndeployModelResponse; +import java.util.HashMap; + +public class AsyncUndeployModelLRO { + + public static void main(String[] args) throws Exception { + asyncUndeployModelLRO(); + } + + public static void asyncUndeployModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + OperationFuture future = + endpointServiceClient.undeployModelOperationCallable().futureCall(request); + // Do something. + UndeployModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UndeployModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModel.java new file mode 100644 index 000000000000..ac796238e7e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModel.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UndeployModel_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployModelRequest; +import com.google.cloud.aiplatform.v1.UndeployModelResponse; +import java.util.HashMap; + +public class SyncUndeployModel { + + public static void main(String[] args) throws Exception { + syncUndeployModel(); + } + + public static void syncUndeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + UndeployModelResponse response = endpointServiceClient.undeployModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UndeployModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java new file mode 100644 index 000000000000..c5db2c5ecf5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UndeployModel_EndpointnameStringMapstringinteger_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployModelResponse; +import java.util.HashMap; +import java.util.Map; + +public class SyncUndeployModelEndpointnameStringMapstringinteger { + + public static void main(String[] args) throws Exception { + syncUndeployModelEndpointnameStringMapstringinteger(); + } + + public static void syncUndeployModelEndpointnameStringMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + String deployedModelId = "deployedModelId-1817547906"; + Map trafficSplit = new HashMap<>(); + UndeployModelResponse response = + endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UndeployModel_EndpointnameStringMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java new file mode 100644 index 000000000000..99280ec38a3e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UndeployModel_StringStringMapstringinteger_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployModelResponse; +import java.util.HashMap; +import java.util.Map; + +public class SyncUndeployModelStringStringMapstringinteger { + + public static void main(String[] args) throws Exception { + syncUndeployModelStringStringMapstringinteger(); + } + + public static void syncUndeployModelStringStringMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + String deployedModelId = "deployedModelId-1817547906"; + Map trafficSplit = new HashMap<>(); + UndeployModelResponse response = + endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UndeployModel_StringStringMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java new file mode 100644 index 000000000000..9236770a66c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UpdateEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UpdateEndpointRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateEndpoint { + + public static void main(String[] args) throws Exception { + asyncUpdateEndpoint(); + } + + public static void asyncUpdateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UpdateEndpointRequest request = + UpdateEndpointRequest.newBuilder() + .setEndpoint(Endpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + endpointServiceClient.updateEndpointCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UpdateEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpoint.java new file mode 100644 index 000000000000..3bd4990cffa8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpoint.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UpdateEndpoint_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.UpdateEndpointRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEndpoint { + + public static void main(String[] args) throws Exception { + syncUpdateEndpoint(); + } + + public static void syncUpdateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UpdateEndpointRequest request = + UpdateEndpointRequest.newBuilder() + .setEndpoint(Endpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Endpoint response = endpointServiceClient.updateEndpoint(request); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UpdateEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java new file mode 100644 index 000000000000..b3b6370f9125 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointService_UpdateEndpoint_EndpointFieldmask_sync] +import com.google.cloud.aiplatform.v1.Endpoint; +import com.google.cloud.aiplatform.v1.EndpointServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEndpointEndpointFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateEndpointEndpointFieldmask(); + } + + public static void syncUpdateEndpointEndpointFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + Endpoint endpoint = Endpoint.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Endpoint response = endpointServiceClient.updateEndpoint(endpoint, updateMask); + } + } +} +// [END aiplatform_v1_generated_EndpointService_UpdateEndpoint_EndpointFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservicesettings/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservicesettings/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..dd1b650db2d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/endpointservicesettings/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_EndpointServiceSettings_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1.EndpointServiceSettings; +import java.time.Duration; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 + EndpointServiceSettings.Builder endpointServiceSettingsBuilder = + EndpointServiceSettings.newBuilder(); + endpointServiceSettingsBuilder + .getEndpointSettings() + .setRetrySettings( + endpointServiceSettingsBuilder + .getEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EndpointServiceSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_EndpointServiceSettings_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..81dd4f478dd5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + FeaturestoreOnlineServingServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create(featurestoreOnlineServingServiceSettings); + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a3f983d6e73f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + FeaturestoreOnlineServingServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create(featurestoreOnlineServingServiceSettings); + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..84edbeb240bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..9ad5f436a2dc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = featurestoreOnlineServingServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..788edc4c209c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..bf56fafd0234 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = featurestoreOnlineServingServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..751194400f54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..fd50a7d6dfd2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + featurestoreOnlineServingServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..171fddad562b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/listlocations/SyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : + featurestoreOnlineServingServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java new file mode 100644 index 000000000000..47bc5b52785d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesResponse; + +public class AsyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncReadFeatureValues(); + } + + public static void asyncReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ReadFeatureValuesRequest request = + ReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityId("entityId-2102099874") + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.readFeatureValuesCallable().futureCall(request); + // Do something. + ReadFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..bad86107ff6e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ReadFeatureValuesRequest request = + ReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityId("entityId-2102099874") + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..e8619011aae6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncReadFeatureValuesEntitytypename(); + } + + public static void syncReadFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(entityType); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java new file mode 100644 index 000000000000..44256c1fdf1d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncReadFeatureValuesString(); + } + + public static void syncReadFeatureValuesString() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(entityType); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..f6ffd70c52ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..bf3815669bd7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = featurestoreOnlineServingServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java new file mode 100644 index 000000000000..22798671ec32 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_StreamingReadFeatureValues_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.ReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.StreamingReadFeatureValuesRequest; +import java.util.ArrayList; + +public class AsyncStreamingReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncStreamingReadFeatureValues(); + } + + public static void asyncStreamingReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + StreamingReadFeatureValuesRequest request = + StreamingReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllEntityIds(new ArrayList()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ServerStream stream = + featurestoreOnlineServingServiceClient.streamingReadFeatureValuesCallable().call(request); + for (ReadFeatureValuesResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_StreamingReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..60cb01df0e26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..b9b9c87f5a02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = + featurestoreOnlineServingServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java new file mode 100644 index 000000000000..5b34e38cae5d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesResponse; +import java.util.ArrayList; + +public class AsyncWriteFeatureValues { + + public static void main(String[] args) throws Exception { + asyncWriteFeatureValues(); + } + + public static void asyncWriteFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + WriteFeatureValuesRequest request = + WriteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllPayloads(new ArrayList()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.writeFeatureValuesCallable().futureCall(request); + // Do something. + WriteFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java new file mode 100644 index 000000000000..e40f3e08f2bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesResponse; +import java.util.ArrayList; + +public class SyncWriteFeatureValues { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValues(); + } + + public static void syncWriteFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + WriteFeatureValuesRequest request = + WriteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllPayloads(new ArrayList()) + .build(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java new file mode 100644 index 000000000000..83eca640291a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_EntitytypenameListwritefeaturevaluespayload_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload(); + } + + public static void syncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload() + throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + List payloads = new ArrayList<>(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_EntitytypenameListwritefeaturevaluespayload_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java new file mode 100644 index 000000000000..2979cf16832c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_StringListwritefeaturevaluespayload_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1.WriteFeatureValuesResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteFeatureValuesStringListwritefeaturevaluespayload { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValuesStringListwritefeaturevaluespayload(); + } + + public static void syncWriteFeatureValuesStringListwritefeaturevaluespayload() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + List payloads = new ArrayList<>(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_StringListwritefeaturevaluespayload_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..39d552414631 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingServiceSettings_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceSettings; +import java.time.Duration; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings.Builder + featurestoreOnlineServingServiceSettingsBuilder = + FeaturestoreOnlineServingServiceSettings.newBuilder(); + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings( + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + featurestoreOnlineServingServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingServiceSettings_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java new file mode 100644 index 000000000000..8a1fb060acb5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchCreateFeatures { + + public static void main(String[] args) throws Exception { + asyncBatchCreateFeatures(); + } + + public static void asyncBatchCreateFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.batchCreateFeaturesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java new file mode 100644 index 000000000000..992d172aa2ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesOperationMetadata; +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateFeaturesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchCreateFeaturesLRO(); + } + + public static void asyncBatchCreateFeaturesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + OperationFuture future = + featurestoreServiceClient.batchCreateFeaturesOperationCallable().futureCall(request); + // Do something. + BatchCreateFeaturesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java new file mode 100644 index 000000000000..946e3c844bf8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_sync] +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateFeatures { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeatures(); + } + + public static void syncBatchCreateFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java new file mode 100644 index 000000000000..2ea9d49a6881 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_EntitytypenameListcreatefeaturerequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest(); + } + + public static void syncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest() + throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + List requests = new ArrayList<>(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(parent, requests).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_EntitytypenameListcreatefeaturerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java new file mode 100644 index 000000000000..8f5c85e63610 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_StringListcreatefeaturerequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateFeaturesStringListcreatefeaturerequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeaturesStringListcreatefeaturerequest(); + } + + public static void syncBatchCreateFeaturesStringListcreatefeaturerequest() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(parent, requests).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_StringListcreatefeaturerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java new file mode 100644 index 000000000000..3f4ff1297567 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncBatchReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncBatchReadFeatureValues(); + } + + public static void asyncBatchReadFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.batchReadFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java new file mode 100644 index 000000000000..28a6ab775133 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncBatchReadFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchReadFeatureValuesLRO(); + } + + public static void asyncBatchReadFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + OperationFuture + future = + featurestoreServiceClient + .batchReadFeatureValuesOperationCallable() + .futureCall(request); + // Do something. + BatchReadFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java new file mode 100644 index 000000000000..31d74e18dacd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class SyncBatchReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValues(); + } + + public static void syncBatchReadFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java new file mode 100644 index 000000000000..dd8b2ac8d3c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_Featurestorename_sync] +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncBatchReadFeatureValuesFeaturestorename { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValuesFeaturestorename(); + } + + public static void syncBatchReadFeatureValuesFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName featurestore = + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(featurestore).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java new file mode 100644 index 000000000000..6864a0a5c7f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncBatchReadFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValuesString(); + } + + public static void syncBatchReadFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String featurestore = + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(featurestore).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..1e8568fc3abc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + FeaturestoreServiceSettings featurestoreServiceSettings = + FeaturestoreServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + FeaturestoreServiceClient featurestoreServiceClient = + FeaturestoreServiceClient.create(featurestoreServiceSettings); + } +} +// [END aiplatform_v1_generated_FeaturestoreService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..e2d35c029fd8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + FeaturestoreServiceSettings featurestoreServiceSettings = + FeaturestoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + FeaturestoreServiceClient featurestoreServiceClient = + FeaturestoreServiceClient.create(featurestoreServiceSettings); + } +} +// [END aiplatform_v1_generated_FeaturestoreService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityType.java new file mode 100644 index 000000000000..4829f1a07548 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityType.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateEntityType { + + public static void main(String[] args) throws Exception { + asyncCreateEntityType(); + } + + public static void asyncCreateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + ApiFuture future = + featurestoreServiceClient.createEntityTypeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java new file mode 100644 index 000000000000..2f3386b30658 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateEntityTypeOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class AsyncCreateEntityTypeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateEntityTypeLRO(); + } + + public static void asyncCreateEntityTypeLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + OperationFuture future = + featurestoreServiceClient.createEntityTypeOperationCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityType.java new file mode 100644 index 000000000000..f203b065881c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityType.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_sync] +import com.google.cloud.aiplatform.v1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateEntityType { + + public static void main(String[] args) throws Exception { + syncCreateEntityType(); + } + + public static void syncCreateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + EntityType response = featurestoreServiceClient.createEntityTypeAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java new file mode 100644 index 000000000000..eb55f68b9999 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytype_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeFeaturestorenameEntitytype { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeFeaturestorenameEntitytype(); + } + + public static void syncCreateEntityTypeFeaturestorenameEntitytype() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + EntityType entityType = EntityType.newBuilder().build(); + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytype_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java new file mode 100644 index 000000000000..5de91043aada --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytypeString_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeFeaturestorenameEntitytypeString { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeFeaturestorenameEntitytypeString(); + } + + public static void syncCreateEntityTypeFeaturestorenameEntitytypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + EntityType entityType = EntityType.newBuilder().build(); + String entityTypeId = "entityTypeId767740856"; + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType, entityTypeId).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytypeString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java new file mode 100644 index 000000000000..bf6bf2bae9d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_StringEntitytype_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeStringEntitytype { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeStringEntitytype(); + } + + public static void syncCreateEntityTypeStringEntitytype() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + EntityType entityType = EntityType.newBuilder().build(); + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_StringEntitytype_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java new file mode 100644 index 000000000000..58414836964f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_StringEntitytypeString_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeStringEntitytypeString { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeStringEntitytypeString(); + } + + public static void syncCreateEntityTypeStringEntitytypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + EntityType entityType = EntityType.newBuilder().build(); + String entityTypeId = "entityTypeId767740856"; + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType, entityTypeId).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_StringEntitytypeString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeature.java new file mode 100644 index 000000000000..2e380c2d4664 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeature.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateFeature { + + public static void main(String[] args) throws Exception { + asyncCreateFeature(); + } + + public static void asyncCreateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + ApiFuture future = + featurestoreServiceClient.createFeatureCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java new file mode 100644 index 000000000000..1ec24dea40b5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateFeatureOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class AsyncCreateFeatureLRO { + + public static void main(String[] args) throws Exception { + asyncCreateFeatureLRO(); + } + + public static void asyncCreateFeatureLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + OperationFuture future = + featurestoreServiceClient.createFeatureOperationCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeature.java new file mode 100644 index 000000000000..58510a48cc16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeature.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_sync] +import com.google.cloud.aiplatform.v1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeature(); + } + + public static void syncCreateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + Feature response = featurestoreServiceClient.createFeatureAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java new file mode 100644 index 000000000000..efd414ed43fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeature_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateFeatureEntitytypenameFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeatureEntitytypenameFeature(); + } + + public static void syncCreateFeatureEntitytypenameFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + Feature feature = Feature.newBuilder().build(); + Feature response = featurestoreServiceClient.createFeatureAsync(parent, feature).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java new file mode 100644 index 000000000000..02ac494aebad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeatureString_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateFeatureEntitytypenameFeatureString { + + public static void main(String[] args) throws Exception { + syncCreateFeatureEntitytypenameFeatureString(); + } + + public static void syncCreateFeatureEntitytypenameFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + Feature feature = Feature.newBuilder().build(); + String featureId = "featureId-420503887"; + Feature response = + featurestoreServiceClient.createFeatureAsync(parent, feature, featureId).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeatureString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java new file mode 100644 index 000000000000..77da79ae1fc9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_StringFeature_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateFeatureStringFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeatureStringFeature(); + } + + public static void syncCreateFeatureStringFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + Feature feature = Feature.newBuilder().build(); + Feature response = featurestoreServiceClient.createFeatureAsync(parent, feature).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_StringFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java new file mode 100644 index 000000000000..0c8374707533 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_StringFeatureString_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncCreateFeatureStringFeatureString { + + public static void main(String[] args) throws Exception { + syncCreateFeatureStringFeatureString(); + } + + public static void syncCreateFeatureStringFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + Feature feature = Feature.newBuilder().build(); + String featureId = "featureId-420503887"; + Feature response = + featurestoreServiceClient.createFeatureAsync(parent, feature, featureId).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_StringFeatureString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java new file mode 100644 index 000000000000..fc0a1d8d8b17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateFeaturestore { + + public static void main(String[] args) throws Exception { + asyncCreateFeaturestore(); + } + + public static void asyncCreateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + ApiFuture future = + featurestoreServiceClient.createFeaturestoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java new file mode 100644 index 000000000000..1406f84a11cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateFeaturestoreOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncCreateFeaturestoreLRO(); + } + + public static void asyncCreateFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + OperationFuture future = + featurestoreServiceClient.createFeaturestoreOperationCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java new file mode 100644 index 000000000000..6e29e0679cbb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_sync] +import com.google.cloud.aiplatform.v1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestore(); + } + + public static void syncCreateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + Featurestore response = featurestoreServiceClient.createFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java new file mode 100644 index 000000000000..5dd3d744368c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestore_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateFeaturestoreLocationnameFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreLocationnameFeaturestore(); + } + + public static void syncCreateFeaturestoreLocationnameFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Featurestore featurestore = Featurestore.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.createFeaturestoreAsync(parent, featurestore).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java new file mode 100644 index 000000000000..dcfe5ca8fd52 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestoreString_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateFeaturestoreLocationnameFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreLocationnameFeaturestoreString(); + } + + public static void syncCreateFeaturestoreLocationnameFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Featurestore featurestore = Featurestore.newBuilder().build(); + String featurestoreId = "featurestoreId-1315851738"; + Featurestore response = + featurestoreServiceClient + .createFeaturestoreAsync(parent, featurestore, featurestoreId) + .get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java new file mode 100644 index 000000000000..30cb5802e6b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestore_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateFeaturestoreStringFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreStringFeaturestore(); + } + + public static void syncCreateFeaturestoreStringFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Featurestore featurestore = Featurestore.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.createFeaturestoreAsync(parent, featurestore).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java new file mode 100644 index 000000000000..c6c867efcc6e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestoreString_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateFeaturestoreStringFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreStringFeaturestoreString(); + } + + public static void syncCreateFeaturestoreStringFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Featurestore featurestore = Featurestore.newBuilder().build(); + String featurestoreId = "featurestoreId-1315851738"; + Featurestore response = + featurestoreServiceClient + .createFeaturestoreAsync(parent, featurestore, featurestoreId) + .get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java new file mode 100644 index 000000000000..54a73e0d6b03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteEntityType { + + public static void main(String[] args) throws Exception { + asyncDeleteEntityType(); + } + + public static void asyncDeleteEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteEntityTypeCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java new file mode 100644 index 000000000000..68f65d61d58e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteEntityTypeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteEntityTypeLRO(); + } + + public static void asyncDeleteEntityTypeLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteEntityTypeOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java new file mode 100644 index 000000000000..47ffe39abd2c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_sync] +import com.google.cloud.aiplatform.v1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityType { + + public static void main(String[] args) throws Exception { + syncDeleteEntityType(); + } + + public static void syncDeleteEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + featurestoreServiceClient.deleteEntityTypeAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java new file mode 100644 index 000000000000..b64d452bb8c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeEntitytypename { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeEntitytypename(); + } + + public static void syncDeleteEntityTypeEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + featurestoreServiceClient.deleteEntityTypeAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java new file mode 100644 index 000000000000..28600184c964 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_EntitytypenameBoolean_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeEntitytypenameBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeEntitytypenameBoolean(); + } + + public static void syncDeleteEntityTypeEntitytypenameBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + boolean force = true; + featurestoreServiceClient.deleteEntityTypeAsync(name, force).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_EntitytypenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java new file mode 100644 index 000000000000..2d3c01a15ee2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_String_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeString { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeString(); + } + + public static void syncDeleteEntityTypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + featurestoreServiceClient.deleteEntityTypeAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java new file mode 100644 index 000000000000..ec124228f09f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_StringBoolean_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeStringBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeStringBoolean(); + } + + public static void syncDeleteEntityTypeStringBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + boolean force = true; + featurestoreServiceClient.deleteEntityTypeAsync(name, force).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeature.java new file mode 100644 index 000000000000..38bb8967c1b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeature.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeature { + + public static void main(String[] args) throws Exception { + asyncDeleteFeature(); + } + + public static void asyncDeleteFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeatureCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java new file mode 100644 index 000000000000..031fd61caa37 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteFeatureLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureLRO(); + } + + public static void asyncDeleteFeatureLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeatureOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeature.java new file mode 100644 index 000000000000..94e5ab2582c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeature.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_sync] +import com.google.cloud.aiplatform.v1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeature { + + public static void main(String[] args) throws Exception { + syncDeleteFeature(); + } + + public static void syncDeleteFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + featurestoreServiceClient.deleteFeatureAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java new file mode 100644 index 000000000000..79d1e50c2491 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_Featurename_sync] +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeatureFeaturename { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureFeaturename(); + } + + public static void syncDeleteFeatureFeaturename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeatureName name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]"); + featurestoreServiceClient.deleteFeatureAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_Featurename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java new file mode 100644 index 000000000000..bfb14b982724 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_String_sync] +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeatureString { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureString(); + } + + public static void syncDeleteFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString(); + featurestoreServiceClient.deleteFeatureAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java new file mode 100644 index 000000000000..c782b13a7d4e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeaturestore { + + public static void main(String[] args) throws Exception { + asyncDeleteFeaturestore(); + } + + public static void asyncDeleteFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeaturestoreCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java new file mode 100644 index 000000000000..ea4f11f57b24 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeaturestoreLRO(); + } + + public static void asyncDeleteFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeaturestoreOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java new file mode 100644 index 000000000000..b9e0081afa54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_sync] +import com.google.cloud.aiplatform.v1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestore { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestore(); + } + + public static void syncDeleteFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + featurestoreServiceClient.deleteFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java new file mode 100644 index 000000000000..77f464f222e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_Featurestorename_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreFeaturestorename { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreFeaturestorename(); + } + + public static void syncDeleteFeaturestoreFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + featurestoreServiceClient.deleteFeaturestoreAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java new file mode 100644 index 000000000000..4409f842bcb2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_FeaturestorenameBoolean_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreFeaturestorenameBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreFeaturestorenameBoolean(); + } + + public static void syncDeleteFeaturestoreFeaturestorenameBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + boolean force = true; + featurestoreServiceClient.deleteFeaturestoreAsync(name, force).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_FeaturestorenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java new file mode 100644 index 000000000000..97ccb9627fbf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_String_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreString(); + } + + public static void syncDeleteFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + featurestoreServiceClient.deleteFeaturestoreAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java new file mode 100644 index 000000000000..dc37ce6a916c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_StringBoolean_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreStringBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreStringBoolean(); + } + + public static void syncDeleteFeaturestoreStringBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + boolean force = true; + featurestoreServiceClient.deleteFeaturestoreAsync(name, force).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java new file mode 100644 index 000000000000..dab46cea836b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeatureValues { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureValues(); + } + + public static void asyncDeleteFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java new file mode 100644 index 000000000000..efacf4ea36f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class AsyncDeleteFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureValuesLRO(); + } + + public static void asyncDeleteFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeatureValuesOperationCallable().futureCall(request); + // Do something. + DeleteFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java new file mode 100644 index 000000000000..1aa64505bada --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_sync] +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValues { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValues(); + } + + public static void syncDeleteFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..68806768255c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValuesEntitytypename(); + } + + public static void syncDeleteFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java new file mode 100644 index 000000000000..53573935d87a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValuesString(); + } + + public static void syncDeleteFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java new file mode 100644 index 000000000000..b9123d1778f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncExportFeatureValues { + + public static void main(String[] args) throws Exception { + asyncExportFeatureValues(); + } + + public static void asyncExportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.exportFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java new file mode 100644 index 000000000000..2e3c6eaa322b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class AsyncExportFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncExportFeatureValuesLRO(); + } + + public static void asyncExportFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + OperationFuture future = + featurestoreServiceClient.exportFeatureValuesOperationCallable().futureCall(request); + // Do something. + ExportFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java new file mode 100644 index 000000000000..3a57557dbe20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_sync] +import com.google.cloud.aiplatform.v1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeatureSelector; +import com.google.cloud.aiplatform.v1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class SyncExportFeatureValues { + + public static void main(String[] args) throws Exception { + syncExportFeatureValues(); + } + + public static void syncExportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..5649b4f2a189 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncExportFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncExportFeatureValuesEntitytypename(); + } + + public static void syncExportFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java new file mode 100644 index 000000000000..64bfcd54c0d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncExportFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncExportFeatureValuesString(); + } + + public static void syncExportFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/AsyncGetEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/AsyncGetEntityType.java new file mode 100644 index 000000000000..5aa97ec20b84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/AsyncGetEntityType.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetEntityTypeRequest; + +public class AsyncGetEntityType { + + public static void main(String[] args) throws Exception { + asyncGetEntityType(); + } + + public static void asyncGetEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetEntityTypeRequest request = + GetEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getEntityTypeCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityType.java new file mode 100644 index 000000000000..f5b91f98c704 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityType.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetEntityType_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetEntityTypeRequest; + +public class SyncGetEntityType { + + public static void main(String[] args) throws Exception { + syncGetEntityType(); + } + + public static void syncGetEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetEntityTypeRequest request = + GetEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + EntityType response = featurestoreServiceClient.getEntityType(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java new file mode 100644 index 000000000000..30941e58faa4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetEntityType_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetEntityTypeEntitytypename { + + public static void main(String[] args) throws Exception { + syncGetEntityTypeEntitytypename(); + } + + public static void syncGetEntityTypeEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + EntityType response = featurestoreServiceClient.getEntityType(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetEntityType_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java new file mode 100644 index 000000000000..7353b40fdfac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetEntityType_String_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetEntityTypeString { + + public static void main(String[] args) throws Exception { + syncGetEntityTypeString(); + } + + public static void syncGetEntityTypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + EntityType response = featurestoreServiceClient.getEntityType(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetEntityType_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/AsyncGetFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/AsyncGetFeature.java new file mode 100644 index 000000000000..ca73950c00e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/AsyncGetFeature.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetFeatureRequest; + +public class AsyncGetFeature { + + public static void main(String[] args) throws Exception { + asyncGetFeature(); + } + + public static void asyncGetFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeatureRequest request = + GetFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getFeatureCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeature.java new file mode 100644 index 000000000000..6677319e485e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeature.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeature_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetFeatureRequest; + +public class SyncGetFeature { + + public static void main(String[] args) throws Exception { + syncGetFeature(); + } + + public static void syncGetFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeatureRequest request = + GetFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + Feature response = featurestoreServiceClient.getFeature(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java new file mode 100644 index 000000000000..2456ebdb3ac6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeature_Featurename_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetFeatureFeaturename { + + public static void main(String[] args) throws Exception { + syncGetFeatureFeaturename(); + } + + public static void syncGetFeatureFeaturename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeatureName name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]"); + Feature response = featurestoreServiceClient.getFeature(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeature_Featurename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureString.java new file mode 100644 index 000000000000..3261e7d61075 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeature/SyncGetFeatureString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeature_String_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeatureName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetFeatureString { + + public static void main(String[] args) throws Exception { + syncGetFeatureString(); + } + + public static void syncGetFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString(); + Feature response = featurestoreServiceClient.getFeature(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeature_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java new file mode 100644 index 000000000000..18ebb614ec75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetFeaturestoreRequest; + +public class AsyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + asyncGetFeaturestore(); + } + + public static void asyncGetFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeaturestoreRequest request = + GetFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getFeaturestoreCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..8e34a8d1f9f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.GetFeaturestoreRequest; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeaturestoreRequest request = + GetFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .build(); + Featurestore response = featurestoreServiceClient.getFeaturestore(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java new file mode 100644 index 000000000000..38527dc3289c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_Featurestorename_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetFeaturestoreFeaturestorename { + + public static void main(String[] args) throws Exception { + syncGetFeaturestoreFeaturestorename(); + } + + public static void syncGetFeaturestoreFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + Featurestore response = featurestoreServiceClient.getFeaturestore(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java new file mode 100644 index 000000000000..2e5a559b73cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_String_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncGetFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncGetFeaturestoreString(); + } + + public static void syncGetFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + Featurestore response = featurestoreServiceClient.getFeaturestore(name); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..d045d8f976db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..51331ad437fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = featurestoreServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..fdbca0b0367f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + featurestoreServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..fc7d9212beb2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = featurestoreServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java new file mode 100644 index 000000000000..95c64fb3a7b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncImportFeatureValues { + + public static void main(String[] args) throws Exception { + asyncImportFeatureValues(); + } + + public static void asyncImportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + ApiFuture future = + featurestoreServiceClient.importFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java new file mode 100644 index 000000000000..4876312899e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesResponse; +import java.util.ArrayList; + +public class AsyncImportFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncImportFeatureValuesLRO(); + } + + public static void asyncImportFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + OperationFuture future = + featurestoreServiceClient.importFeatureValuesOperationCallable().futureCall(request); + // Do something. + ImportFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java new file mode 100644 index 000000000000..96a464bdcb07 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesResponse; +import java.util.ArrayList; + +public class SyncImportFeatureValues { + + public static void main(String[] args) throws Exception { + syncImportFeatureValues(); + } + + public static void syncImportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..f3187ab0a314 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesResponse; + +public class SyncImportFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncImportFeatureValuesEntitytypename(); + } + + public static void syncImportFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java new file mode 100644 index 000000000000..7e749a23f5af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ImportFeatureValuesResponse; + +public class SyncImportFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncImportFeatureValuesString(); + } + + public static void syncImportFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java new file mode 100644 index 000000000000..cc099d290bc9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListEntityTypesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListEntityTypes { + + public static void main(String[] args) throws Exception { + asyncListEntityTypes(); + } + + public static void asyncListEntityTypes() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.listEntityTypesPagedCallable().futureCall(request); + // Do something. + for (EntityType element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java new file mode 100644 index 000000000000..2311fba56ae9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_Paged_async] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListEntityTypesRequest; +import com.google.cloud.aiplatform.v1.ListEntityTypesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListEntityTypesPaged { + + public static void main(String[] args) throws Exception { + asyncListEntityTypesPaged(); + } + + public static void asyncListEntityTypesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListEntityTypesResponse response = + featurestoreServiceClient.listEntityTypesCallable().call(request); + for (EntityType element : response.getEntityTypesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypes.java new file mode 100644 index 000000000000..ddbd53b438cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypes.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListEntityTypesRequest; +import com.google.protobuf.FieldMask; + +public class SyncListEntityTypes { + + public static void main(String[] args) throws Exception { + syncListEntityTypes(); + } + + public static void syncListEntityTypes() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (EntityType element : featurestoreServiceClient.listEntityTypes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java new file mode 100644 index 000000000000..646a25a111db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_Featurestorename_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncListEntityTypesFeaturestorename { + + public static void main(String[] args) throws Exception { + syncListEntityTypesFeaturestorename(); + } + + public static void syncListEntityTypesFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + for (EntityType element : featurestoreServiceClient.listEntityTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java new file mode 100644 index 000000000000..bb4a758485fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_String_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncListEntityTypesString { + + public static void main(String[] args) throws Exception { + syncListEntityTypesString(); + } + + public static void syncListEntityTypesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + for (EntityType element : featurestoreServiceClient.listEntityTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeatures.java new file mode 100644 index 000000000000..2ae89e0b4aa1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeatures.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListFeatures { + + public static void main(String[] args) throws Exception { + asyncListFeatures(); + } + + public static void asyncListFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + ApiFuture future = + featurestoreServiceClient.listFeaturesPagedCallable().futureCall(request); + // Do something. + for (Feature element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java new file mode 100644 index 000000000000..412e55c955fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_Paged_async] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturesRequest; +import com.google.cloud.aiplatform.v1.ListFeaturesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturesPaged { + + public static void main(String[] args) throws Exception { + asyncListFeaturesPaged(); + } + + public static void asyncListFeaturesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + while (true) { + ListFeaturesResponse response = + featurestoreServiceClient.listFeaturesCallable().call(request); + for (Feature element : response.getFeaturesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeatures.java new file mode 100644 index 000000000000..cf4be2d5d6ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeatures.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturesRequest; +import com.google.protobuf.FieldMask; + +public class SyncListFeatures { + + public static void main(String[] args) throws Exception { + syncListFeatures(); + } + + public static void syncListFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + for (Feature element : featurestoreServiceClient.listFeatures(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java new file mode 100644 index 000000000000..9669118f1bb8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_Entitytypename_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncListFeaturesEntitytypename { + + public static void main(String[] args) throws Exception { + syncListFeaturesEntitytypename(); + } + + public static void syncListFeaturesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + for (Feature element : featurestoreServiceClient.listFeatures(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesString.java new file mode 100644 index 000000000000..4b8f9166ea52 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeatures/SyncListFeaturesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_String_sync] +import com.google.cloud.aiplatform.v1.EntityTypeName; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; + +public class SyncListFeaturesString { + + public static void main(String[] args) throws Exception { + syncListFeaturesString(); + } + + public static void syncListFeaturesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + for (Feature element : featurestoreServiceClient.listFeatures(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java new file mode 100644 index 000000000000..f87123605eff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturestores { + + public static void main(String[] args) throws Exception { + asyncListFeaturestores(); + } + + public static void asyncListFeaturestores() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.listFeaturestoresPagedCallable().futureCall(request); + // Do something. + for (Featurestore element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java new file mode 100644 index 000000000000..89a5563d488a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_Paged_async] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1.ListFeaturestoresResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturestoresPaged { + + public static void main(String[] args) throws Exception { + asyncListFeaturestoresPaged(); + } + + public static void asyncListFeaturestoresPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListFeaturestoresResponse response = + featurestoreServiceClient.listFeaturestoresCallable().call(request); + for (Featurestore element : response.getFeaturestoresList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java new file mode 100644 index 000000000000..eefdefb1fdc8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListFeaturestores { + + public static void main(String[] args) throws Exception { + syncListFeaturestores(); + } + + public static void syncListFeaturestores() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java new file mode 100644 index 000000000000..621561f92911 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_Locationname_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListFeaturestoresLocationname { + + public static void main(String[] args) throws Exception { + syncListFeaturestoresLocationname(); + } + + public static void syncListFeaturestoresLocationname() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java new file mode 100644 index 000000000000..b9179f0b0873 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_String_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListFeaturestoresString { + + public static void main(String[] args) throws Exception { + syncListFeaturestoresString(); + } + + public static void syncListFeaturestoresString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..8dede4add413 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..d3a424c1c828 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + featurestoreServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..730222f30732 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : featurestoreServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java new file mode 100644 index 000000000000..5cc45d05b0fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SearchFeaturesRequest; + +public class AsyncSearchFeatures { + + public static void main(String[] args) throws Exception { + asyncSearchFeatures(); + } + + public static void asyncSearchFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreServiceClient.searchFeaturesPagedCallable().futureCall(request); + // Do something. + for (Feature element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java new file mode 100644 index 000000000000..1a7c11e0cbc0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_Paged_async] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SearchFeaturesRequest; +import com.google.cloud.aiplatform.v1.SearchFeaturesResponse; +import com.google.common.base.Strings; + +public class AsyncSearchFeaturesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchFeaturesPaged(); + } + + public static void asyncSearchFeaturesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchFeaturesResponse response = + featurestoreServiceClient.searchFeaturesCallable().call(request); + for (Feature element : response.getFeaturesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeatures.java new file mode 100644 index 000000000000..9b6015144c36 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeatures.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SearchFeaturesRequest; + +public class SyncSearchFeatures { + + public static void main(String[] args) throws Exception { + syncSearchFeatures(); + } + + public static void syncSearchFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Feature element : featurestoreServiceClient.searchFeatures(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java new file mode 100644 index 000000000000..7ee9284f91bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_Locationname_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncSearchFeaturesLocationname { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesLocationname(); + } + + public static void syncSearchFeaturesLocationname() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Feature element : featurestoreServiceClient.searchFeatures(location).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java new file mode 100644 index 000000000000..531f1728e2c2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_LocationnameString_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncSearchFeaturesLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesLocationnameString(); + } + + public static void syncSearchFeaturesLocationnameString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + for (Feature element : + featurestoreServiceClient.searchFeatures(location, query).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_LocationnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java new file mode 100644 index 000000000000..cdd27b26bd50 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_String_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncSearchFeaturesString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesString(); + } + + public static void syncSearchFeaturesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Feature element : featurestoreServiceClient.searchFeatures(location).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java new file mode 100644 index 000000000000..5d96e78d4c82 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_StringString_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncSearchFeaturesStringString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesStringString(); + } + + public static void syncSearchFeaturesStringString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + for (Feature element : + featurestoreServiceClient.searchFeatures(location, query).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..1ce4daa1474c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..bdee67df49cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = featurestoreServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..2c1c5599de89 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..8208b72c6ab1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = featurestoreServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java new file mode 100644 index 000000000000..b433ad69f700 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateEntityTypeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateEntityType { + + public static void main(String[] args) throws Exception { + asyncUpdateEntityType(); + } + + public static void asyncUpdateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateEntityTypeRequest request = + UpdateEntityTypeRequest.newBuilder() + .setEntityType(EntityType.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateEntityTypeCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java new file mode 100644 index 000000000000..e423aef21be5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateEntityTypeRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEntityType { + + public static void main(String[] args) throws Exception { + syncUpdateEntityType(); + } + + public static void syncUpdateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateEntityTypeRequest request = + UpdateEntityTypeRequest.newBuilder() + .setEntityType(EntityType.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + EntityType response = featurestoreServiceClient.updateEntityType(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java new file mode 100644 index 000000000000..7b30852af006 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_EntitytypeFieldmask_sync] +import com.google.cloud.aiplatform.v1.EntityType; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEntityTypeEntitytypeFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateEntityTypeEntitytypeFieldmask(); + } + + public static void syncUpdateEntityTypeEntitytypeFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityType entityType = EntityType.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + EntityType response = featurestoreServiceClient.updateEntityType(entityType, updateMask); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_EntitytypeFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/AsyncUpdateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/AsyncUpdateFeature.java new file mode 100644 index 000000000000..8038ded12609 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/AsyncUpdateFeature.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateFeatureRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeature { + + public static void main(String[] args) throws Exception { + asyncUpdateFeature(); + } + + public static void asyncUpdateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeatureRequest request = + UpdateFeatureRequest.newBuilder() + .setFeature(Feature.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateFeatureCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeature.java new file mode 100644 index 000000000000..c61f6950280e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeature.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeature_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateFeatureRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeature { + + public static void main(String[] args) throws Exception { + syncUpdateFeature(); + } + + public static void syncUpdateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeatureRequest request = + UpdateFeatureRequest.newBuilder() + .setFeature(Feature.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Feature response = featurestoreServiceClient.updateFeature(request); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java new file mode 100644 index 000000000000..ac9e25594d1f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeature_FeatureFieldmask_sync] +import com.google.cloud.aiplatform.v1.Feature; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeatureFeatureFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateFeatureFeatureFieldmask(); + } + + public static void syncUpdateFeatureFeatureFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + Feature feature = Feature.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Feature response = featurestoreServiceClient.updateFeature(feature, updateMask); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeature_FeatureFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java new file mode 100644 index 000000000000..26b688c6af69 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateFeaturestoreRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeaturestore { + + public static void main(String[] args) throws Exception { + asyncUpdateFeaturestore(); + } + + public static void asyncUpdateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateFeaturestoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java new file mode 100644 index 000000000000..c7eb9d38ed92 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateFeaturestoreOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateFeaturestoreRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateFeaturestoreLRO(); + } + + public static void asyncUpdateFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + featurestoreServiceClient.updateFeaturestoreOperationCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java new file mode 100644 index 000000000000..b234cfd59cc7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.UpdateFeaturestoreRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeaturestore { + + public static void main(String[] args) throws Exception { + syncUpdateFeaturestore(); + } + + public static void syncUpdateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Featurestore response = featurestoreServiceClient.updateFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java new file mode 100644 index 000000000000..cd87cace5a32 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_FeaturestoreFieldmask_sync] +import com.google.cloud.aiplatform.v1.Featurestore; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeaturestoreFeaturestoreFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateFeaturestoreFeaturestoreFieldmask(); + } + + public static void syncUpdateFeaturestoreFeaturestoreFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + Featurestore featurestore = Featurestore.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.updateFeaturestoreAsync(featurestore, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_FeaturestoreFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..31be19b4d318 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_FeaturestoreServiceSettings_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings; +import java.time.Duration; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 + FeaturestoreServiceSettings.Builder featurestoreServiceSettingsBuilder = + FeaturestoreServiceSettings.newBuilder(); + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings( + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreServiceSettings featurestoreServiceSettings = + featurestoreServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_FeaturestoreServiceSettings_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5cec318adbaa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + IndexEndpointServiceSettings indexEndpointServiceSettings = + IndexEndpointServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create(indexEndpointServiceSettings); + } +} +// [END aiplatform_v1_generated_IndexEndpointService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..eb764ed25116 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + IndexEndpointServiceSettings indexEndpointServiceSettings = + IndexEndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create(indexEndpointServiceSettings); + } +} +// [END aiplatform_v1_generated_IndexEndpointService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java new file mode 100644 index 000000000000..564a96c31400 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncCreateIndexEndpoint(); + } + + public static void asyncCreateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.createIndexEndpointCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java new file mode 100644 index 000000000000..2c4cee33e9e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateIndexEndpointOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateIndexEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncCreateIndexEndpointLRO(); + } + + public static void asyncCreateIndexEndpointLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.createIndexEndpointOperationCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java new file mode 100644 index 000000000000..dd68788c8b2b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpoint(); + } + + public static void syncCreateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.createIndexEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java new file mode 100644 index 000000000000..af20d9251338 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_LocationnameIndexendpoint_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndexEndpointLocationnameIndexendpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpointLocationnameIndexendpoint(); + } + + public static void syncCreateIndexEndpointLocationnameIndexendpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.createIndexEndpointAsync(parent, indexEndpoint).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_LocationnameIndexendpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java new file mode 100644 index 000000000000..77e9ba1a8052 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_StringIndexendpoint_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndexEndpointStringIndexendpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpointStringIndexendpoint(); + } + + public static void syncCreateIndexEndpointStringIndexendpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.createIndexEndpointAsync(parent, indexEndpoint).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_CreateIndexEndpoint_StringIndexendpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java new file mode 100644 index 000000000000..35b7da0feeeb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexEndpoint(); + } + + public static void asyncDeleteIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + ApiFuture future = + indexEndpointServiceClient.deleteIndexEndpointCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java new file mode 100644 index 000000000000..5c973e1ecf2a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteIndexEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexEndpointLRO(); + } + + public static void asyncDeleteIndexEndpointLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + OperationFuture future = + indexEndpointServiceClient.deleteIndexEndpointOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java new file mode 100644 index 000000000000..7e8a3024c281 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpoint(); + } + + public static void syncDeleteIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + indexEndpointServiceClient.deleteIndexEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java new file mode 100644 index 000000000000..124b25461998 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_Indexendpointname_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpointIndexendpointname { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpointIndexendpointname(); + } + + public static void syncDeleteIndexEndpointIndexendpointname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + indexEndpointServiceClient.deleteIndexEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_Indexendpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java new file mode 100644 index 000000000000..20195a9205d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_String_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpointString { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpointString(); + } + + public static void syncDeleteIndexEndpointString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + indexEndpointServiceClient.deleteIndexEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeleteIndexEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndex.java new file mode 100644 index 000000000000..56dde6792ca0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndex.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeployIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeployIndex { + + public static void main(String[] args) throws Exception { + asyncDeployIndex(); + } + + public static void asyncDeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.deployIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeployIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java new file mode 100644 index 000000000000..ff5e81f34882 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeployIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeployIndexOperationMetadata; +import com.google.cloud.aiplatform.v1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class AsyncDeployIndexLRO { + + public static void main(String[] args) throws Exception { + asyncDeployIndexLRO(); + } + + public static void asyncDeployIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.deployIndexOperationCallable().futureCall(request); + // Do something. + DeployIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeployIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndex.java new file mode 100644 index 000000000000..54c704980337 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndex.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeployIndex_sync] +import com.google.cloud.aiplatform.v1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncDeployIndex { + + public static void main(String[] args) throws Exception { + syncDeployIndex(); + } + + public static void syncDeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + DeployIndexResponse response = indexEndpointServiceClient.deployIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeployIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java new file mode 100644 index 000000000000..f224dd590767 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeployIndex_IndexendpointnameDeployedindex_sync] +import com.google.cloud.aiplatform.v1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncDeployIndexIndexendpointnameDeployedindex { + + public static void main(String[] args) throws Exception { + syncDeployIndexIndexendpointnameDeployedindex(); + } + + public static void syncDeployIndexIndexendpointnameDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + DeployIndexResponse response = + indexEndpointServiceClient.deployIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeployIndex_IndexendpointnameDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java new file mode 100644 index 000000000000..7a9b7a7862a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_DeployIndex_StringDeployedindex_sync] +import com.google.cloud.aiplatform.v1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncDeployIndexStringDeployedindex { + + public static void main(String[] args) throws Exception { + syncDeployIndexStringDeployedindex(); + } + + public static void syncDeployIndexStringDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + DeployIndexResponse response = + indexEndpointServiceClient.deployIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_DeployIndex_StringDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..ec756ba31ebe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..b1a82b4f5f99 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = indexEndpointServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java new file mode 100644 index 000000000000..dc7d6d762153 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class AsyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncGetIndexEndpoint(); + } + + public static void asyncGetIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIndexEndpointRequest request = + GetIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + ApiFuture future = + indexEndpointServiceClient.getIndexEndpointCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..d18404f41f66 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.GetIndexEndpointRequest; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIndexEndpointRequest request = + GetIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java new file mode 100644 index 000000000000..eff3879fece2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_Indexendpointname_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpointIndexendpointname { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpointIndexendpointname(); + } + + public static void syncGetIndexEndpointIndexendpointname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(name); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_Indexendpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java new file mode 100644 index 000000000000..d95e682c82ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_String_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpointString { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpointString(); + } + + public static void syncGetIndexEndpointString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(name); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetIndexEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..a58ff3b02fff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + indexEndpointServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..78573652fb6f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = indexEndpointServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java new file mode 100644 index 000000000000..ea663b07b94e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexEndpoints { + + public static void main(String[] args) throws Exception { + asyncListIndexEndpoints(); + } + + public static void asyncListIndexEndpoints() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.listIndexEndpointsPagedCallable().futureCall(request); + // Do something. + for (IndexEndpoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java new file mode 100644 index 000000000000..cb69335349b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_Paged_async] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1.ListIndexEndpointsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexEndpointsPaged { + + public static void main(String[] args) throws Exception { + asyncListIndexEndpointsPaged(); + } + + public static void asyncListIndexEndpointsPaged() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListIndexEndpointsResponse response = + indexEndpointServiceClient.listIndexEndpointsCallable().call(request); + for (IndexEndpoint element : response.getIndexEndpointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java new file mode 100644 index 000000000000..cb96d834e2c2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListIndexEndpoints { + + public static void main(String[] args) throws Exception { + syncListIndexEndpoints(); + } + + public static void syncListIndexEndpoints() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java new file mode 100644 index 000000000000..07422d8304d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_Locationname_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListIndexEndpointsLocationname { + + public static void main(String[] args) throws Exception { + syncListIndexEndpointsLocationname(); + } + + public static void syncListIndexEndpointsLocationname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java new file mode 100644 index 000000000000..c9ffe21b1419 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_String_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListIndexEndpointsString { + + public static void main(String[] args) throws Exception { + syncListIndexEndpointsString(); + } + + public static void syncListIndexEndpointsString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListIndexEndpoints_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..5efe8edc69f7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + indexEndpointServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..ab70397f44ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + indexEndpointServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..591924d2b8b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/listlocations/SyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : indexEndpointServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java new file mode 100644 index 000000000000..a2d1b7cba3f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexRequest; +import com.google.longrunning.Operation; + +public class AsyncMutateDeployedIndex { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedIndex(); + } + + public static void asyncMutateDeployedIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.mutateDeployedIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java new file mode 100644 index 000000000000..9212cc9e9d20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexOperationMetadata; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexRequest; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexResponse; + +public class AsyncMutateDeployedIndexLRO { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedIndexLRO(); + } + + public static void asyncMutateDeployedIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.mutateDeployedIndexOperationCallable().futureCall(request); + // Do something. + MutateDeployedIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java new file mode 100644 index 000000000000..75a55b5af2e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_sync] +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexRequest; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndex(); + } + + public static void syncMutateDeployedIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java new file mode 100644 index 000000000000..21b25a9ecb8c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_IndexendpointnameDeployedindex_sync] +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndexIndexendpointnameDeployedindex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndexIndexendpointnameDeployedindex(); + } + + public static void syncMutateDeployedIndexIndexendpointnameDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_IndexendpointnameDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java new file mode 100644 index 000000000000..b15fcb24b528 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_StringDeployedindex_sync] +import com.google.cloud.aiplatform.v1.DeployedIndex; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndexStringDeployedindex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndexStringDeployedindex(); + } + + public static void syncMutateDeployedIndexStringDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_MutateDeployedIndex_StringDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..d1df7340af1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..ea3e4fce49f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = indexEndpointServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..6a9d69aca5dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + indexEndpointServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..480cdf89729b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = indexEndpointServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndex.java new file mode 100644 index 000000000000..fcad2cf27be5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndex.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UndeployIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployIndexRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeployIndex { + + public static void main(String[] args) throws Exception { + asyncUndeployIndex(); + } + + public static void asyncUndeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + ApiFuture future = + indexEndpointServiceClient.undeployIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UndeployIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java new file mode 100644 index 000000000000..305a549a8ef9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UndeployIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployIndexOperationMetadata; +import com.google.cloud.aiplatform.v1.UndeployIndexRequest; +import com.google.cloud.aiplatform.v1.UndeployIndexResponse; + +public class AsyncUndeployIndexLRO { + + public static void main(String[] args) throws Exception { + asyncUndeployIndexLRO(); + } + + public static void asyncUndeployIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + OperationFuture future = + indexEndpointServiceClient.undeployIndexOperationCallable().futureCall(request); + // Do something. + UndeployIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UndeployIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndex.java new file mode 100644 index 000000000000..bccce7cd8d9f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UndeployIndex_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployIndexRequest; +import com.google.cloud.aiplatform.v1.UndeployIndexResponse; + +public class SyncUndeployIndex { + + public static void main(String[] args) throws Exception { + syncUndeployIndex(); + } + + public static void syncUndeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + UndeployIndexResponse response = indexEndpointServiceClient.undeployIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UndeployIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java new file mode 100644 index 000000000000..6cd921d2c468 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UndeployIndex_IndexendpointnameString_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployIndexResponse; + +public class SyncUndeployIndexIndexendpointnameString { + + public static void main(String[] args) throws Exception { + syncUndeployIndexIndexendpointnameString(); + } + + public static void syncUndeployIndexIndexendpointnameString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + String deployedIndexId = "deployedIndexId-1101212953"; + UndeployIndexResponse response = + indexEndpointServiceClient.undeployIndexAsync(indexEndpoint, deployedIndexId).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UndeployIndex_IndexendpointnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java new file mode 100644 index 000000000000..2b6b2d1a81bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UndeployIndex_StringString_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UndeployIndexResponse; + +public class SyncUndeployIndexStringString { + + public static void main(String[] args) throws Exception { + syncUndeployIndexStringString(); + } + + public static void syncUndeployIndexStringString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + String deployedIndexId = "deployedIndexId-1101212953"; + UndeployIndexResponse response = + indexEndpointServiceClient.undeployIndexAsync(indexEndpoint, deployedIndexId).get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UndeployIndex_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java new file mode 100644 index 000000000000..bb9b821f2507 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UpdateIndexEndpointRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncUpdateIndexEndpoint(); + } + + public static void asyncUpdateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UpdateIndexEndpointRequest request = + UpdateIndexEndpointRequest.newBuilder() + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.updateIndexEndpointCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java new file mode 100644 index 000000000000..d6b6ca74c49d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.UpdateIndexEndpointRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncUpdateIndexEndpoint(); + } + + public static void syncUpdateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UpdateIndexEndpointRequest request = + UpdateIndexEndpointRequest.newBuilder() + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.updateIndexEndpoint(request); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java new file mode 100644 index 000000000000..a96222711eff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_IndexendpointFieldmask_sync] +import com.google.cloud.aiplatform.v1.IndexEndpoint; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexEndpointIndexendpointFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIndexEndpointIndexendpointFieldmask(); + } + + public static void syncUpdateIndexEndpointIndexendpointFieldmask() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.updateIndexEndpoint(indexEndpoint, updateMask); + } + } +} +// [END aiplatform_v1_generated_IndexEndpointService_UpdateIndexEndpoint_IndexendpointFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..0051c2214d2f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexEndpointServiceSettings_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointServiceSettings; +import java.time.Duration; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 + IndexEndpointServiceSettings.Builder indexEndpointServiceSettingsBuilder = + IndexEndpointServiceSettings.newBuilder(); + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings( + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexEndpointServiceSettings indexEndpointServiceSettings = + indexEndpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_IndexEndpointServiceSettings_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..418a3090d0e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.IndexServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + IndexServiceSettings indexServiceSettings = + IndexServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings); + } +} +// [END aiplatform_v1_generated_IndexService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..e716e3af7321 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.IndexServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + IndexServiceSettings indexServiceSettings = + IndexServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings); + } +} +// [END aiplatform_v1_generated_IndexService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndex.java new file mode 100644 index 000000000000..8a699e342481 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_CreateIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateIndex { + + public static void main(String[] args) throws Exception { + asyncCreateIndex(); + } + + public static void asyncCreateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.createIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_CreateIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndexLRO.java new file mode 100644 index 000000000000..adede24ed146 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/AsyncCreateIndexLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_CreateIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateIndexOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateIndexLRO { + + public static void main(String[] args) throws Exception { + asyncCreateIndexLRO(); + } + + public static void asyncCreateIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + OperationFuture future = + indexServiceClient.createIndexOperationCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_CreateIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndex.java new file mode 100644 index 000000000000..1b0faa7c7bbf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_CreateIndex_sync] +import com.google.cloud.aiplatform.v1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndex(); + } + + public static void syncCreateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + Index response = indexServiceClient.createIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_CreateIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java new file mode 100644 index 000000000000..1bce68f03c01 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_CreateIndex_LocationnameIndex_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndexLocationnameIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndexLocationnameIndex(); + } + + public static void syncCreateIndexLocationnameIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Index index = Index.newBuilder().build(); + Index response = indexServiceClient.createIndexAsync(parent, index).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_CreateIndex_LocationnameIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexStringIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexStringIndex.java new file mode 100644 index 000000000000..7ba8e772afa9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/createindex/SyncCreateIndexStringIndex.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_CreateIndex_StringIndex_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateIndexStringIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndexStringIndex(); + } + + public static void syncCreateIndexStringIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Index index = Index.newBuilder().build(); + Index response = indexServiceClient.createIndexAsync(parent, index).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_CreateIndex_StringIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndex.java new file mode 100644 index 000000000000..d6d3011efb1c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_DeleteIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteIndex { + + public static void main(String[] args) throws Exception { + asyncDeleteIndex(); + } + + public static void asyncDeleteIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + ApiFuture future = indexServiceClient.deleteIndexCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_DeleteIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndexLRO.java new file mode 100644 index 000000000000..42220770a423 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/AsyncDeleteIndexLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_DeleteIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteIndexLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexLRO(); + } + + public static void asyncDeleteIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + OperationFuture future = + indexServiceClient.deleteIndexOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_DeleteIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndex.java new file mode 100644 index 000000000000..308d6e58e03e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndex.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_DeleteIndex_sync] +import com.google.cloud.aiplatform.v1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndex { + + public static void main(String[] args) throws Exception { + syncDeleteIndex(); + } + + public static void syncDeleteIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + indexServiceClient.deleteIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_DeleteIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexIndexname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexIndexname.java new file mode 100644 index 000000000000..fd8d21f5df9d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexIndexname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_DeleteIndex_Indexname_sync] +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexIndexname { + + public static void main(String[] args) throws Exception { + syncDeleteIndexIndexname(); + } + + public static void syncDeleteIndexIndexname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]"); + indexServiceClient.deleteIndexAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_DeleteIndex_Indexname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexString.java new file mode 100644 index 000000000000..289748179de8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/deleteindex/SyncDeleteIndexString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_DeleteIndex_String_sync] +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexString { + + public static void main(String[] args) throws Exception { + syncDeleteIndexString(); + } + + public static void syncDeleteIndexString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString(); + indexServiceClient.deleteIndexAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_DeleteIndex_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..1f774f2f2a6f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..536aa14ca3e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = indexServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/AsyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/AsyncGetIndex.java new file mode 100644 index 000000000000..cb9f32ccd929 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/AsyncGetIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetIndexRequest; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; + +public class AsyncGetIndex { + + public static void main(String[] args) throws Exception { + asyncGetIndex(); + } + + public static void asyncGetIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIndexRequest request = + GetIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + ApiFuture future = indexServiceClient.getIndexCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..b7b24922891f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndex.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIndex_sync] +import com.google.cloud.aiplatform.v1.GetIndexRequest; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIndexRequest request = + GetIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + Index response = indexServiceClient.getIndex(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexIndexname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexIndexname.java new file mode 100644 index 000000000000..38c82637de20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexIndexname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIndex_Indexname_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; + +public class SyncGetIndexIndexname { + + public static void main(String[] args) throws Exception { + syncGetIndexIndexname(); + } + + public static void syncGetIndexIndexname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]"); + Index response = indexServiceClient.getIndex(name); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIndex_Indexname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexString.java new file mode 100644 index 000000000000..4e90bf480ac0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getindex/SyncGetIndexString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetIndex_String_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; + +public class SyncGetIndexString { + + public static void main(String[] args) throws Exception { + syncGetIndexString(); + } + + public static void syncGetIndexString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString(); + Index response = indexServiceClient.getIndex(name); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetIndex_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..627fa40919ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = indexServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..6f9dfc82df83 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = indexServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexes.java new file mode 100644 index 000000000000..a40bb25d86c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexes.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListIndexes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexes { + + public static void main(String[] args) throws Exception { + asyncListIndexes(); + } + + public static void asyncListIndexes() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.listIndexesPagedCallable().futureCall(request); + // Do something. + for (Index element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListIndexes_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexesPaged.java new file mode 100644 index 000000000000..15ad9bf262a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/AsyncListIndexesPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListIndexes_Paged_async] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1.ListIndexesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexesPaged { + + public static void main(String[] args) throws Exception { + asyncListIndexesPaged(); + } + + public static void asyncListIndexesPaged() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListIndexesResponse response = indexServiceClient.listIndexesCallable().call(request); + for (Index element : response.getIndexesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListIndexes_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexes.java new file mode 100644 index 000000000000..e391c8910230 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListIndexes_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListIndexes { + + public static void main(String[] args) throws Exception { + syncListIndexes(); + } + + public static void syncListIndexes() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Index element : indexServiceClient.listIndexes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListIndexes_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesLocationname.java new file mode 100644 index 000000000000..5d1a0a341dca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListIndexes_Locationname_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListIndexesLocationname { + + public static void main(String[] args) throws Exception { + syncListIndexesLocationname(); + } + + public static void syncListIndexesLocationname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListIndexes_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesString.java new file mode 100644 index 000000000000..cc76f9d85f6c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listindexes/SyncListIndexesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListIndexes_String_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListIndexesString { + + public static void main(String[] args) throws Exception { + syncListIndexesString(); + } + + public static void syncListIndexesString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListIndexes_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..4cd4ce6a3427 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + indexServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..edb3dc733e37 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = indexServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..3d0167e73c6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : indexServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_IndexService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/AsyncRemoveDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/AsyncRemoveDatapoints.java new file mode 100644 index 000000000000..992f97b36c74 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/AsyncRemoveDatapoints.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_RemoveDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.RemoveDatapointsRequest; +import com.google.cloud.aiplatform.v1.RemoveDatapointsResponse; +import java.util.ArrayList; + +public class AsyncRemoveDatapoints { + + public static void main(String[] args) throws Exception { + asyncRemoveDatapoints(); + } + + public static void asyncRemoveDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + RemoveDatapointsRequest request = + RemoveDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapointIds(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.removeDatapointsCallable().futureCall(request); + // Do something. + RemoveDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_RemoveDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/SyncRemoveDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/SyncRemoveDatapoints.java new file mode 100644 index 000000000000..91ea3fa6017b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/removedatapoints/SyncRemoveDatapoints.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_RemoveDatapoints_sync] +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.RemoveDatapointsRequest; +import com.google.cloud.aiplatform.v1.RemoveDatapointsResponse; +import java.util.ArrayList; + +public class SyncRemoveDatapoints { + + public static void main(String[] args) throws Exception { + syncRemoveDatapoints(); + } + + public static void syncRemoveDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + RemoveDatapointsRequest request = + RemoveDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapointIds(new ArrayList()) + .build(); + RemoveDatapointsResponse response = indexServiceClient.removeDatapoints(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_RemoveDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..d87775085e14 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..03098bc8d762 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = indexServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..072a2c126030 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..e9fb5946a837 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = indexServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndex.java new file mode 100644 index 000000000000..65584cd1134f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpdateIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.UpdateIndexRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndex { + + public static void main(String[] args) throws Exception { + asyncUpdateIndex(); + } + + public static void asyncUpdateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.updateIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpdateIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndexLRO.java new file mode 100644 index 000000000000..ebc271a61891 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/AsyncUpdateIndexLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpdateIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.UpdateIndexOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateIndexRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndexLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateIndexLRO(); + } + + public static void asyncUpdateIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + indexServiceClient.updateIndexOperationCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpdateIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndex.java new file mode 100644 index 000000000000..de9ce326525e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpdateIndex_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.UpdateIndexRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndex { + + public static void main(String[] args) throws Exception { + syncUpdateIndex(); + } + + public static void syncUpdateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Index response = indexServiceClient.updateIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpdateIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java new file mode 100644 index 000000000000..f2d983cca254 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpdateIndex_IndexFieldmask_sync] +import com.google.cloud.aiplatform.v1.Index; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexIndexFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIndexIndexFieldmask(); + } + + public static void syncUpdateIndexIndexFieldmask() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + Index index = Index.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Index response = indexServiceClient.updateIndexAsync(index, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpdateIndex_IndexFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java new file mode 100644 index 000000000000..224bdd8962aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpsertDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexDatapoint; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.UpsertDatapointsRequest; +import com.google.cloud.aiplatform.v1.UpsertDatapointsResponse; +import java.util.ArrayList; + +public class AsyncUpsertDatapoints { + + public static void main(String[] args) throws Exception { + asyncUpsertDatapoints(); + } + + public static void asyncUpsertDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpsertDatapointsRequest request = + UpsertDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapoints(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.upsertDatapointsCallable().futureCall(request); + // Do something. + UpsertDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpsertDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java new file mode 100644 index 000000000000..bb47fbe32252 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexService_UpsertDatapoints_sync] +import com.google.cloud.aiplatform.v1.IndexDatapoint; +import com.google.cloud.aiplatform.v1.IndexName; +import com.google.cloud.aiplatform.v1.IndexServiceClient; +import com.google.cloud.aiplatform.v1.UpsertDatapointsRequest; +import com.google.cloud.aiplatform.v1.UpsertDatapointsResponse; +import java.util.ArrayList; + +public class SyncUpsertDatapoints { + + public static void main(String[] args) throws Exception { + syncUpsertDatapoints(); + } + + public static void syncUpsertDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpsertDatapointsRequest request = + UpsertDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapoints(new ArrayList()) + .build(); + UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request); + } + } +} +// [END aiplatform_v1_generated_IndexService_UpsertDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservicesettings/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservicesettings/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..226b81d52f8d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/indexservicesettings/getindex/SyncGetIndex.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_IndexServiceSettings_GetIndex_sync] +import com.google.cloud.aiplatform.v1.IndexServiceSettings; +import java.time.Duration; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 + IndexServiceSettings.Builder indexServiceSettingsBuilder = IndexServiceSettings.newBuilder(); + indexServiceSettingsBuilder + .getIndexSettings() + .setRetrySettings( + indexServiceSettingsBuilder + .getIndexSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexServiceSettings indexServiceSettings = indexServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_IndexServiceSettings_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java new file mode 100644 index 000000000000..797066000646 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.CancelBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncCancelBatchPredictionJob(); + } + + public static void asyncCancelBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelBatchPredictionJobRequest request = + CancelBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelBatchPredictionJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java new file mode 100644 index 000000000000..7129f6bbfd21 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.CancelBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJob(); + } + + public static void syncCancelBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelBatchPredictionJobRequest request = + CancelBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + jobServiceClient.cancelBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..ffae30741233 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncCancelBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + jobServiceClient.cancelBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java new file mode 100644 index 000000000000..a86df8d533c7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJobString(); + } + + public static void syncCancelBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + jobServiceClient.cancelBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java new file mode 100644 index 000000000000..bf26cbeb54ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelCustomJobRequest; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelCustomJob { + + public static void main(String[] args) throws Exception { + asyncCancelCustomJob(); + } + + public static void asyncCancelCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelCustomJobRequest request = + CancelCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.cancelCustomJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJob.java new file mode 100644 index 000000000000..0da76390dba1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelCustomJob_sync] +import com.google.cloud.aiplatform.v1.CancelCustomJobRequest; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJob { + + public static void main(String[] args) throws Exception { + syncCancelCustomJob(); + } + + public static void syncCancelCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelCustomJobRequest request = + CancelCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + jobServiceClient.cancelCustomJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java new file mode 100644 index 000000000000..e86de5fdf53f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncCancelCustomJobCustomjobname(); + } + + public static void syncCancelCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + jobServiceClient.cancelCustomJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java new file mode 100644 index 000000000000..9589f4595ad2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelCustomJob_String_sync] +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJobString { + + public static void main(String[] args) throws Exception { + syncCancelCustomJobString(); + } + + public static void syncCancelCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + jobServiceClient.cancelCustomJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java new file mode 100644 index 000000000000..1f5fddd8fe44 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncCancelDataLabelingJob(); + } + + public static void asyncCancelDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelDataLabelingJobRequest request = + CancelDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelDataLabelingJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java new file mode 100644 index 000000000000..c88d06603341 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1.CancelDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJob(); + } + + public static void syncCancelDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelDataLabelingJobRequest request = + CancelDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + jobServiceClient.cancelDataLabelingJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..c6ef0c0e0049 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJobDatalabelingjobname(); + } + + public static void syncCancelDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + jobServiceClient.cancelDataLabelingJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java new file mode 100644 index 000000000000..a24fbdad58c7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJobString(); + } + + public static void syncCancelDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + jobServiceClient.cancelDataLabelingJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java new file mode 100644 index 000000000000..e75d7fb7aa68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncCancelHyperparameterTuningJob(); + } + + public static void asyncCancelHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelHyperparameterTuningJobRequest request = + CancelHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelHyperparameterTuningJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java new file mode 100644 index 000000000000..1f3b5eb23282 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1.CancelHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJob(); + } + + public static void syncCancelHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelHyperparameterTuningJobRequest request = + CancelHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + jobServiceClient.cancelHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..351cf1f7be7e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncCancelHyperparameterTuningJobHyperparametertuningjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + jobServiceClient.cancelHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java new file mode 100644 index 000000000000..0433ba4d70b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJobString(); + } + + public static void syncCancelHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + jobServiceClient.cancelHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/AsyncCancelNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/AsyncCancelNasJob.java new file mode 100644 index 000000000000..4ce36db983bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/AsyncCancelNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class AsyncCancelNasJob { + + public static void main(String[] args) throws Exception { + asyncCancelNasJob(); + } + + public static void asyncCancelNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelNasJobRequest request = + CancelNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.cancelNasJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJob.java new file mode 100644 index 000000000000..1f35252d9d7e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelNasJob_sync] +import com.google.cloud.aiplatform.v1.CancelNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJob { + + public static void main(String[] args) throws Exception { + syncCancelNasJob(); + } + + public static void syncCancelNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelNasJobRequest request = + CancelNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + jobServiceClient.cancelNasJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java new file mode 100644 index 000000000000..8588517c7fb0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncCancelNasJobNasjobname(); + } + + public static void syncCancelNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + jobServiceClient.cancelNasJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobString.java new file mode 100644 index 000000000000..4b5e12659a4d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/cancelnasjob/SyncCancelNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CancelNasJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJobString { + + public static void main(String[] args) throws Exception { + syncCancelNasJobString(); + } + + public static void syncCancelNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + jobServiceClient.cancelNasJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_CancelNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..e4a0c824dd68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.JobServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END aiplatform_v1_generated_JobService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..e37fa270189b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.JobServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END aiplatform_v1_generated_JobService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java new file mode 100644 index 000000000000..b430e0dc7f1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.CreateBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncCreateBatchPredictionJob(); + } + + public static void asyncCreateBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateBatchPredictionJobRequest request = + CreateBatchPredictionJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setBatchPredictionJob(BatchPredictionJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createBatchPredictionJobCallable().futureCall(request); + // Do something. + BatchPredictionJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java new file mode 100644 index 000000000000..58b7152cb1e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.CreateBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJob(); + } + + public static void syncCreateBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateBatchPredictionJobRequest request = + CreateBatchPredictionJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setBatchPredictionJob(BatchPredictionJob.newBuilder().build()) + .build(); + BatchPredictionJob response = jobServiceClient.createBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java new file mode 100644 index 000000000000..71a47b1acd7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateBatchPredictionJob_LocationnameBatchpredictionjob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateBatchPredictionJobLocationnameBatchpredictionjob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJobLocationnameBatchpredictionjob(); + } + + public static void syncCreateBatchPredictionJobLocationnameBatchpredictionjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + BatchPredictionJob batchPredictionJob = BatchPredictionJob.newBuilder().build(); + BatchPredictionJob response = + jobServiceClient.createBatchPredictionJob(parent, batchPredictionJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateBatchPredictionJob_LocationnameBatchpredictionjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java new file mode 100644 index 000000000000..af883ebe8404 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateBatchPredictionJob_StringBatchpredictionjob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateBatchPredictionJobStringBatchpredictionjob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJobStringBatchpredictionjob(); + } + + public static void syncCreateBatchPredictionJobStringBatchpredictionjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + BatchPredictionJob batchPredictionJob = BatchPredictionJob.newBuilder().build(); + BatchPredictionJob response = + jobServiceClient.createBatchPredictionJob(parent, batchPredictionJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateBatchPredictionJob_StringBatchpredictionjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/AsyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/AsyncCreateCustomJob.java new file mode 100644 index 000000000000..19369387d0d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/AsyncCreateCustomJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateCustomJobRequest; +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + asyncCreateCustomJob(); + } + + public static void asyncCreateCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateCustomJobRequest request = + CreateCustomJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCustomJob(CustomJob.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createCustomJobCallable().futureCall(request); + // Do something. + CustomJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..bc63db53e1ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1.CreateCustomJobRequest; +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateCustomJobRequest request = + CreateCustomJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCustomJob(CustomJob.newBuilder().build()) + .build(); + CustomJob response = jobServiceClient.createCustomJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java new file mode 100644 index 000000000000..cae3b9656623 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateCustomJob_LocationnameCustomjob_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateCustomJobLocationnameCustomjob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJobLocationnameCustomjob(); + } + + public static void syncCreateCustomJobLocationnameCustomjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomJob customJob = CustomJob.newBuilder().build(); + CustomJob response = jobServiceClient.createCustomJob(parent, customJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateCustomJob_LocationnameCustomjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java new file mode 100644 index 000000000000..ddc1b98a36ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateCustomJob_StringCustomjob_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateCustomJobStringCustomjob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJobStringCustomjob(); + } + + public static void syncCreateCustomJobStringCustomjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CustomJob customJob = CustomJob.newBuilder().build(); + CustomJob response = jobServiceClient.createCustomJob(parent, customJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateCustomJob_StringCustomjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java new file mode 100644 index 000000000000..54ddc34a4e8b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncCreateDataLabelingJob(); + } + + public static void asyncCreateDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateDataLabelingJobRequest request = + CreateDataLabelingJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataLabelingJob(DataLabelingJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createDataLabelingJobCallable().futureCall(request); + // Do something. + DataLabelingJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java new file mode 100644 index 000000000000..d4d6fcdbb1c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1.CreateDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJob(); + } + + public static void syncCreateDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateDataLabelingJobRequest request = + CreateDataLabelingJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataLabelingJob(DataLabelingJob.newBuilder().build()) + .build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java new file mode 100644 index 000000000000..2feae77e4a8c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateDataLabelingJob_LocationnameDatalabelingjob_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDataLabelingJobLocationnameDatalabelingjob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJobLocationnameDatalabelingjob(); + } + + public static void syncCreateDataLabelingJobLocationnameDatalabelingjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataLabelingJob dataLabelingJob = DataLabelingJob.newBuilder().build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(parent, dataLabelingJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateDataLabelingJob_LocationnameDatalabelingjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java new file mode 100644 index 000000000000..136b58092281 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateDataLabelingJob_StringDatalabelingjob_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateDataLabelingJobStringDatalabelingjob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJobStringDatalabelingjob(); + } + + public static void syncCreateDataLabelingJobStringDatalabelingjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + DataLabelingJob dataLabelingJob = DataLabelingJob.newBuilder().build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(parent, dataLabelingJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateDataLabelingJob_StringDatalabelingjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java new file mode 100644 index 000000000000..62d6ecba1066 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class AsyncCreateHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncCreateHyperparameterTuningJob(); + } + + public static void asyncCreateHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateHyperparameterTuningJobRequest request = + CreateHyperparameterTuningJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHyperparameterTuningJob(HyperparameterTuningJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createHyperparameterTuningJobCallable().futureCall(request); + // Do something. + HyperparameterTuningJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java new file mode 100644 index 000000000000..ae259d83bdbd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1.CreateHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJob(); + } + + public static void syncCreateHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateHyperparameterTuningJobRequest request = + CreateHyperparameterTuningJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHyperparameterTuningJob(HyperparameterTuningJob.newBuilder().build()) + .build(); + HyperparameterTuningJob response = jobServiceClient.createHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java new file mode 100644 index 000000000000..3cba4528d4d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_LocationnameHyperparametertuningjob_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob(); + } + + public static void syncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + HyperparameterTuningJob hyperparameterTuningJob = + HyperparameterTuningJob.newBuilder().build(); + HyperparameterTuningJob response = + jobServiceClient.createHyperparameterTuningJob(parent, hyperparameterTuningJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_LocationnameHyperparametertuningjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java new file mode 100644 index 000000000000..5d1f43848a4f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_StringHyperparametertuningjob_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncCreateHyperparameterTuningJobStringHyperparametertuningjob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJobStringHyperparametertuningjob(); + } + + public static void syncCreateHyperparameterTuningJobStringHyperparametertuningjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + HyperparameterTuningJob hyperparameterTuningJob = + HyperparameterTuningJob.newBuilder().build(); + HyperparameterTuningJob response = + jobServiceClient.createHyperparameterTuningJob(parent, hyperparameterTuningJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateHyperparameterTuningJob_StringHyperparametertuningjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..e57013c29fa1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class AsyncCreateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncCreateModelDeploymentMonitoringJob(); + } + + public static void asyncCreateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateModelDeploymentMonitoringJobRequest request = + CreateModelDeploymentMonitoringJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..d02a8bfa4e1d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.CreateModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJob(); + } + + public static void syncCreateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateModelDeploymentMonitoringJobRequest request = + CreateModelDeploymentMonitoringJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java new file mode 100644 index 000000000000..b700ef7fec3e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_LocationnameModeldeploymentmonitoringjob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob(); + } + + public static void + syncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(parent, modelDeploymentMonitoringJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_LocationnameModeldeploymentmonitoringjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java new file mode 100644 index 000000000000..d5f03fc5c1ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_StringModeldeploymentmonitoringjob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob(); + } + + public static void syncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(parent, modelDeploymentMonitoringJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateModelDeploymentMonitoringJob_StringModeldeploymentmonitoringjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/AsyncCreateNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/AsyncCreateNasJob.java new file mode 100644 index 000000000000..f151c471fc7e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/AsyncCreateNasJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class AsyncCreateNasJob { + + public static void main(String[] args) throws Exception { + asyncCreateNasJob(); + } + + public static void asyncCreateNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateNasJobRequest request = + CreateNasJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setNasJob(NasJob.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createNasJobCallable().futureCall(request); + // Do something. + NasJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJob.java new file mode 100644 index 000000000000..994a7e4df166 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateNasJob_sync] +import com.google.cloud.aiplatform.v1.CreateNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class SyncCreateNasJob { + + public static void main(String[] args) throws Exception { + syncCreateNasJob(); + } + + public static void syncCreateNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateNasJobRequest request = + CreateNasJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setNasJob(NasJob.newBuilder().build()) + .build(); + NasJob response = jobServiceClient.createNasJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java new file mode 100644 index 000000000000..adf29730d1d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateNasJob_LocationnameNasjob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class SyncCreateNasJobLocationnameNasjob { + + public static void main(String[] args) throws Exception { + syncCreateNasJobLocationnameNasjob(); + } + + public static void syncCreateNasJobLocationnameNasjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + NasJob nasJob = NasJob.newBuilder().build(); + NasJob response = jobServiceClient.createNasJob(parent, nasJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateNasJob_LocationnameNasjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java new file mode 100644 index 000000000000..5fef1e49b584 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_CreateNasJob_StringNasjob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class SyncCreateNasJobStringNasjob { + + public static void main(String[] args) throws Exception { + syncCreateNasJobStringNasjob(); + } + + public static void syncCreateNasJobStringNasjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + NasJob nasJob = NasJob.newBuilder().build(); + NasJob response = jobServiceClient.createNasJob(parent, nasJob); + } + } +} +// [END aiplatform_v1_generated_JobService_CreateNasJob_StringNasjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java new file mode 100644 index 000000000000..b4c37f3a9fd3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncDeleteBatchPredictionJob(); + } + + public static void asyncDeleteBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteBatchPredictionJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java new file mode 100644 index 000000000000..2da68be800e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteBatchPredictionJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteBatchPredictionJobLRO(); + } + + public static void asyncDeleteBatchPredictionJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteBatchPredictionJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java new file mode 100644 index 000000000000..5d003e40373b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJob(); + } + + public static void syncDeleteBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + jobServiceClient.deleteBatchPredictionJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..beb1b8767831 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncDeleteBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + jobServiceClient.deleteBatchPredictionJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java new file mode 100644 index 000000000000..02a645838854 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJobString(); + } + + public static void syncDeleteBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + jobServiceClient.deleteBatchPredictionJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java new file mode 100644 index 000000000000..345a6fa99c3b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteCustomJob { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomJob(); + } + + public static void asyncDeleteCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteCustomJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java new file mode 100644 index 000000000000..102f8c6ed3e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteCustomJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteCustomJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomJobLRO(); + } + + public static void asyncDeleteCustomJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteCustomJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteCustomJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJob.java new file mode 100644 index 000000000000..15af03b10137 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteCustomJob_sync] +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJob { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJob(); + } + + public static void syncDeleteCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + jobServiceClient.deleteCustomJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java new file mode 100644 index 000000000000..33decd3d3d62 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJobCustomjobname(); + } + + public static void syncDeleteCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + jobServiceClient.deleteCustomJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java new file mode 100644 index 000000000000..32774e1d5860 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteCustomJob_String_sync] +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJobString { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJobString(); + } + + public static void syncDeleteCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + jobServiceClient.deleteCustomJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java new file mode 100644 index 000000000000..00909e38106b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncDeleteDataLabelingJob(); + } + + public static void asyncDeleteDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteDataLabelingJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java new file mode 100644 index 000000000000..9c3af71732fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteDataLabelingJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteDataLabelingJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDataLabelingJobLRO(); + } + + public static void asyncDeleteDataLabelingJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteDataLabelingJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteDataLabelingJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java new file mode 100644 index 000000000000..fe6aab093385 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJob(); + } + + public static void syncDeleteDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteDataLabelingJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..96d0b1e6ff47 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJobDatalabelingjobname(); + } + + public static void syncDeleteDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + jobServiceClient.deleteDataLabelingJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java new file mode 100644 index 000000000000..a08c5b78c93b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJobString(); + } + + public static void syncDeleteDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + jobServiceClient.deleteDataLabelingJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java new file mode 100644 index 000000000000..bdfcf12caa09 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncDeleteHyperparameterTuningJob(); + } + + public static void asyncDeleteHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteHyperparameterTuningJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java new file mode 100644 index 000000000000..2bcf6d8ce9f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteHyperparameterTuningJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteHyperparameterTuningJobLRO(); + } + + public static void asyncDeleteHyperparameterTuningJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteHyperparameterTuningJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java new file mode 100644 index 000000000000..23a6ed5584b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJob(); + } + + public static void syncDeleteHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteHyperparameterTuningJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..d7098c2eaa0f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncDeleteHyperparameterTuningJobHyperparametertuningjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + jobServiceClient.deleteHyperparameterTuningJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java new file mode 100644 index 000000000000..e6064ec72bcc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJobString(); + } + + public static void syncDeleteHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + jobServiceClient.deleteHyperparameterTuningJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..24c1d68a4d2f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.longrunning.Operation; + +public class AsyncDeleteModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncDeleteModelDeploymentMonitoringJob(); + } + + public static void asyncDeleteModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java new file mode 100644 index 000000000000..d55c97b48159 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelDeploymentMonitoringJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelDeploymentMonitoringJobLRO(); + } + + public static void asyncDeleteModelDeploymentMonitoringJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient + .deleteModelDeploymentMonitoringJobOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..1bb7355ff4f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJob(); + } + + public static void syncDeleteModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..8ddfc09c5124 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..17399ec745c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJobString(); + } + + public static void syncDeleteModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJob.java new file mode 100644 index 000000000000..23b72751d2a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.longrunning.Operation; + +public class AsyncDeleteNasJob { + + public static void main(String[] args) throws Exception { + asyncDeleteNasJob(); + } + + public static void asyncDeleteNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteNasJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java new file mode 100644 index 000000000000..27ae25d6855d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteNasJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class AsyncDeleteNasJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteNasJobLRO(); + } + + public static void asyncDeleteNasJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteNasJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteNasJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJob.java new file mode 100644 index 000000000000..a59de22a6d5d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteNasJob_sync] +import com.google.cloud.aiplatform.v1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJob { + + public static void main(String[] args) throws Exception { + syncDeleteNasJob(); + } + + public static void syncDeleteNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + jobServiceClient.deleteNasJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java new file mode 100644 index 000000000000..e29ce65a0a20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncDeleteNasJobNasjobname(); + } + + public static void syncDeleteNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + jobServiceClient.deleteNasJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobString.java new file mode 100644 index 000000000000..cf0799addc51 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/deletenasjob/SyncDeleteNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_DeleteNasJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJobString { + + public static void main(String[] args) throws Exception { + syncDeleteNasJobString(); + } + + public static void syncDeleteNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + jobServiceClient.deleteNasJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_DeleteNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java new file mode 100644 index 000000000000..34cfc40dc359 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.GetBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class AsyncGetBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncGetBatchPredictionJob(); + } + + public static void asyncGetBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetBatchPredictionJobRequest request = + GetBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getBatchPredictionJobCallable().futureCall(request); + // Do something. + BatchPredictionJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java new file mode 100644 index 000000000000..da862bea692f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.GetBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJob(); + } + + public static void syncGetBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetBatchPredictionJobRequest request = + GetBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..7e15d02bc95d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncGetBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java new file mode 100644 index 000000000000..8c9a04d64ccf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJobString(); + } + + public static void syncGetBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/AsyncGetCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/AsyncGetCustomJob.java new file mode 100644 index 000000000000..51a1fe0f3075 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/AsyncGetCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.GetCustomJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class AsyncGetCustomJob { + + public static void main(String[] args) throws Exception { + asyncGetCustomJob(); + } + + public static void asyncGetCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetCustomJobRequest request = + GetCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getCustomJobCallable().futureCall(request); + // Do something. + CustomJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJob.java new file mode 100644 index 000000000000..4ae9a1954abd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetCustomJob_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.GetCustomJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetCustomJob { + + public static void main(String[] args) throws Exception { + syncGetCustomJob(); + } + + public static void syncGetCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetCustomJobRequest request = + GetCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + CustomJob response = jobServiceClient.getCustomJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java new file mode 100644 index 000000000000..20697a8a7c33 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncGetCustomJobCustomjobname(); + } + + public static void syncGetCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + CustomJob response = jobServiceClient.getCustomJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobString.java new file mode 100644 index 000000000000..a1f872d5f573 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getcustomjob/SyncGetCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetCustomJob_String_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.CustomJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetCustomJobString { + + public static void main(String[] args) throws Exception { + syncGetCustomJobString(); + } + + public static void syncGetCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + CustomJob response = jobServiceClient.getCustomJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java new file mode 100644 index 000000000000..b4195f01396d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.GetDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class AsyncGetDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncGetDataLabelingJob(); + } + + public static void asyncGetDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetDataLabelingJobRequest request = + GetDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getDataLabelingJobCallable().futureCall(request); + // Do something. + DataLabelingJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java new file mode 100644 index 000000000000..6e777f482d35 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.GetDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJob(); + } + + public static void syncGetDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetDataLabelingJobRequest request = + GetDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..bab3a49fc09f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJobDatalabelingjobname(); + } + + public static void syncGetDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java new file mode 100644 index 000000000000..655f68c56b7b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJobString(); + } + + public static void syncGetDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java new file mode 100644 index 000000000000..0b8756935a16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class AsyncGetHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncGetHyperparameterTuningJob(); + } + + public static void asyncGetHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetHyperparameterTuningJobRequest request = + GetHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getHyperparameterTuningJobCallable().futureCall(request); + // Do something. + HyperparameterTuningJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java new file mode 100644 index 000000000000..8cc8ae4e9787 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1.GetHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJob(); + } + + public static void syncGetHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetHyperparameterTuningJobRequest request = + GetHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..64fac5e50395 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncGetHyperparameterTuningJobHyperparametertuningjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java new file mode 100644 index 000000000000..43cdd4745bfe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1.JobServiceClient; + +public class SyncGetHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJobString(); + } + + public static void syncGetHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..0ab6695cd4c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..3a9077c32a65 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = jobServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..3fe765618cd4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = jobServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..3434f15f317b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = jobServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..95d2dc802a2c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; + +public class AsyncGetModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncGetModelDeploymentMonitoringJob(); + } + + public static void asyncGetModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetModelDeploymentMonitoringJobRequest request = + GetModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..d69048c00402 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.GetModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJob(); + } + + public static void syncGetModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetModelDeploymentMonitoringJobRequest request = + GetModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..fbdf8db57b3d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..e64d9f2db0fc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJobString(); + } + + public static void syncGetModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/AsyncGetNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/AsyncGetNasJob.java new file mode 100644 index 000000000000..d22ca61c180e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/AsyncGetNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.cloud.aiplatform.v1.NasJobName; + +public class AsyncGetNasJob { + + public static void main(String[] args) throws Exception { + asyncGetNasJob(); + } + + public static void asyncGetNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasJobRequest request = + GetNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getNasJobCallable().futureCall(request); + // Do something. + NasJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJob.java new file mode 100644 index 000000000000..807676315365 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasJob_sync] +import com.google.cloud.aiplatform.v1.GetNasJobRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.cloud.aiplatform.v1.NasJobName; + +public class SyncGetNasJob { + + public static void main(String[] args) throws Exception { + syncGetNasJob(); + } + + public static void syncGetNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasJobRequest request = + GetNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + NasJob response = jobServiceClient.getNasJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobNasjobname.java new file mode 100644 index 000000000000..9a737c306102 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.cloud.aiplatform.v1.NasJobName; + +public class SyncGetNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncGetNasJobNasjobname(); + } + + public static void syncGetNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + NasJob response = jobServiceClient.getNasJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobString.java new file mode 100644 index 000000000000..c5bb010fd81a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnasjob/SyncGetNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.cloud.aiplatform.v1.NasJobName; + +public class SyncGetNasJobString { + + public static void main(String[] args) throws Exception { + syncGetNasJobString(); + } + + public static void syncGetNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + NasJob response = jobServiceClient.getNasJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java new file mode 100644 index 000000000000..fe652d8d9c3b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasTrialDetail_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetNasTrialDetailRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasTrialDetail; +import com.google.cloud.aiplatform.v1.NasTrialDetailName; + +public class AsyncGetNasTrialDetail { + + public static void main(String[] args) throws Exception { + asyncGetNasTrialDetail(); + } + + public static void asyncGetNasTrialDetail() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasTrialDetailRequest request = + GetNasTrialDetailRequest.newBuilder() + .setName( + NasTrialDetailName.of( + "[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getNasTrialDetailCallable().futureCall(request); + // Do something. + NasTrialDetail response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasTrialDetail_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java new file mode 100644 index 000000000000..22c8ffeb4a96 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasTrialDetail_sync] +import com.google.cloud.aiplatform.v1.GetNasTrialDetailRequest; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasTrialDetail; +import com.google.cloud.aiplatform.v1.NasTrialDetailName; + +public class SyncGetNasTrialDetail { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetail(); + } + + public static void syncGetNasTrialDetail() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasTrialDetailRequest request = + GetNasTrialDetailRequest.newBuilder() + .setName( + NasTrialDetailName.of( + "[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString()) + .build(); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(request); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasTrialDetail_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java new file mode 100644 index 000000000000..adf8f0cc09f7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasTrialDetail_Nastrialdetailname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasTrialDetail; +import com.google.cloud.aiplatform.v1.NasTrialDetailName; + +public class SyncGetNasTrialDetailNastrialdetailname { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetailNastrialdetailname(); + } + + public static void syncGetNasTrialDetailNastrialdetailname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasTrialDetailName name = + NasTrialDetailName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]"); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasTrialDetail_Nastrialdetailname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java new file mode 100644 index 000000000000..05ac38470c09 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_GetNasTrialDetail_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasTrialDetail; +import com.google.cloud.aiplatform.v1.NasTrialDetailName; + +public class SyncGetNasTrialDetailString { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetailString(); + } + + public static void syncGetNasTrialDetailString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + NasTrialDetailName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString(); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(name); + } + } +} +// [END aiplatform_v1_generated_JobService_GetNasTrialDetail_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java new file mode 100644 index 000000000000..05d697ac490e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListBatchPredictionJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListBatchPredictionJobs { + + public static void main(String[] args) throws Exception { + asyncListBatchPredictionJobs(); + } + + public static void asyncListBatchPredictionJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listBatchPredictionJobsPagedCallable().futureCall(request); + // Do something. + for (BatchPredictionJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListBatchPredictionJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java new file mode 100644 index 000000000000..6d8a4bed25ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListBatchPredictionJobs_Paged_async] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1.ListBatchPredictionJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListBatchPredictionJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListBatchPredictionJobsPaged(); + } + + public static void asyncListBatchPredictionJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListBatchPredictionJobsResponse response = + jobServiceClient.listBatchPredictionJobsCallable().call(request); + for (BatchPredictionJob element : response.getBatchPredictionJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListBatchPredictionJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java new file mode 100644 index 000000000000..c3516de4b316 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListBatchPredictionJobs_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListBatchPredictionJobs { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobs(); + } + + public static void syncListBatchPredictionJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListBatchPredictionJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java new file mode 100644 index 000000000000..79afa784893b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListBatchPredictionJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListBatchPredictionJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobsLocationname(); + } + + public static void syncListBatchPredictionJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListBatchPredictionJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java new file mode 100644 index 000000000000..4235df3541a1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListBatchPredictionJobs_String_sync] +import com.google.cloud.aiplatform.v1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListBatchPredictionJobsString { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobsString(); + } + + public static void syncListBatchPredictionJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListBatchPredictionJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobs.java new file mode 100644 index 000000000000..83f0f8be3f99 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListCustomJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListCustomJobs { + + public static void main(String[] args) throws Exception { + asyncListCustomJobs(); + } + + public static void asyncListCustomJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listCustomJobsPagedCallable().futureCall(request); + // Do something. + for (CustomJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListCustomJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java new file mode 100644 index 000000000000..737579e3c01a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListCustomJobs_Paged_async] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1.ListCustomJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListCustomJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListCustomJobsPaged(); + } + + public static void asyncListCustomJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListCustomJobsResponse response = jobServiceClient.listCustomJobsCallable().call(request); + for (CustomJob element : response.getCustomJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListCustomJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobs.java new file mode 100644 index 000000000000..3aacf2be3e89 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListCustomJobs_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListCustomJobs { + + public static void main(String[] args) throws Exception { + syncListCustomJobs(); + } + + public static void syncListCustomJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (CustomJob element : jobServiceClient.listCustomJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListCustomJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java new file mode 100644 index 000000000000..4886eb498dbd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListCustomJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListCustomJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListCustomJobsLocationname(); + } + + public static void syncListCustomJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CustomJob element : jobServiceClient.listCustomJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListCustomJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsString.java new file mode 100644 index 000000000000..5c59b7007833 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listcustomjobs/SyncListCustomJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListCustomJobs_String_sync] +import com.google.cloud.aiplatform.v1.CustomJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListCustomJobsString { + + public static void main(String[] args) throws Exception { + syncListCustomJobsString(); + } + + public static void syncListCustomJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CustomJob element : jobServiceClient.listCustomJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListCustomJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java new file mode 100644 index 000000000000..5c3025e52775 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListDataLabelingJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListDataLabelingJobs { + + public static void main(String[] args) throws Exception { + asyncListDataLabelingJobs(); + } + + public static void asyncListDataLabelingJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + jobServiceClient.listDataLabelingJobsPagedCallable().futureCall(request); + // Do something. + for (DataLabelingJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListDataLabelingJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java new file mode 100644 index 000000000000..e1695ac16ddd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListDataLabelingJobs_Paged_async] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1.ListDataLabelingJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDataLabelingJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListDataLabelingJobsPaged(); + } + + public static void asyncListDataLabelingJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDataLabelingJobsResponse response = + jobServiceClient.listDataLabelingJobsCallable().call(request); + for (DataLabelingJob element : response.getDataLabelingJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListDataLabelingJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java new file mode 100644 index 000000000000..30199af87c14 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListDataLabelingJobs_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListDataLabelingJobs { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobs(); + } + + public static void syncListDataLabelingJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListDataLabelingJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java new file mode 100644 index 000000000000..5e67a72d0885 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListDataLabelingJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListDataLabelingJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobsLocationname(); + } + + public static void syncListDataLabelingJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListDataLabelingJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java new file mode 100644 index 000000000000..0f1da4a7ada9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListDataLabelingJobs_String_sync] +import com.google.cloud.aiplatform.v1.DataLabelingJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListDataLabelingJobsString { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobsString(); + } + + public static void syncListDataLabelingJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListDataLabelingJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java new file mode 100644 index 000000000000..a2eee969e819 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListHyperparameterTuningJobs { + + public static void main(String[] args) throws Exception { + asyncListHyperparameterTuningJobs(); + } + + public static void asyncListHyperparameterTuningJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listHyperparameterTuningJobsPagedCallable().futureCall(request); + // Do something. + for (HyperparameterTuningJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java new file mode 100644 index 000000000000..e83613a71a26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_Paged_async] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1.ListHyperparameterTuningJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListHyperparameterTuningJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListHyperparameterTuningJobsPaged(); + } + + public static void asyncListHyperparameterTuningJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListHyperparameterTuningJobsResponse response = + jobServiceClient.listHyperparameterTuningJobsCallable().call(request); + for (HyperparameterTuningJob element : response.getHyperparameterTuningJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java new file mode 100644 index 000000000000..136fa5c40c07 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListHyperparameterTuningJobs { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobs(); + } + + public static void syncListHyperparameterTuningJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java new file mode 100644 index 000000000000..9c124334fbdb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListHyperparameterTuningJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobsLocationname(); + } + + public static void syncListHyperparameterTuningJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java new file mode 100644 index 000000000000..97003c423594 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_String_sync] +import com.google.cloud.aiplatform.v1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; + +public class SyncListHyperparameterTuningJobsString { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobsString(); + } + + public static void syncListHyperparameterTuningJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListHyperparameterTuningJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..2a188052c438 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + jobServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..508c90a4c4e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = jobServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..cfcf2ba1db86 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : jobServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java new file mode 100644 index 000000000000..6d9fdf965ae0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class AsyncListModelDeploymentMonitoringJobs { + + public static void main(String[] args) throws Exception { + asyncListModelDeploymentMonitoringJobs(); + } + + public static void asyncListModelDeploymentMonitoringJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listModelDeploymentMonitoringJobsPagedCallable().futureCall(request); + // Do something. + for (ModelDeploymentMonitoringJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java new file mode 100644 index 000000000000..41a35198781b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_Paged_async] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1.ListModelDeploymentMonitoringJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelDeploymentMonitoringJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelDeploymentMonitoringJobsPaged(); + } + + public static void asyncListModelDeploymentMonitoringJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelDeploymentMonitoringJobsResponse response = + jobServiceClient.listModelDeploymentMonitoringJobsCallable().call(request); + for (ModelDeploymentMonitoringJob element : + response.getModelDeploymentMonitoringJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java new file mode 100644 index 000000000000..4750f24c8162 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class SyncListModelDeploymentMonitoringJobs { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobs(); + } + + public static void syncListModelDeploymentMonitoringJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java new file mode 100644 index 000000000000..70ae832f80a4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class SyncListModelDeploymentMonitoringJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobsLocationname(); + } + + public static void syncListModelDeploymentMonitoringJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java new file mode 100644 index 000000000000..0c96131ed513 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; + +public class SyncListModelDeploymentMonitoringJobsString { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobsString(); + } + + public static void syncListModelDeploymentMonitoringJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListModelDeploymentMonitoringJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobs.java new file mode 100644 index 000000000000..b178af0be973 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobs.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.protobuf.FieldMask; + +public class AsyncListNasJobs { + + public static void main(String[] args) throws Exception { + asyncListNasJobs(); + } + + public static void asyncListNasJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.listNasJobsPagedCallable().futureCall(request); + // Do something. + for (NasJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobsPaged.java new file mode 100644 index 000000000000..e2f550ddd79f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/AsyncListNasJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasJobs_Paged_async] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1.ListNasJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListNasJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListNasJobsPaged(); + } + + public static void asyncListNasJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListNasJobsResponse response = jobServiceClient.listNasJobsCallable().call(request); + for (NasJob element : response.getNasJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobs.java new file mode 100644 index 000000000000..7ba6cf75bfe7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasJobs_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; +import com.google.protobuf.FieldMask; + +public class SyncListNasJobs { + + public static void main(String[] args) throws Exception { + syncListNasJobs(); + } + + public static void syncListNasJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (NasJob element : jobServiceClient.listNasJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsLocationname.java new file mode 100644 index 000000000000..adbc398e4983 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class SyncListNasJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListNasJobsLocationname(); + } + + public static void syncListNasJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (NasJob element : jobServiceClient.listNasJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsString.java new file mode 100644 index 000000000000..435318cae5d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnasjobs/SyncListNasJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasJobs_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.NasJob; + +public class SyncListNasJobsString { + + public static void main(String[] args) throws Exception { + syncListNasJobsString(); + } + + public static void syncListNasJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (NasJob element : jobServiceClient.listNasJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java new file mode 100644 index 000000000000..6d9a087cf67a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasTrialDetails_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.cloud.aiplatform.v1.NasTrialDetail; + +public class AsyncListNasTrialDetails { + + public static void main(String[] args) throws Exception { + asyncListNasTrialDetails(); + } + + public static void asyncListNasTrialDetails() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + jobServiceClient.listNasTrialDetailsPagedCallable().futureCall(request); + // Do something. + for (NasTrialDetail element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasTrialDetails_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java new file mode 100644 index 000000000000..fb3f5d17a9f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasTrialDetails_Paged_async] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1.ListNasTrialDetailsResponse; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.cloud.aiplatform.v1.NasTrialDetail; +import com.google.common.base.Strings; + +public class AsyncListNasTrialDetailsPaged { + + public static void main(String[] args) throws Exception { + asyncListNasTrialDetailsPaged(); + } + + public static void asyncListNasTrialDetailsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListNasTrialDetailsResponse response = + jobServiceClient.listNasTrialDetailsCallable().call(request); + for (NasTrialDetail element : response.getNasTrialDetailsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasTrialDetails_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java new file mode 100644 index 000000000000..f690cc004205 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasTrialDetails_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.cloud.aiplatform.v1.NasTrialDetail; + +public class SyncListNasTrialDetails { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetails(); + } + + public static void syncListNasTrialDetails() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasTrialDetails_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java new file mode 100644 index 000000000000..1426324e5ec8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasTrialDetails_Nasjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.cloud.aiplatform.v1.NasTrialDetail; + +public class SyncListNasTrialDetailsNasjobname { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetailsNasjobname(); + } + + public static void syncListNasTrialDetailsNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName parent = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasTrialDetails_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java new file mode 100644 index 000000000000..fd6b4ca7ebdb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ListNasTrialDetails_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.NasJobName; +import com.google.cloud.aiplatform.v1.NasTrialDetail; + +public class SyncListNasTrialDetailsString { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetailsString(); + } + + public static void syncListNasTrialDetailsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_ListNasTrialDetails_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..0f8ad571d822 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.PauseModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class AsyncPauseModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncPauseModelDeploymentMonitoringJob(); + } + + public static void asyncPauseModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + PauseModelDeploymentMonitoringJobRequest request = + PauseModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.pauseModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..15e1e7c6f41a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.PauseModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJob(); + } + + public static void syncPauseModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + PauseModelDeploymentMonitoringJobRequest request = + PauseModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.pauseModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..eb0f00c93d6b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.pauseModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..5b43031e99ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJobString(); + } + + public static void syncPauseModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.pauseModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_PauseModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..60dd078e28b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ResumeModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class AsyncResumeModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncResumeModelDeploymentMonitoringJob(); + } + + public static void asyncResumeModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ResumeModelDeploymentMonitoringJobRequest request = + ResumeModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.resumeModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..00d23b86ef88 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ResumeModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJob(); + } + + public static void syncResumeModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ResumeModelDeploymentMonitoringJobRequest request = + ResumeModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.resumeModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..75508a53b4f7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.resumeModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..495cf1a9bceb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJobString(); + } + + public static void syncResumeModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.resumeModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1_generated_JobService_ResumeModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java new file mode 100644 index 000000000000..7ef3f8c049b0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncSearchModelDeploymentMonitoringStatsAnomalies { + + public static void main(String[] args) throws Exception { + asyncSearchModelDeploymentMonitoringStatsAnomalies(); + } + + public static void asyncSearchModelDeploymentMonitoringStatsAnomalies() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomaliesPagedCallable() + .futureCall(request); + // Do something. + for (ModelMonitoringStatsAnomalies element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java new file mode 100644 index 000000000000..ec7ea6c98830 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_Paged_async] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.cloud.aiplatform.v1.SearchModelDeploymentMonitoringStatsAnomaliesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchModelDeploymentMonitoringStatsAnomaliesPaged(); + } + + public static void asyncSearchModelDeploymentMonitoringStatsAnomaliesPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + while (true) { + SearchModelDeploymentMonitoringStatsAnomaliesResponse response = + jobServiceClient.searchModelDeploymentMonitoringStatsAnomaliesCallable().call(request); + for (ModelMonitoringStatsAnomalies element : response.getMonitoringStatsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java new file mode 100644 index 000000000000..f9af21624e91 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class SyncSearchModelDeploymentMonitoringStatsAnomalies { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomalies(); + } + + public static void syncSearchModelDeploymentMonitoringStatsAnomalies() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + for (ModelMonitoringStatsAnomalies element : + jobServiceClient.searchModelDeploymentMonitoringStatsAnomalies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java new file mode 100644 index 000000000000..740c0db05eb3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_ModeldeploymentmonitoringjobnameString_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies; + +public +class SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString(); + } + + public static void + syncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + String deployedModelId = "deployedModelId-1817547906"; + for (ModelMonitoringStatsAnomalies element : + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomalies( + modelDeploymentMonitoringJob, deployedModelId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_ModeldeploymentmonitoringjobnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java new file mode 100644 index 000000000000..870cab0b2ba1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_StringString_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies; + +public class SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomaliesStringString(); + } + + public static void syncSearchModelDeploymentMonitoringStatsAnomaliesStringString() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + String deployedModelId = "deployedModelId-1817547906"; + for (ModelMonitoringStatsAnomalies element : + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomalies( + modelDeploymentMonitoringJob, deployedModelId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..7fb9bec3a1c9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..9022c220ba54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = jobServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_JobService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..8c6a896a1534 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + jobServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..389ae22e5354 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = jobServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_JobService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..7e3137d8f46c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncUpdateModelDeploymentMonitoringJob(); + } + + public static void asyncUpdateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.updateModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java new file mode 100644 index 000000000000..3b689fba2022 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.UpdateModelDeploymentMonitoringJobOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModelDeploymentMonitoringJobLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateModelDeploymentMonitoringJobLRO(); + } + + public static void asyncUpdateModelDeploymentMonitoringJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture< + ModelDeploymentMonitoringJob, UpdateModelDeploymentMonitoringJobOperationMetadata> + future = + jobServiceClient + .updateModelDeploymentMonitoringJobOperationCallable() + .futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..ce3e48d46064 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncUpdateModelDeploymentMonitoringJob(); + } + + public static void syncUpdateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.updateModelDeploymentMonitoringJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java new file mode 100644 index 000000000000..4acbb64601af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_ModeldeploymentmonitoringjobFieldmask_sync] +import com.google.cloud.aiplatform.v1.JobServiceClient; +import com.google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask(); + } + + public static void syncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient + .updateModelDeploymentMonitoringJobAsync(modelDeploymentMonitoringJob, updateMask) + .get(); + } + } +} +// [END aiplatform_v1_generated_JobService_UpdateModelDeploymentMonitoringJob_ModeldeploymentmonitoringjobFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..b6d0babc71a4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_JobServiceSettings_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1.JobServiceSettings; +import java.time.Duration; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 + JobServiceSettings.Builder jobServiceSettingsBuilder = JobServiceSettings.newBuilder(); + jobServiceSettingsBuilder + .createCustomJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder + .createCustomJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_JobServiceSettings_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..615501a39e31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.aiplatform.v1.MatchServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MatchServiceSettings matchServiceSettings = + MatchServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MatchServiceClient matchServiceClient = MatchServiceClient.create(matchServiceSettings); + } +} +// [END aiplatform_v1_generated_MatchService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..51354065e00d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.aiplatform.v1.MatchServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MatchServiceSettings matchServiceSettings = + MatchServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MatchServiceClient matchServiceClient = MatchServiceClient.create(matchServiceSettings); + } +} +// [END aiplatform_v1_generated_MatchService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/AsyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/AsyncFindNeighbors.java new file mode 100644 index 000000000000..0761eefb3e11 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/AsyncFindNeighbors.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_FindNeighbors_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.FindNeighborsRequest; +import com.google.cloud.aiplatform.v1.FindNeighborsResponse; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import java.util.ArrayList; + +public class AsyncFindNeighbors { + + public static void main(String[] args) throws Exception { + asyncFindNeighbors(); + } + + public static void asyncFindNeighbors() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + FindNeighborsRequest request = + FindNeighborsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllQueries(new ArrayList()) + .setReturnFullDatapoint(true) + .build(); + ApiFuture future = + matchServiceClient.findNeighborsCallable().futureCall(request); + // Do something. + FindNeighborsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_FindNeighbors_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..bdc0d264f5c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1.FindNeighborsRequest; +import com.google.cloud.aiplatform.v1.FindNeighborsResponse; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import java.util.ArrayList; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + FindNeighborsRequest request = + FindNeighborsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllQueries(new ArrayList()) + .setReturnFullDatapoint(true) + .build(); + FindNeighborsResponse response = matchServiceClient.findNeighbors(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..3251f1366b05 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = matchServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..1aea0561e7cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = matchServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..15e9890c4ecf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = matchServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..95182c5995f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = matchServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..e1401857f4c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + matchServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MatchService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..2048cbe29a1e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = matchServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MatchService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..b44ce2537f5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : matchServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MatchService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java new file mode 100644 index 000000000000..3f778fb0b772 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_ReadIndexDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.aiplatform.v1.ReadIndexDatapointsRequest; +import com.google.cloud.aiplatform.v1.ReadIndexDatapointsResponse; +import java.util.ArrayList; + +public class AsyncReadIndexDatapoints { + + public static void main(String[] args) throws Exception { + asyncReadIndexDatapoints(); + } + + public static void asyncReadIndexDatapoints() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ReadIndexDatapointsRequest request = + ReadIndexDatapointsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllIds(new ArrayList()) + .build(); + ApiFuture future = + matchServiceClient.readIndexDatapointsCallable().futureCall(request); + // Do something. + ReadIndexDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_ReadIndexDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java new file mode 100644 index 000000000000..9c2f5d3841f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_ReadIndexDatapoints_sync] +import com.google.cloud.aiplatform.v1.IndexEndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.cloud.aiplatform.v1.ReadIndexDatapointsRequest; +import com.google.cloud.aiplatform.v1.ReadIndexDatapointsResponse; +import java.util.ArrayList; + +public class SyncReadIndexDatapoints { + + public static void main(String[] args) throws Exception { + syncReadIndexDatapoints(); + } + + public static void syncReadIndexDatapoints() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ReadIndexDatapointsRequest request = + ReadIndexDatapointsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllIds(new ArrayList()) + .build(); + ReadIndexDatapointsResponse response = matchServiceClient.readIndexDatapoints(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_ReadIndexDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..9deb7ee4ec75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = matchServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..5c99420313eb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = matchServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..238039a64ea2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + matchServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MatchService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..2311f00e1972 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MatchServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = matchServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_MatchService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservicesettings/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservicesettings/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..252edffe6c48 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/matchservicesettings/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MatchServiceSettings_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1.MatchServiceSettings; +import java.time.Duration; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 + MatchServiceSettings.Builder matchServiceSettingsBuilder = MatchServiceSettings.newBuilder(); + matchServiceSettingsBuilder + .findNeighborsSettings() + .setRetrySettings( + matchServiceSettingsBuilder + .findNeighborsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MatchServiceSettings matchServiceSettings = matchServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MatchServiceSettings_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java new file mode 100644 index 000000000000..6150add43a17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsRequest; +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddContextArtifactsAndExecutions { + + public static void main(String[] args) throws Exception { + asyncAddContextArtifactsAndExecutions(); + } + + public static void asyncAddContextArtifactsAndExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextArtifactsAndExecutionsRequest request = + AddContextArtifactsAndExecutionsRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllArtifacts(new ArrayList()) + .addAllExecutions(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addContextArtifactsAndExecutionsCallable().futureCall(request); + // Do something. + AddContextArtifactsAndExecutionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java new file mode 100644 index 000000000000..f774f5a9e9bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsRequest; +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddContextArtifactsAndExecutions { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutions(); + } + + public static void syncAddContextArtifactsAndExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextArtifactsAndExecutionsRequest request = + AddContextArtifactsAndExecutionsRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllArtifacts(new ArrayList()) + .addAllExecutions(new ArrayList()) + .build(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java new file mode 100644 index 000000000000..d36cf7e3c306 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_ContextnameListstringListstring_sync] +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextArtifactsAndExecutionsContextnameListstringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutionsContextnameListstringListstring(); + } + + public static void syncAddContextArtifactsAndExecutionsContextnameListstringListstring() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List artifacts = new ArrayList<>(); + List executions = new ArrayList<>(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(context, artifacts, executions); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_ContextnameListstringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java new file mode 100644 index 000000000000..e816f554fb1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_StringListstringListstring_sync] +import com.google.cloud.aiplatform.v1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextArtifactsAndExecutionsStringListstringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutionsStringListstringListstring(); + } + + public static void syncAddContextArtifactsAndExecutionsStringListstringListstring() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List artifacts = new ArrayList<>(); + List executions = new ArrayList<>(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(context, artifacts, executions); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_StringListstringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/AsyncAddContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/AsyncAddContextChildren.java new file mode 100644 index 000000000000..5492f43657ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/AsyncAddContextChildren.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextChildren_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.AddContextChildrenRequest; +import com.google.cloud.aiplatform.v1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddContextChildren { + + public static void main(String[] args) throws Exception { + asyncAddContextChildren(); + } + + public static void asyncAddContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextChildrenRequest request = + AddContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addContextChildrenCallable().futureCall(request); + // Do something. + AddContextChildrenResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextChildren_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildren.java new file mode 100644 index 000000000000..5fea098bda6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildren.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextChildren_sync] +import com.google.cloud.aiplatform.v1.AddContextChildrenRequest; +import com.google.cloud.aiplatform.v1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddContextChildren { + + public static void main(String[] args) throws Exception { + syncAddContextChildren(); + } + + public static void syncAddContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextChildrenRequest request = + AddContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + AddContextChildrenResponse response = metadataServiceClient.addContextChildren(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextChildren_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java new file mode 100644 index 000000000000..bd97d470c8f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextChildren_ContextnameListstring_sync] +import com.google.cloud.aiplatform.v1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextChildrenContextnameListstring { + + public static void main(String[] args) throws Exception { + syncAddContextChildrenContextnameListstring(); + } + + public static void syncAddContextChildrenContextnameListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List childContexts = new ArrayList<>(); + AddContextChildrenResponse response = + metadataServiceClient.addContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextChildren_ContextnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java new file mode 100644 index 000000000000..be482abb4ed8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddContextChildren_StringListstring_sync] +import com.google.cloud.aiplatform.v1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextChildrenStringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextChildrenStringListstring(); + } + + public static void syncAddContextChildrenStringListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List childContexts = new ArrayList<>(); + AddContextChildrenResponse response = + metadataServiceClient.addContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddContextChildren_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java new file mode 100644 index 000000000000..6cbcec2689c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddExecutionEvents_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.AddExecutionEventsRequest; +import com.google.cloud.aiplatform.v1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1.Event; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddExecutionEvents { + + public static void main(String[] args) throws Exception { + asyncAddExecutionEvents(); + } + + public static void asyncAddExecutionEvents() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddExecutionEventsRequest request = + AddExecutionEventsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .addAllEvents(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addExecutionEventsCallable().futureCall(request); + // Do something. + AddExecutionEventsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddExecutionEvents_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java new file mode 100644 index 000000000000..52424b78615c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddExecutionEvents_sync] +import com.google.cloud.aiplatform.v1.AddExecutionEventsRequest; +import com.google.cloud.aiplatform.v1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1.Event; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddExecutionEvents { + + public static void main(String[] args) throws Exception { + syncAddExecutionEvents(); + } + + public static void syncAddExecutionEvents() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddExecutionEventsRequest request = + AddExecutionEventsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .addAllEvents(new ArrayList()) + .build(); + AddExecutionEventsResponse response = metadataServiceClient.addExecutionEvents(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddExecutionEvents_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java new file mode 100644 index 000000000000..2bf01ea381c9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddExecutionEvents_ExecutionnameListevent_sync] +import com.google.cloud.aiplatform.v1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1.Event; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddExecutionEventsExecutionnameListevent { + + public static void main(String[] args) throws Exception { + syncAddExecutionEventsExecutionnameListevent(); + } + + public static void syncAddExecutionEventsExecutionnameListevent() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + List events = new ArrayList<>(); + AddExecutionEventsResponse response = + metadataServiceClient.addExecutionEvents(execution, events); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddExecutionEvents_ExecutionnameListevent_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java new file mode 100644 index 000000000000..6b0cc3a5f81b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_AddExecutionEvents_StringListevent_sync] +import com.google.cloud.aiplatform.v1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1.Event; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddExecutionEventsStringListevent { + + public static void main(String[] args) throws Exception { + syncAddExecutionEventsStringListevent(); + } + + public static void syncAddExecutionEventsStringListevent() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + List events = new ArrayList<>(); + AddExecutionEventsResponse response = + metadataServiceClient.addExecutionEvents(execution, events); + } + } +} +// [END aiplatform_v1_generated_MetadataService_AddExecutionEvents_StringListevent_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..3ad3e56d926f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MetadataServiceSettings metadataServiceSettings = + MetadataServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MetadataServiceClient metadataServiceClient = + MetadataServiceClient.create(metadataServiceSettings); + } +} +// [END aiplatform_v1_generated_MetadataService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..01006d939ad8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MetadataServiceSettings metadataServiceSettings = + MetadataServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MetadataServiceClient metadataServiceClient = + MetadataServiceClient.create(metadataServiceSettings); + } +} +// [END aiplatform_v1_generated_MetadataService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/AsyncCreateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/AsyncCreateArtifact.java new file mode 100644 index 000000000000..7d2f5cabf847 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/AsyncCreateArtifact.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.CreateArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncCreateArtifact { + + public static void main(String[] args) throws Exception { + asyncCreateArtifact(); + } + + public static void asyncCreateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateArtifactRequest request = + CreateArtifactRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setArtifact(Artifact.newBuilder().build()) + .setArtifactId("artifactId240640653") + .build(); + ApiFuture future = + metadataServiceClient.createArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifact.java new file mode 100644 index 000000000000..04aa37c8941a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifact.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateArtifact_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.CreateArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateArtifact { + + public static void main(String[] args) throws Exception { + syncCreateArtifact(); + } + + public static void syncCreateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateArtifactRequest request = + CreateArtifactRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setArtifact(Artifact.newBuilder().build()) + .setArtifactId("artifactId240640653") + .build(); + Artifact response = metadataServiceClient.createArtifact(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java new file mode 100644 index 000000000000..1fd9ee19f25a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateArtifact_MetadatastorenameArtifactString_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateArtifactMetadatastorenameArtifactString { + + public static void main(String[] args) throws Exception { + syncCreateArtifactMetadatastorenameArtifactString(); + } + + public static void syncCreateArtifactMetadatastorenameArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Artifact artifact = Artifact.newBuilder().build(); + String artifactId = "artifactId240640653"; + Artifact response = metadataServiceClient.createArtifact(parent, artifact, artifactId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateArtifact_MetadatastorenameArtifactString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java new file mode 100644 index 000000000000..48b87f583e24 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateArtifact_StringArtifactString_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateArtifactStringArtifactString { + + public static void main(String[] args) throws Exception { + syncCreateArtifactStringArtifactString(); + } + + public static void syncCreateArtifactStringArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Artifact artifact = Artifact.newBuilder().build(); + String artifactId = "artifactId240640653"; + Artifact response = metadataServiceClient.createArtifact(parent, artifact, artifactId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateArtifact_StringArtifactString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/AsyncCreateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/AsyncCreateContext.java new file mode 100644 index 000000000000..68bb6b6bff3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/AsyncCreateContext.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.CreateContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncCreateContext { + + public static void main(String[] args) throws Exception { + asyncCreateContext(); + } + + public static void asyncCreateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateContextRequest request = + CreateContextRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setContext(Context.newBuilder().build()) + .setContextId("contextId-406810838") + .build(); + ApiFuture future = metadataServiceClient.createContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContext.java new file mode 100644 index 000000000000..71f09f4b5a3b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContext.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateContext_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.CreateContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateContext { + + public static void main(String[] args) throws Exception { + syncCreateContext(); + } + + public static void syncCreateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateContextRequest request = + CreateContextRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setContext(Context.newBuilder().build()) + .setContextId("contextId-406810838") + .build(); + Context response = metadataServiceClient.createContext(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java new file mode 100644 index 000000000000..56fb30619235 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateContext_MetadatastorenameContextString_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateContextMetadatastorenameContextString { + + public static void main(String[] args) throws Exception { + syncCreateContextMetadatastorenameContextString(); + } + + public static void syncCreateContextMetadatastorenameContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Context context = Context.newBuilder().build(); + String contextId = "contextId-406810838"; + Context response = metadataServiceClient.createContext(parent, context, contextId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateContext_MetadatastorenameContextString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextStringContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextStringContextString.java new file mode 100644 index 000000000000..2c4c1482feb9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createcontext/SyncCreateContextStringContextString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateContext_StringContextString_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateContextStringContextString { + + public static void main(String[] args) throws Exception { + syncCreateContextStringContextString(); + } + + public static void syncCreateContextStringContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Context context = Context.newBuilder().build(); + String contextId = "contextId-406810838"; + Context response = metadataServiceClient.createContext(parent, context, contextId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateContext_StringContextString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/AsyncCreateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/AsyncCreateExecution.java new file mode 100644 index 000000000000..8ccc737a4341 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/AsyncCreateExecution.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateExecutionRequest; +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncCreateExecution { + + public static void main(String[] args) throws Exception { + asyncCreateExecution(); + } + + public static void asyncCreateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateExecutionRequest request = + CreateExecutionRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setExecution(Execution.newBuilder().build()) + .setExecutionId("executionId-454906285") + .build(); + ApiFuture future = + metadataServiceClient.createExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecution.java new file mode 100644 index 000000000000..c8a3f67ada1e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecution.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateExecution_sync] +import com.google.cloud.aiplatform.v1.CreateExecutionRequest; +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateExecution { + + public static void main(String[] args) throws Exception { + syncCreateExecution(); + } + + public static void syncCreateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateExecutionRequest request = + CreateExecutionRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setExecution(Execution.newBuilder().build()) + .setExecutionId("executionId-454906285") + .build(); + Execution response = metadataServiceClient.createExecution(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java new file mode 100644 index 000000000000..b390bafadca5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateExecution_MetadatastorenameExecutionString_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateExecutionMetadatastorenameExecutionString { + + public static void main(String[] args) throws Exception { + syncCreateExecutionMetadatastorenameExecutionString(); + } + + public static void syncCreateExecutionMetadatastorenameExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Execution execution = Execution.newBuilder().build(); + String executionId = "executionId-454906285"; + Execution response = metadataServiceClient.createExecution(parent, execution, executionId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateExecution_MetadatastorenameExecutionString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java new file mode 100644 index 000000000000..2bdf0779b847 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateExecution_StringExecutionString_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateExecutionStringExecutionString { + + public static void main(String[] args) throws Exception { + syncCreateExecutionStringExecutionString(); + } + + public static void syncCreateExecutionStringExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Execution execution = Execution.newBuilder().build(); + String executionId = "executionId-454906285"; + Execution response = metadataServiceClient.createExecution(parent, execution, executionId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateExecution_StringExecutionString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java new file mode 100644 index 000000000000..d2d7f720619e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataSchema_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncCreateMetadataSchema { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataSchema(); + } + + public static void asyncCreateMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataSchemaRequest request = + CreateMetadataSchemaRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setMetadataSchema(MetadataSchema.newBuilder().build()) + .setMetadataSchemaId("metadataSchemaId1549245163") + .build(); + ApiFuture future = + metadataServiceClient.createMetadataSchemaCallable().futureCall(request); + // Do something. + MetadataSchema response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataSchema_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java new file mode 100644 index 000000000000..dbce099c97b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataSchema_sync] +import com.google.cloud.aiplatform.v1.CreateMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateMetadataSchema { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchema(); + } + + public static void syncCreateMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataSchemaRequest request = + CreateMetadataSchemaRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setMetadataSchema(MetadataSchema.newBuilder().build()) + .setMetadataSchemaId("metadataSchemaId1549245163") + .build(); + MetadataSchema response = metadataServiceClient.createMetadataSchema(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataSchema_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java new file mode 100644 index 000000000000..ae70bbe2f26b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataSchema_MetadatastorenameMetadataschemaString_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchemaMetadatastorenameMetadataschemaString(); + } + + public static void syncCreateMetadataSchemaMetadatastorenameMetadataschemaString() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + MetadataSchema metadataSchema = MetadataSchema.newBuilder().build(); + String metadataSchemaId = "metadataSchemaId1549245163"; + MetadataSchema response = + metadataServiceClient.createMetadataSchema(parent, metadataSchema, metadataSchemaId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataSchema_MetadatastorenameMetadataschemaString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java new file mode 100644 index 000000000000..c553e781e83a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataSchema_StringMetadataschemaString_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncCreateMetadataSchemaStringMetadataschemaString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchemaStringMetadataschemaString(); + } + + public static void syncCreateMetadataSchemaStringMetadataschemaString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + MetadataSchema metadataSchema = MetadataSchema.newBuilder().build(); + String metadataSchemaId = "metadataSchemaId1549245163"; + MetadataSchema response = + metadataServiceClient.createMetadataSchema(parent, metadataSchema, metadataSchemaId); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataSchema_StringMetadataschemaString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java new file mode 100644 index 000000000000..9a75906102d2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.longrunning.Operation; + +public class AsyncCreateMetadataStore { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataStore(); + } + + public static void asyncCreateMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + ApiFuture future = + metadataServiceClient.createMetadataStoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java new file mode 100644 index 000000000000..450c3c8a8e8a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateMetadataStoreOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class AsyncCreateMetadataStoreLRO { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataStoreLRO(); + } + + public static void asyncCreateMetadataStoreLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + OperationFuture future = + metadataServiceClient.createMetadataStoreOperationCallable().futureCall(request); + // Do something. + MetadataStore response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java new file mode 100644 index 000000000000..66ccb9887730 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_sync] +import com.google.cloud.aiplatform.v1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncCreateMetadataStore { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStore(); + } + + public static void syncCreateMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + MetadataStore response = metadataServiceClient.createMetadataStoreAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java new file mode 100644 index 000000000000..51b2921272d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_LocationnameMetadatastoreString_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncCreateMetadataStoreLocationnameMetadatastoreString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStoreLocationnameMetadatastoreString(); + } + + public static void syncCreateMetadataStoreLocationnameMetadatastoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + MetadataStore metadataStore = MetadataStore.newBuilder().build(); + String metadataStoreId = "metadataStoreId-1811789907"; + MetadataStore response = + metadataServiceClient + .createMetadataStoreAsync(parent, metadataStore, metadataStoreId) + .get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_LocationnameMetadatastoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java new file mode 100644 index 000000000000..90963521ef79 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_StringMetadatastoreString_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncCreateMetadataStoreStringMetadatastoreString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStoreStringMetadatastoreString(); + } + + public static void syncCreateMetadataStoreStringMetadatastoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + MetadataStore metadataStore = MetadataStore.newBuilder().build(); + String metadataStoreId = "metadataStoreId-1811789907"; + MetadataStore response = + metadataServiceClient + .createMetadataStoreAsync(parent, metadataStore, metadataStoreId) + .get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_StringMetadatastoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifact.java new file mode 100644 index 000000000000..ffe181db3446 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifact.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteArtifact { + + public static void main(String[] args) throws Exception { + asyncDeleteArtifact(); + } + + public static void asyncDeleteArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteArtifactCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java new file mode 100644 index 000000000000..ad714c3284bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteArtifactLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteArtifactLRO(); + } + + public static void asyncDeleteArtifactLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteArtifactOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifact.java new file mode 100644 index 000000000000..e81643441e3e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifact.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifact { + + public static void main(String[] args) throws Exception { + syncDeleteArtifact(); + } + + public static void syncDeleteArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteArtifactAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java new file mode 100644 index 000000000000..e5aa02e1b4a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_Artifactname_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifactArtifactname { + + public static void main(String[] args) throws Exception { + syncDeleteArtifactArtifactname(); + } + + public static void syncDeleteArtifactArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + metadataServiceClient.deleteArtifactAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactString.java new file mode 100644 index 000000000000..a1ab997cda00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteartifact/SyncDeleteArtifactString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_String_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifactString { + + public static void main(String[] args) throws Exception { + syncDeleteArtifactString(); + } + + public static void syncDeleteArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + metadataServiceClient.deleteArtifactAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContext.java new file mode 100644 index 000000000000..5b40144782f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContext.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteContext { + + public static void main(String[] args) throws Exception { + asyncDeleteContext(); + } + + public static void asyncDeleteContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteContextCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContextLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContextLRO.java new file mode 100644 index 000000000000..3fcbdb0fdf1e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/AsyncDeleteContextLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteContextLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteContextLRO(); + } + + public static void asyncDeleteContextLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteContextOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteContext_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContext.java new file mode 100644 index 000000000000..acf4ada6d35c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContext.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContext { + + public static void main(String[] args) throws Exception { + syncDeleteContext(); + } + + public static void syncDeleteContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteContextAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextContextname.java new file mode 100644 index 000000000000..1473165eaa21 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextContextname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_Contextname_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContextContextname { + + public static void main(String[] args) throws Exception { + syncDeleteContextContextname(); + } + + public static void syncDeleteContextContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName name = ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + metadataServiceClient.deleteContextAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteContext_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextString.java new file mode 100644 index 000000000000..eb4f21689116 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletecontext/SyncDeleteContextString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_String_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContextString { + + public static void main(String[] args) throws Exception { + syncDeleteContextString(); + } + + public static void syncDeleteContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + metadataServiceClient.deleteContextAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteContext_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecution.java new file mode 100644 index 000000000000..fe8409273707 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecution.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteExecution { + + public static void main(String[] args) throws Exception { + asyncDeleteExecution(); + } + + public static void asyncDeleteExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteExecutionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java new file mode 100644 index 000000000000..b3d68fd3ed54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteExecutionLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteExecutionLRO(); + } + + public static void asyncDeleteExecutionLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteExecutionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecution.java new file mode 100644 index 000000000000..b44e92ad0b7e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecution.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_sync] +import com.google.cloud.aiplatform.v1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecution { + + public static void main(String[] args) throws Exception { + syncDeleteExecution(); + } + + public static void syncDeleteExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteExecutionAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java new file mode 100644 index 000000000000..17b220b7a796 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_Executionname_sync] +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionExecutionname(); + } + + public static void syncDeleteExecutionExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + metadataServiceClient.deleteExecutionAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionString.java new file mode 100644 index 000000000000..eefd12a667b5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deleteexecution/SyncDeleteExecutionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_String_sync] +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecutionString { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionString(); + } + + public static void syncDeleteExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + metadataServiceClient.deleteExecutionAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java new file mode 100644 index 000000000000..8174ddd80d36 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.longrunning.Operation; + +public class AsyncDeleteMetadataStore { + + public static void main(String[] args) throws Exception { + asyncDeleteMetadataStore(); + } + + public static void asyncDeleteMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.deleteMetadataStoreCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java new file mode 100644 index 000000000000..27c2d1c9e3f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteMetadataStoreOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class AsyncDeleteMetadataStoreLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteMetadataStoreLRO(); + } + + public static void asyncDeleteMetadataStoreLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.deleteMetadataStoreOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java new file mode 100644 index 000000000000..d53fe7eaa80b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_sync] +import com.google.cloud.aiplatform.v1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStore { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStore(); + } + + public static void syncDeleteMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + metadataServiceClient.deleteMetadataStoreAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java new file mode 100644 index 000000000000..e067303997b5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStoreMetadatastorename { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStoreMetadatastorename(); + } + + public static void syncDeleteMetadataStoreMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + metadataServiceClient.deleteMetadataStoreAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java new file mode 100644 index 000000000000..8ea1d7846357 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_String_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStoreString { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStoreString(); + } + + public static void syncDeleteMetadataStoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + metadataServiceClient.deleteMetadataStoreAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/AsyncGetArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/AsyncGetArtifact.java new file mode 100644 index 000000000000..f0feaef13674 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/AsyncGetArtifact.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.GetArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class AsyncGetArtifact { + + public static void main(String[] args) throws Exception { + asyncGetArtifact(); + } + + public static void asyncGetArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetArtifactRequest request = + GetArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .build(); + ApiFuture future = metadataServiceClient.getArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifact.java new file mode 100644 index 000000000000..20ef7bad84f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifact.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetArtifact_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.GetArtifactRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetArtifact { + + public static void main(String[] args) throws Exception { + syncGetArtifact(); + } + + public static void syncGetArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetArtifactRequest request = + GetArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .build(); + Artifact response = metadataServiceClient.getArtifact(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactArtifactname.java new file mode 100644 index 000000000000..73b4cd1ef1d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetArtifact_Artifactname_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetArtifactArtifactname { + + public static void main(String[] args) throws Exception { + syncGetArtifactArtifactname(); + } + + public static void syncGetArtifactArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + Artifact response = metadataServiceClient.getArtifact(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetArtifact_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactString.java new file mode 100644 index 000000000000..f832ac62f65b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getartifact/SyncGetArtifactString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetArtifact_String_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetArtifactString { + + public static void main(String[] args) throws Exception { + syncGetArtifactString(); + } + + public static void syncGetArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + Artifact response = metadataServiceClient.getArtifact(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetArtifact_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/AsyncGetContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/AsyncGetContext.java new file mode 100644 index 000000000000..6c4ad754c24b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/AsyncGetContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.GetContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class AsyncGetContext { + + public static void main(String[] args) throws Exception { + asyncGetContext(); + } + + public static void asyncGetContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetContextRequest request = + GetContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + ApiFuture future = metadataServiceClient.getContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContext.java new file mode 100644 index 000000000000..91ab37e74d31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContext.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetContext_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.GetContextRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetContext { + + public static void main(String[] args) throws Exception { + syncGetContext(); + } + + public static void syncGetContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetContextRequest request = + GetContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + Context response = metadataServiceClient.getContext(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextContextname.java new file mode 100644 index 000000000000..bd0055f521c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextContextname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetContext_Contextname_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetContextContextname { + + public static void main(String[] args) throws Exception { + syncGetContextContextname(); + } + + public static void syncGetContextContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName name = ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + Context response = metadataServiceClient.getContext(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetContext_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextString.java new file mode 100644 index 000000000000..3fb06300caac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getcontext/SyncGetContextString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetContext_String_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetContextString { + + public static void main(String[] args) throws Exception { + syncGetContextString(); + } + + public static void syncGetContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + Context response = metadataServiceClient.getContext(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetContext_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/AsyncGetExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/AsyncGetExecution.java new file mode 100644 index 000000000000..f82aacd8fd4a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/AsyncGetExecution.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.GetExecutionRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class AsyncGetExecution { + + public static void main(String[] args) throws Exception { + asyncGetExecution(); + } + + public static void asyncGetExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.getExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecution.java new file mode 100644 index 000000000000..9823af69e40a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecution.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetExecution_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.GetExecutionRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetExecution { + + public static void main(String[] args) throws Exception { + syncGetExecution(); + } + + public static void syncGetExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + Execution response = metadataServiceClient.getExecution(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionExecutionname.java new file mode 100644 index 000000000000..4db475a697b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetExecution_Executionname_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncGetExecutionExecutionname(); + } + + public static void syncGetExecutionExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + Execution response = metadataServiceClient.getExecution(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetExecution_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionString.java new file mode 100644 index 000000000000..a881a8a67caa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getexecution/SyncGetExecutionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetExecution_String_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetExecutionString { + + public static void main(String[] args) throws Exception { + syncGetExecutionString(); + } + + public static void syncGetExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + Execution response = metadataServiceClient.getExecution(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetExecution_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..9697da1b1177 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = metadataServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..bbcd7009ffcb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = metadataServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..84ba6441df5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = metadataServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..f722fbc6f636 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = metadataServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java new file mode 100644 index 000000000000..cd5512714b7f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataSchema_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class AsyncGetMetadataSchema { + + public static void main(String[] args) throws Exception { + asyncGetMetadataSchema(); + } + + public static void asyncGetMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataSchemaRequest request = + GetMetadataSchemaRequest.newBuilder() + .setName( + MetadataSchemaName.of( + "[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.getMetadataSchemaCallable().futureCall(request); + // Do something. + MetadataSchema response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataSchema_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java new file mode 100644 index 000000000000..b35f381a7e92 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataSchema_sync] +import com.google.cloud.aiplatform.v1.GetMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetMetadataSchema { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchema(); + } + + public static void syncGetMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataSchemaRequest request = + GetMetadataSchemaRequest.newBuilder() + .setName( + MetadataSchemaName.of( + "[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString()) + .build(); + MetadataSchema response = metadataServiceClient.getMetadataSchema(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataSchema_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java new file mode 100644 index 000000000000..9880fdfd4c19 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataSchema_Metadataschemaname_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetMetadataSchemaMetadataschemaname { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchemaMetadataschemaname(); + } + + public static void syncGetMetadataSchemaMetadataschemaname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataSchemaName name = + MetadataSchemaName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]"); + MetadataSchema response = metadataServiceClient.getMetadataSchema(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataSchema_Metadataschemaname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java new file mode 100644 index 000000000000..a2709dd0d737 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataSchema_String_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncGetMetadataSchemaString { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchemaString(); + } + + public static void syncGetMetadataSchemaString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + MetadataSchemaName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString(); + MetadataSchema response = metadataServiceClient.getMetadataSchema(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataSchema_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java new file mode 100644 index 000000000000..5bdf05087f08 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + asyncGetMetadataStore(); + } + + public static void asyncGetMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataStoreRequest request = + GetMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .build(); + ApiFuture future = + metadataServiceClient.getMetadataStoreCallable().futureCall(request); + // Do something. + MetadataStore response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..d441849702d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1.GetMetadataStoreRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataStoreRequest request = + GetMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .build(); + MetadataStore response = metadataServiceClient.getMetadataStore(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java new file mode 100644 index 000000000000..0af4669cadde --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataStore_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncGetMetadataStoreMetadatastorename { + + public static void main(String[] args) throws Exception { + syncGetMetadataStoreMetadatastorename(); + } + + public static void syncGetMetadataStoreMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + MetadataStore response = metadataServiceClient.getMetadataStore(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataStore_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java new file mode 100644 index 000000000000..3af62f1086ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_GetMetadataStore_String_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncGetMetadataStoreString { + + public static void main(String[] args) throws Exception { + syncGetMetadataStoreString(); + } + + public static void syncGetMetadataStoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + MetadataStore response = metadataServiceClient.getMetadataStore(name); + } + } +} +// [END aiplatform_v1_generated_MetadataService_GetMetadataStore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifacts.java new file mode 100644 index 000000000000..faf942d05ed8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifacts.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncListArtifacts { + + public static void main(String[] args) throws Exception { + asyncListArtifacts(); + } + + public static void asyncListArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listArtifactsPagedCallable().futureCall(request); + // Do something. + for (Artifact element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifactsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifactsPaged.java new file mode 100644 index 000000000000..654d07014f94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/AsyncListArtifactsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_Paged_async] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1.ListArtifactsResponse; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListArtifactsPaged { + + public static void main(String[] args) throws Exception { + asyncListArtifactsPaged(); + } + + public static void asyncListArtifactsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListArtifactsResponse response = + metadataServiceClient.listArtifactsCallable().call(request); + for (Artifact element : response.getArtifactsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifacts.java new file mode 100644 index 000000000000..a94252a461c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifacts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListArtifacts { + + public static void main(String[] args) throws Exception { + syncListArtifacts(); + } + + public static void syncListArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Artifact element : metadataServiceClient.listArtifacts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java new file mode 100644 index 000000000000..f787674fd810 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListArtifactsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListArtifactsMetadatastorename(); + } + + public static void syncListArtifactsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Artifact element : metadataServiceClient.listArtifacts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsString.java new file mode 100644 index 000000000000..610ed5ec0ebc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listartifacts/SyncListArtifactsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_String_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListArtifactsString { + + public static void main(String[] args) throws Exception { + syncListArtifactsString(); + } + + public static void syncListArtifactsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Artifact element : metadataServiceClient.listArtifacts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContexts.java new file mode 100644 index 000000000000..1c8227194513 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContexts.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListContexts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ListContextsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncListContexts { + + public static void main(String[] args) throws Exception { + asyncListContexts(); + } + + public static void asyncListContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listContextsPagedCallable().futureCall(request); + // Do something. + for (Context element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListContexts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContextsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContextsPaged.java new file mode 100644 index 000000000000..c70fd2e77db1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/AsyncListContextsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListContexts_Paged_async] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ListContextsRequest; +import com.google.cloud.aiplatform.v1.ListContextsResponse; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListContextsPaged { + + public static void main(String[] args) throws Exception { + asyncListContextsPaged(); + } + + public static void asyncListContextsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListContextsResponse response = metadataServiceClient.listContextsCallable().call(request); + for (Context element : response.getContextsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListContexts_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContexts.java new file mode 100644 index 000000000000..0d6fa5881b6d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContexts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListContexts_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.ListContextsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListContexts { + + public static void main(String[] args) throws Exception { + syncListContexts(); + } + + public static void syncListContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Context element : metadataServiceClient.listContexts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListContexts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java new file mode 100644 index 000000000000..ec31648bee4a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListContexts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListContextsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListContextsMetadatastorename(); + } + + public static void syncListContextsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Context element : metadataServiceClient.listContexts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListContexts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsString.java new file mode 100644 index 000000000000..95face3e4afa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listcontexts/SyncListContextsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListContexts_String_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListContextsString { + + public static void main(String[] args) throws Exception { + syncListContextsString(); + } + + public static void syncListContextsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Context element : metadataServiceClient.listContexts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListContexts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutions.java new file mode 100644 index 000000000000..854ba2ba66c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutions.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncListExecutions { + + public static void main(String[] args) throws Exception { + asyncListExecutions(); + } + + public static void asyncListExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listExecutionsPagedCallable().futureCall(request); + // Do something. + for (Execution element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutionsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutionsPaged.java new file mode 100644 index 000000000000..1aafd7d1e455 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/AsyncListExecutionsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_Paged_async] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1.ListExecutionsResponse; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListExecutionsPaged { + + public static void main(String[] args) throws Exception { + asyncListExecutionsPaged(); + } + + public static void asyncListExecutionsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListExecutionsResponse response = + metadataServiceClient.listExecutionsCallable().call(request); + for (Execution element : response.getExecutionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListExecutions_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutions.java new file mode 100644 index 000000000000..8105eebab438 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListExecutions { + + public static void main(String[] args) throws Exception { + syncListExecutions(); + } + + public static void syncListExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Execution element : metadataServiceClient.listExecutions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java new file mode 100644 index 000000000000..461fb702b29e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListExecutionsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListExecutionsMetadatastorename(); + } + + public static void syncListExecutionsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Execution element : metadataServiceClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListExecutions_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsString.java new file mode 100644 index 000000000000..c7ee31b6e4fc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listexecutions/SyncListExecutionsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_String_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListExecutionsString { + + public static void main(String[] args) throws Exception { + syncListExecutionsString(); + } + + public static void syncListExecutionsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Execution element : metadataServiceClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListExecutions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..67723814e68a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + metadataServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..879b1718085a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + metadataServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..73ed224404f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : metadataServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java new file mode 100644 index 000000000000..0eb4dc318521 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class AsyncListMetadataSchemas { + + public static void main(String[] args) throws Exception { + asyncListMetadataSchemas(); + } + + public static void asyncListMetadataSchemas() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + metadataServiceClient.listMetadataSchemasPagedCallable().futureCall(request); + // Do something. + for (MetadataSchema element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java new file mode 100644 index 000000000000..b5b773a95f14 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_Paged_async] +import com.google.cloud.aiplatform.v1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1.ListMetadataSchemasResponse; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListMetadataSchemasPaged { + + public static void main(String[] args) throws Exception { + asyncListMetadataSchemasPaged(); + } + + public static void asyncListMetadataSchemasPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListMetadataSchemasResponse response = + metadataServiceClient.listMetadataSchemasCallable().call(request); + for (MetadataSchema element : response.getMetadataSchemasList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java new file mode 100644 index 000000000000..85eaff86ca4f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_sync] +import com.google.cloud.aiplatform.v1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListMetadataSchemas { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemas(); + } + + public static void syncListMetadataSchemas() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java new file mode 100644 index 000000000000..fcdfb61efc5e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListMetadataSchemasMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemasMetadatastorename(); + } + + public static void syncListMetadataSchemasMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java new file mode 100644 index 000000000000..c70b9459ce13 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_String_sync] +import com.google.cloud.aiplatform.v1.MetadataSchema; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; + +public class SyncListMetadataSchemasString { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemasString(); + } + + public static void syncListMetadataSchemasString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStores.java new file mode 100644 index 000000000000..affd1ef357c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStores.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class AsyncListMetadataStores { + + public static void main(String[] args) throws Exception { + asyncListMetadataStores(); + } + + public static void asyncListMetadataStores() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + metadataServiceClient.listMetadataStoresPagedCallable().futureCall(request); + // Do something. + for (MetadataStore element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java new file mode 100644 index 000000000000..c77d8dc95eee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_Paged_async] +import com.google.cloud.aiplatform.v1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1.ListMetadataStoresResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; +import com.google.common.base.Strings; + +public class AsyncListMetadataStoresPaged { + + public static void main(String[] args) throws Exception { + asyncListMetadataStoresPaged(); + } + + public static void asyncListMetadataStoresPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListMetadataStoresResponse response = + metadataServiceClient.listMetadataStoresCallable().call(request); + for (MetadataStore element : response.getMetadataStoresList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStores.java new file mode 100644 index 000000000000..0f7ec05a439e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStores.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_sync] +import com.google.cloud.aiplatform.v1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncListMetadataStores { + + public static void main(String[] args) throws Exception { + syncListMetadataStores(); + } + + public static void syncListMetadataStores() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (MetadataStore element : metadataServiceClient.listMetadataStores(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java new file mode 100644 index 000000000000..d64ee81ce2b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncListMetadataStoresLocationname { + + public static void main(String[] args) throws Exception { + syncListMetadataStoresLocationname(); + } + + public static void syncListMetadataStoresLocationname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (MetadataStore element : metadataServiceClient.listMetadataStores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java new file mode 100644 index 000000000000..166b45ad0b41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStore; + +public class SyncListMetadataStoresString { + + public static void main(String[] args) throws Exception { + syncListMetadataStoresString(); + } + + public static void syncListMetadataStoresString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (MetadataStore element : metadataServiceClient.listMetadataStores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java new file mode 100644 index 000000000000..ac13d1d9988f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeArtifactsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeArtifacts { + + public static void main(String[] args) throws Exception { + asyncPurgeArtifacts(); + } + + public static void asyncPurgeArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeArtifactsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java new file mode 100644 index 000000000000..1bce365f0b4f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeArtifactsMetadata; +import com.google.cloud.aiplatform.v1.PurgeArtifactsRequest; +import com.google.cloud.aiplatform.v1.PurgeArtifactsResponse; + +public class AsyncPurgeArtifactsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeArtifactsLRO(); + } + + public static void asyncPurgeArtifactsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeArtifactsOperationCallable().futureCall(request); + // Do something. + PurgeArtifactsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java new file mode 100644 index 000000000000..f44b075e62f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeArtifactsRequest; +import com.google.cloud.aiplatform.v1.PurgeArtifactsResponse; + +public class SyncPurgeArtifacts { + + public static void main(String[] args) throws Exception { + syncPurgeArtifacts(); + } + + public static void syncPurgeArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java new file mode 100644 index 000000000000..a302de95ad34 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeArtifactsResponse; + +public class SyncPurgeArtifactsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeArtifactsMetadatastorename(); + } + + public static void syncPurgeArtifactsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java new file mode 100644 index 000000000000..950b5a86738c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_String_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeArtifactsResponse; + +public class SyncPurgeArtifactsString { + + public static void main(String[] args) throws Exception { + syncPurgeArtifactsString(); + } + + public static void syncPurgeArtifactsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContexts.java new file mode 100644 index 000000000000..5e24e56e7110 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContexts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeContextsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeContexts { + + public static void main(String[] args) throws Exception { + asyncPurgeContexts(); + } + + public static void asyncPurgeContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeContextsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java new file mode 100644 index 000000000000..628e3cd133eb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeContextsMetadata; +import com.google.cloud.aiplatform.v1.PurgeContextsRequest; +import com.google.cloud.aiplatform.v1.PurgeContextsResponse; + +public class AsyncPurgeContextsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeContextsLRO(); + } + + public static void asyncPurgeContextsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeContextsOperationCallable().futureCall(request); + // Do something. + PurgeContextsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContexts.java new file mode 100644 index 000000000000..7368fe252664 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContexts.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeContextsRequest; +import com.google.cloud.aiplatform.v1.PurgeContextsResponse; + +public class SyncPurgeContexts { + + public static void main(String[] args) throws Exception { + syncPurgeContexts(); + } + + public static void syncPurgeContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java new file mode 100644 index 000000000000..59b83e55ac23 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeContextsResponse; + +public class SyncPurgeContextsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeContextsMetadatastorename(); + } + + public static void syncPurgeContextsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsString.java new file mode 100644 index 000000000000..cc1ac9279b9a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgecontexts/SyncPurgeContextsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_String_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeContextsResponse; + +public class SyncPurgeContextsString { + + public static void main(String[] args) throws Exception { + syncPurgeContextsString(); + } + + public static void syncPurgeContextsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java new file mode 100644 index 000000000000..a5779636e5d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeExecutionsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeExecutions { + + public static void main(String[] args) throws Exception { + asyncPurgeExecutions(); + } + + public static void asyncPurgeExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeExecutionsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java new file mode 100644 index 000000000000..3072000f5384 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeExecutionsMetadata; +import com.google.cloud.aiplatform.v1.PurgeExecutionsRequest; +import com.google.cloud.aiplatform.v1.PurgeExecutionsResponse; + +public class AsyncPurgeExecutionsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeExecutionsLRO(); + } + + public static void asyncPurgeExecutionsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeExecutionsOperationCallable().futureCall(request); + // Do something. + PurgeExecutionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutions.java new file mode 100644 index 000000000000..60e49200c018 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutions.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeExecutionsRequest; +import com.google.cloud.aiplatform.v1.PurgeExecutionsResponse; + +public class SyncPurgeExecutions { + + public static void main(String[] args) throws Exception { + syncPurgeExecutions(); + } + + public static void syncPurgeExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java new file mode 100644 index 000000000000..ff7d315e677e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeExecutionsResponse; + +public class SyncPurgeExecutionsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeExecutionsMetadatastorename(); + } + + public static void syncPurgeExecutionsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java new file mode 100644 index 000000000000..3d41a37a72d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_String_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataStoreName; +import com.google.cloud.aiplatform.v1.PurgeExecutionsResponse; + +public class SyncPurgeExecutionsString { + + public static void main(String[] args) throws Exception { + syncPurgeExecutionsString(); + } + + public static void syncPurgeExecutionsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(parent).get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java new file mode 100644 index 000000000000..1ea34948f749 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryArtifactLineageSubgraphRequest; + +public class AsyncQueryArtifactLineageSubgraph { + + public static void main(String[] args) throws Exception { + asyncQueryArtifactLineageSubgraph(); + } + + public static void asyncQueryArtifactLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryArtifactLineageSubgraphRequest request = + QueryArtifactLineageSubgraphRequest.newBuilder() + .setArtifact( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setMaxHops(407750469) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + metadataServiceClient.queryArtifactLineageSubgraphCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java new file mode 100644 index 000000000000..6259e4638810 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryArtifactLineageSubgraphRequest; + +public class SyncQueryArtifactLineageSubgraph { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraph(); + } + + public static void syncQueryArtifactLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryArtifactLineageSubgraphRequest request = + QueryArtifactLineageSubgraphRequest.newBuilder() + .setArtifact( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setMaxHops(407750469) + .setFilter("filter-1274492040") + .build(); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java new file mode 100644 index 000000000000..1556d63e93ca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_Artifactname_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryArtifactLineageSubgraphArtifactname { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraphArtifactname(); + } + + public static void syncQueryArtifactLineageSubgraphArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName artifact = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(artifact); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java new file mode 100644 index 000000000000..e6579ebaa82d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_String_sync] +import com.google.cloud.aiplatform.v1.ArtifactName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryArtifactLineageSubgraphString { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraphString(); + } + + public static void syncQueryArtifactLineageSubgraphString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String artifact = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(artifact); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java new file mode 100644 index 000000000000..687843e3ab80 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryContextLineageSubgraphRequest; + +public class AsyncQueryContextLineageSubgraph { + + public static void main(String[] args) throws Exception { + asyncQueryContextLineageSubgraph(); + } + + public static void asyncQueryContextLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryContextLineageSubgraphRequest request = + QueryContextLineageSubgraphRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.queryContextLineageSubgraphCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java new file mode 100644 index 000000000000..ab8ecba7d977 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryContextLineageSubgraphRequest; + +public class SyncQueryContextLineageSubgraph { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraph(); + } + + public static void syncQueryContextLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryContextLineageSubgraphRequest request = + QueryContextLineageSubgraphRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java new file mode 100644 index 000000000000..0aa1262aa001 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_Contextname_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryContextLineageSubgraphContextname { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraphContextname(); + } + + public static void syncQueryContextLineageSubgraphContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(context); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java new file mode 100644 index 000000000000..c2208f5925a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_String_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryContextLineageSubgraphString { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraphString(); + } + + public static void syncQueryContextLineageSubgraphString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(context); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java new file mode 100644 index 000000000000..1deb95dea5f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryExecutionInputsAndOutputsRequest; + +public class AsyncQueryExecutionInputsAndOutputs { + + public static void main(String[] args) throws Exception { + asyncQueryExecutionInputsAndOutputs(); + } + + public static void asyncQueryExecutionInputsAndOutputs() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryExecutionInputsAndOutputsRequest request = + QueryExecutionInputsAndOutputsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.queryExecutionInputsAndOutputsCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java new file mode 100644 index 000000000000..3ad46c75d397 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.QueryExecutionInputsAndOutputsRequest; + +public class SyncQueryExecutionInputsAndOutputs { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputs(); + } + + public static void syncQueryExecutionInputsAndOutputs() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryExecutionInputsAndOutputsRequest request = + QueryExecutionInputsAndOutputsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java new file mode 100644 index 000000000000..3fb62fde4537 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_Executionname_sync] +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryExecutionInputsAndOutputsExecutionname { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputsExecutionname(); + } + + public static void syncQueryExecutionInputsAndOutputsExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(execution); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java new file mode 100644 index 000000000000..3fe42e3a76e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_String_sync] +import com.google.cloud.aiplatform.v1.ExecutionName; +import com.google.cloud.aiplatform.v1.LineageSubgraph; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; + +public class SyncQueryExecutionInputsAndOutputsString { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputsString(); + } + + public static void syncQueryExecutionInputsAndOutputsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(execution); + } + } +} +// [END aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java new file mode 100644 index 000000000000..f30e1a3b4655 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_RemoveContextChildren_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenRequest; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenResponse; +import java.util.ArrayList; + +public class AsyncRemoveContextChildren { + + public static void main(String[] args) throws Exception { + asyncRemoveContextChildren(); + } + + public static void asyncRemoveContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + RemoveContextChildrenRequest request = + RemoveContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.removeContextChildrenCallable().futureCall(request); + // Do something. + RemoveContextChildrenResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_RemoveContextChildren_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java new file mode 100644 index 000000000000..93283a19fdda --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_RemoveContextChildren_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenRequest; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenResponse; +import java.util.ArrayList; + +public class SyncRemoveContextChildren { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildren(); + } + + public static void syncRemoveContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + RemoveContextChildrenRequest request = + RemoveContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + RemoveContextChildrenResponse response = metadataServiceClient.removeContextChildren(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_RemoveContextChildren_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java new file mode 100644 index 000000000000..33e22130a4ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_RemoveContextChildren_ContextnameListstring_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncRemoveContextChildrenContextnameListstring { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildrenContextnameListstring(); + } + + public static void syncRemoveContextChildrenContextnameListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List childContexts = new ArrayList<>(); + RemoveContextChildrenResponse response = + metadataServiceClient.removeContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1_generated_MetadataService_RemoveContextChildren_ContextnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java new file mode 100644 index 000000000000..b9570c57a51a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_RemoveContextChildren_StringListstring_sync] +import com.google.cloud.aiplatform.v1.ContextName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.RemoveContextChildrenResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncRemoveContextChildrenStringListstring { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildrenStringListstring(); + } + + public static void syncRemoveContextChildrenStringListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List childContexts = new ArrayList<>(); + RemoveContextChildrenResponse response = + metadataServiceClient.removeContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1_generated_MetadataService_RemoveContextChildren_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..08982205b57e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = metadataServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..4f4f460d9e44 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = metadataServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..d00714521b20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..36c477d8c9f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = metadataServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/AsyncUpdateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/AsyncUpdateArtifact.java new file mode 100644 index 000000000000..f2252bf61dae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/AsyncUpdateArtifact.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateArtifactRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateArtifact { + + public static void main(String[] args) throws Exception { + asyncUpdateArtifact(); + } + + public static void asyncUpdateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateArtifactRequest request = + UpdateArtifactRequest.newBuilder() + .setArtifact(Artifact.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = + metadataServiceClient.updateArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifact.java new file mode 100644 index 000000000000..dc3ac8d0b4ba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifact.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateArtifact_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateArtifactRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateArtifact { + + public static void main(String[] args) throws Exception { + syncUpdateArtifact(); + } + + public static void syncUpdateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateArtifactRequest request = + UpdateArtifactRequest.newBuilder() + .setArtifact(Artifact.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Artifact response = metadataServiceClient.updateArtifact(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java new file mode 100644 index 000000000000..75e7f6e8ca61 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateArtifact_ArtifactFieldmask_sync] +import com.google.cloud.aiplatform.v1.Artifact; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateArtifactArtifactFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateArtifactArtifactFieldmask(); + } + + public static void syncUpdateArtifactArtifactFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Artifact artifact = Artifact.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Artifact response = metadataServiceClient.updateArtifact(artifact, updateMask); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateArtifact_ArtifactFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/AsyncUpdateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/AsyncUpdateContext.java new file mode 100644 index 000000000000..4359ad8c1118 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/AsyncUpdateContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateContextRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateContext { + + public static void main(String[] args) throws Exception { + asyncUpdateContext(); + } + + public static void asyncUpdateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateContextRequest request = + UpdateContextRequest.newBuilder() + .setContext(Context.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = metadataServiceClient.updateContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContext.java new file mode 100644 index 000000000000..db56be1ebe3f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContext.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateContext_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateContextRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateContext { + + public static void main(String[] args) throws Exception { + syncUpdateContext(); + } + + public static void syncUpdateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateContextRequest request = + UpdateContextRequest.newBuilder() + .setContext(Context.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Context response = metadataServiceClient.updateContext(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java new file mode 100644 index 000000000000..3a081ea50b79 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateContext_ContextFieldmask_sync] +import com.google.cloud.aiplatform.v1.Context; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateContextContextFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateContextContextFieldmask(); + } + + public static void syncUpdateContextContextFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Context context = Context.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Context response = metadataServiceClient.updateContext(context, updateMask); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateContext_ContextFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/AsyncUpdateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/AsyncUpdateExecution.java new file mode 100644 index 000000000000..7f4099cd2d71 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/AsyncUpdateExecution.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExecutionRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateExecution { + + public static void main(String[] args) throws Exception { + asyncUpdateExecution(); + } + + public static void asyncUpdateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateExecutionRequest request = + UpdateExecutionRequest.newBuilder() + .setExecution(Execution.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = + metadataServiceClient.updateExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecution.java new file mode 100644 index 000000000000..99ef039525fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecution.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateExecution_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExecutionRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateExecution { + + public static void main(String[] args) throws Exception { + syncUpdateExecution(); + } + + public static void syncUpdateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateExecutionRequest request = + UpdateExecutionRequest.newBuilder() + .setExecution(Execution.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Execution response = metadataServiceClient.updateExecution(request); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java new file mode 100644 index 000000000000..fd3c1ec098a5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataService_UpdateExecution_ExecutionFieldmask_sync] +import com.google.cloud.aiplatform.v1.Execution; +import com.google.cloud.aiplatform.v1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateExecutionExecutionFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateExecutionExecutionFieldmask(); + } + + public static void syncUpdateExecutionExecutionFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Execution execution = Execution.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Execution response = metadataServiceClient.updateExecution(execution, updateMask); + } + } +} +// [END aiplatform_v1_generated_MetadataService_UpdateExecution_ExecutionFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..68c5732a119a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MetadataServiceSettings_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1.MetadataServiceSettings; +import java.time.Duration; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 + MetadataServiceSettings.Builder metadataServiceSettingsBuilder = + MetadataServiceSettings.newBuilder(); + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings( + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MetadataServiceSettings metadataServiceSettings = metadataServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MetadataServiceSettings_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java new file mode 100644 index 000000000000..cf509a8a8649 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_BatchMigrateResources_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchMigrateResources { + + public static void main(String[] args) throws Exception { + asyncBatchMigrateResources(); + } + + public static void asyncBatchMigrateResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + ApiFuture future = + migrationServiceClient.batchMigrateResourcesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_BatchMigrateResources_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java new file mode 100644 index 000000000000..1c4f1df1b373 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_BatchMigrateResources_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesOperationMetadata; +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import java.util.ArrayList; + +public class AsyncBatchMigrateResourcesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchMigrateResourcesLRO(); + } + + public static void asyncBatchMigrateResourcesLRO() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + OperationFuture + future = + migrationServiceClient.batchMigrateResourcesOperationCallable().futureCall(request); + // Do something. + BatchMigrateResourcesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_BatchMigrateResources_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java new file mode 100644 index 000000000000..5637290cae1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_BatchMigrateResources_sync] +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import java.util.ArrayList; + +public class SyncBatchMigrateResources { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResources(); + } + + public static void syncBatchMigrateResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_BatchMigrateResources_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java new file mode 100644 index 000000000000..eb3e8ad90adb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_BatchMigrateResources_LocationnameListmigrateresourcerequest_sync] +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResourcesLocationnameListmigrateresourcerequest(); + } + + public static void syncBatchMigrateResourcesLocationnameListmigrateresourcerequest() + throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + List migrateResourceRequests = new ArrayList<>(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_BatchMigrateResources_LocationnameListmigrateresourcerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java new file mode 100644 index 000000000000..2d3b9d5fa954 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_BatchMigrateResources_StringListmigrateresourcerequest_sync] +import com.google.cloud.aiplatform.v1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchMigrateResourcesStringListmigrateresourcerequest { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResourcesStringListmigrateresourcerequest(); + } + + public static void syncBatchMigrateResourcesStringListmigrateresourcerequest() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + List migrateResourceRequests = new ArrayList<>(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_BatchMigrateResources_StringListmigrateresourcerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..eacc5b004d75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.MigrationServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MigrationServiceSettings migrationServiceSettings = + MigrationServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MigrationServiceClient migrationServiceClient = + MigrationServiceClient.create(migrationServiceSettings); + } +} +// [END aiplatform_v1_generated_MigrationService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..b16969433559 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.MigrationServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MigrationServiceSettings migrationServiceSettings = + MigrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MigrationServiceClient migrationServiceClient = + MigrationServiceClient.create(migrationServiceSettings); + } +} +// [END aiplatform_v1_generated_MigrationService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..443f35e6d540 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = migrationServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..90d2a1cdfc78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = migrationServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MigrationService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..dd88ed5c7df9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = migrationServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..8ac23bbaa356 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = migrationServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_MigrationService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..05de2d14b58c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + migrationServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..383c2235a787 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + migrationServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..7239cd0a8f60 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : migrationServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java new file mode 100644 index 000000000000..d3067c1bf986 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SearchMigratableResources_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigratableResource; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.SearchMigratableResourcesRequest; + +public class AsyncSearchMigratableResources { + + public static void main(String[] args) throws Exception { + asyncSearchMigratableResources(); + } + + public static void asyncSearchMigratableResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + migrationServiceClient.searchMigratableResourcesPagedCallable().futureCall(request); + // Do something. + for (MigratableResource element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_SearchMigratableResources_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java new file mode 100644 index 000000000000..753993252a71 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SearchMigratableResources_Paged_async] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigratableResource; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.SearchMigratableResourcesRequest; +import com.google.cloud.aiplatform.v1.SearchMigratableResourcesResponse; +import com.google.common.base.Strings; + +public class AsyncSearchMigratableResourcesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchMigratableResourcesPaged(); + } + + public static void asyncSearchMigratableResourcesPaged() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + SearchMigratableResourcesResponse response = + migrationServiceClient.searchMigratableResourcesCallable().call(request); + for (MigratableResource element : response.getMigratableResourcesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_SearchMigratableResources_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java new file mode 100644 index 000000000000..27c1fcd4e525 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SearchMigratableResources_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigratableResource; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.SearchMigratableResourcesRequest; + +public class SyncSearchMigratableResources { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResources(); + } + + public static void syncSearchMigratableResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_SearchMigratableResources_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java new file mode 100644 index 000000000000..7d2a4924f7e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SearchMigratableResources_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigratableResource; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; + +public class SyncSearchMigratableResourcesLocationname { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResourcesLocationname(); + } + + public static void syncSearchMigratableResourcesLocationname() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_SearchMigratableResources_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java new file mode 100644 index 000000000000..c274bf190a9c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SearchMigratableResources_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.MigratableResource; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; + +public class SyncSearchMigratableResourcesString { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResourcesString(); + } + + public static void syncSearchMigratableResourcesString() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_MigrationService_SearchMigratableResources_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..3ca45d006efc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = migrationServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..bd34412918a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = migrationServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_MigrationService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..c6b9ca45105b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + migrationServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_MigrationService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..a1830e2cf932 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.MigrationServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = migrationServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_MigrationService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservicesettings/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservicesettings/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..348e3d373f28 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/migrationservicesettings/getlocation/SyncGetLocation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_MigrationServiceSettings_GetLocation_sync] +import com.google.cloud.aiplatform.v1.MigrationServiceSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 + MigrationServiceSettings.Builder migrationServiceSettingsBuilder = + MigrationServiceSettings.newBuilder(); + migrationServiceSettingsBuilder + .getLocationSettings() + .setRetrySettings( + migrationServiceSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MigrationServiceSettings migrationServiceSettings = migrationServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MigrationServiceSettings_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..7e51fabfcf50 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.ModelGardenServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ModelGardenServiceSettings modelGardenServiceSettings = + ModelGardenServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ModelGardenServiceClient modelGardenServiceClient = + ModelGardenServiceClient.create(modelGardenServiceSettings); + } +} +// [END aiplatform_v1_generated_ModelGardenService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..3fa5fb29fed3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.ModelGardenServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ModelGardenServiceSettings modelGardenServiceSettings = + ModelGardenServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ModelGardenServiceClient modelGardenServiceClient = + ModelGardenServiceClient.create(modelGardenServiceSettings); + } +} +// [END aiplatform_v1_generated_ModelGardenService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..02dea5aad781 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + modelGardenServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..2b23124e742c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = modelGardenServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..f87f94f3d351 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + modelGardenServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..18ebbc06cfbe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = modelGardenServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java new file mode 100644 index 000000000000..7073d6db4329 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetPublisherModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetPublisherModelRequest; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.PublisherModel; +import com.google.cloud.aiplatform.v1.PublisherModelName; +import com.google.cloud.aiplatform.v1.PublisherModelView; + +public class AsyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + asyncGetPublisherModel(); + } + + public static void asyncGetPublisherModel() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetPublisherModelRequest request = + GetPublisherModelRequest.newBuilder() + .setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString()) + .setLanguageCode("languageCode-2092349083") + .setView(PublisherModelView.forNumber(0)) + .build(); + ApiFuture future = + modelGardenServiceClient.getPublisherModelCallable().futureCall(request); + // Do something. + PublisherModel response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetPublisherModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..5bada1767ef1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1.GetPublisherModelRequest; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.PublisherModel; +import com.google.cloud.aiplatform.v1.PublisherModelName; +import com.google.cloud.aiplatform.v1.PublisherModelView; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetPublisherModelRequest request = + GetPublisherModelRequest.newBuilder() + .setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString()) + .setLanguageCode("languageCode-2092349083") + .setView(PublisherModelView.forNumber(0)) + .build(); + PublisherModel response = modelGardenServiceClient.getPublisherModel(request); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java new file mode 100644 index 000000000000..6182ed93a2c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetPublisherModel_Publishermodelname_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.PublisherModel; +import com.google.cloud.aiplatform.v1.PublisherModelName; + +public class SyncGetPublisherModelPublishermodelname { + + public static void main(String[] args) throws Exception { + syncGetPublisherModelPublishermodelname(); + } + + public static void syncGetPublisherModelPublishermodelname() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]"); + PublisherModel response = modelGardenServiceClient.getPublisherModel(name); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetPublisherModel_Publishermodelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java new file mode 100644 index 000000000000..61604f0533bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_GetPublisherModel_String_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1.PublisherModel; +import com.google.cloud.aiplatform.v1.PublisherModelName; + +public class SyncGetPublisherModelString { + + public static void main(String[] args) throws Exception { + syncGetPublisherModelString(); + } + + public static void syncGetPublisherModelString() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + String name = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString(); + PublisherModel response = modelGardenServiceClient.getPublisherModel(name); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_GetPublisherModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..5646300bd2a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + modelGardenServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..f5cc3812e32a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + modelGardenServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..46c7bc2417a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : modelGardenServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..6d421c2517fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelGardenServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..a1cb7fd47f5a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = modelGardenServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..a1b764b740fa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + modelGardenServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..6fb230e14aa6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelGardenServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = modelGardenServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_ModelGardenService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..7ad075309ece --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelGardenServiceSettings_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1.ModelGardenServiceSettings; +import java.time.Duration; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 + ModelGardenServiceSettings.Builder modelGardenServiceSettingsBuilder = + ModelGardenServiceSettings.newBuilder(); + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .setRetrySettings( + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelGardenServiceSettings modelGardenServiceSettings = + modelGardenServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ModelGardenServiceSettings_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java new file mode 100644 index 000000000000..26fb1ee8209a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsRequest; +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncBatchImportEvaluatedAnnotations { + + public static void main(String[] args) throws Exception { + asyncBatchImportEvaluatedAnnotations(); + } + + public static void asyncBatchImportEvaluatedAnnotations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportEvaluatedAnnotationsRequest request = + BatchImportEvaluatedAnnotationsRequest.newBuilder() + .setParent( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .addAllEvaluatedAnnotations(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.batchImportEvaluatedAnnotationsCallable().futureCall(request); + // Do something. + BatchImportEvaluatedAnnotationsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java new file mode 100644 index 000000000000..dc879f710845 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_sync] +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsRequest; +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncBatchImportEvaluatedAnnotations { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotations(); + } + + public static void syncBatchImportEvaluatedAnnotations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportEvaluatedAnnotationsRequest request = + BatchImportEvaluatedAnnotationsRequest.newBuilder() + .setParent( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .addAllEvaluatedAnnotations(new ArrayList()) + .build(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java new file mode 100644 index 000000000000..f93fea030157 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_ModelevaluationslicenameListevaluatedannotation_sync] +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation(); + } + + public static void + syncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationSliceName parent = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); + List evaluatedAnnotations = new ArrayList<>(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_ModelevaluationslicenameListevaluatedannotation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java new file mode 100644 index 000000000000..887334a84f7b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_StringListevaluatedannotation_sync] +import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotationsStringListevaluatedannotation(); + } + + public static void syncBatchImportEvaluatedAnnotationsStringListevaluatedannotation() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString(); + List evaluatedAnnotations = new ArrayList<>(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportEvaluatedAnnotations_StringListevaluatedannotation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java new file mode 100644 index 000000000000..564170f34d7a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncBatchImportModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + asyncBatchImportModelEvaluationSlices(); + } + + public static void asyncBatchImportModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportModelEvaluationSlicesRequest request = + BatchImportModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .addAllModelEvaluationSlices(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.batchImportModelEvaluationSlicesCallable().futureCall(request); + // Do something. + BatchImportModelEvaluationSlicesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java new file mode 100644 index 000000000000..2ae2e571edab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_sync] +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncBatchImportModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlices(); + } + + public static void syncBatchImportModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportModelEvaluationSlicesRequest request = + BatchImportModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .addAllModelEvaluationSlices(new ArrayList()) + .build(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java new file mode 100644 index 000000000000..3b08bb2e2a4a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_ModelevaluationnameListmodelevaluationslice_sync] +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice(); + } + + public static void + syncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + List modelEvaluationSlices = new ArrayList<>(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_ModelevaluationnameListmodelevaluationslice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java new file mode 100644 index 000000000000..04436269bcab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_StringListmodelevaluationslice_sync] +import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlicesStringListmodelevaluationslice(); + } + + public static void syncBatchImportModelEvaluationSlicesStringListmodelevaluationslice() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + List modelEvaluationSlices = new ArrayList<>(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); + } + } +} +// [END aiplatform_v1_generated_ModelService_BatchImportModelEvaluationSlices_StringListmodelevaluationslice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModel.java new file mode 100644 index 000000000000..fe45bb7e372b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CopyModelRequest; +import com.google.cloud.aiplatform.v1.EncryptionSpec; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCopyModel { + + public static void main(String[] args) throws Exception { + asyncCopyModel(); + } + + public static void asyncCopyModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.copyModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModelLRO.java new file mode 100644 index 000000000000..4981b59b1524 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/AsyncCopyModelLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CopyModelOperationMetadata; +import com.google.cloud.aiplatform.v1.CopyModelRequest; +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.EncryptionSpec; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncCopyModelLRO { + + public static void main(String[] args) throws Exception { + asyncCopyModelLRO(); + } + + public static void asyncCopyModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + OperationFuture future = + modelServiceClient.copyModelOperationCallable().futureCall(request); + // Do something. + CopyModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModel.java new file mode 100644 index 000000000000..66f5ec5d2b59 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_sync] +import com.google.cloud.aiplatform.v1.CopyModelRequest; +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.EncryptionSpec; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncCopyModel { + + public static void main(String[] args) throws Exception { + syncCopyModel(); + } + + public static void syncCopyModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + CopyModelResponse response = modelServiceClient.copyModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java new file mode 100644 index 000000000000..6363ba26c8c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_LocationnameModelname_sync] +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncCopyModelLocationnameModelname { + + public static void main(String[] args) throws Exception { + syncCopyModelLocationnameModelname(); + } + + public static void syncCopyModelLocationnameModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_LocationnameModelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameString.java new file mode 100644 index 000000000000..7b31d901b1e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelLocationnameString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_LocationnameString_sync] +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncCopyModelLocationnameString { + + public static void main(String[] args) throws Exception { + syncCopyModelLocationnameString(); + } + + public static void syncCopyModelLocationnameString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_LocationnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringModelname.java new file mode 100644 index 000000000000..b22979387866 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_StringModelname_sync] +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncCopyModelStringModelname { + + public static void main(String[] args) throws Exception { + syncCopyModelStringModelname(); + } + + public static void syncCopyModelStringModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_StringModelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringString.java new file mode 100644 index 000000000000..5f9b98ac15f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/copymodel/SyncCopyModelStringString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_CopyModel_StringString_sync] +import com.google.cloud.aiplatform.v1.CopyModelResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncCopyModelStringString { + + public static void main(String[] args) throws Exception { + syncCopyModelStringString(); + } + + public static void syncCopyModelStringString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_CopyModel_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..e89b7eb47155 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.ModelServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ModelServiceSettings modelServiceSettings = + ModelServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); + } +} +// [END aiplatform_v1_generated_ModelService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..780f1f64b501 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.ModelServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ModelServiceSettings modelServiceSettings = + ModelServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); + } +} +// [END aiplatform_v1_generated_ModelService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModel.java new file mode 100644 index 000000000000..d8e44304f664 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteModel { + + public static void main(String[] args) throws Exception { + asyncDeleteModel(); + } + + public static void asyncDeleteModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = modelServiceClient.deleteModelCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModelLRO.java new file mode 100644 index 000000000000..de850aeb89a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/AsyncDeleteModelLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelLRO(); + } + + public static void asyncDeleteModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + OperationFuture future = + modelServiceClient.deleteModelOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModel.java new file mode 100644 index 000000000000..682a5c60d9a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModel.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModel_sync] +import com.google.cloud.aiplatform.v1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModel { + + public static void main(String[] args) throws Exception { + syncDeleteModel(); + } + + public static void syncDeleteModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + modelServiceClient.deleteModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelModelname.java new file mode 100644 index 000000000000..9cc2e9d32521 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModel_Modelname_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelModelname { + + public static void main(String[] args) throws Exception { + syncDeleteModelModelname(); + } + + public static void syncDeleteModelModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + modelServiceClient.deleteModelAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModel_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelString.java new file mode 100644 index 000000000000..49a69b53824c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodel/SyncDeleteModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModel_String_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelString { + + public static void main(String[] args) throws Exception { + syncDeleteModelString(); + } + + public static void syncDeleteModelString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + modelServiceClient.deleteModelAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java new file mode 100644 index 000000000000..a2bc42f8345f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModelVersion_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteModelVersion { + + public static void main(String[] args) throws Exception { + asyncDeleteModelVersion(); + } + + public static void asyncDeleteModelVersion() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = + modelServiceClient.deleteModelVersionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModelVersion_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java new file mode 100644 index 000000000000..8f32189e03f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModelVersion_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelVersionLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelVersionLRO(); + } + + public static void asyncDeleteModelVersionLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + OperationFuture future = + modelServiceClient.deleteModelVersionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModelVersion_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersion.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersion.java new file mode 100644 index 000000000000..7928bf4d38dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersion.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModelVersion_sync] +import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersion { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersion(); + } + + public static void syncDeleteModelVersion() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + modelServiceClient.deleteModelVersionAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModelVersion_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java new file mode 100644 index 000000000000..e0c1146d2626 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModelVersion_Modelname_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersionModelname { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersionModelname(); + } + + public static void syncDeleteModelVersionModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + modelServiceClient.deleteModelVersionAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModelVersion_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java new file mode 100644 index 000000000000..1f7ff7495160 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_DeleteModelVersion_String_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersionString { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersionString(); + } + + public static void syncDeleteModelVersionString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + modelServiceClient.deleteModelVersionAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_DeleteModelVersion_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModel.java new file mode 100644 index 000000000000..e02f7440291a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ExportModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ExportModelRequest; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncExportModel { + + public static void main(String[] args) throws Exception { + asyncExportModel(); + } + + public static void asyncExportModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.exportModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ExportModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModelLRO.java new file mode 100644 index 000000000000..345939cd5558 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/AsyncExportModelLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ExportModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.ExportModelOperationMetadata; +import com.google.cloud.aiplatform.v1.ExportModelRequest; +import com.google.cloud.aiplatform.v1.ExportModelResponse; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncExportModelLRO { + + public static void main(String[] args) throws Exception { + asyncExportModelLRO(); + } + + public static void asyncExportModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + OperationFuture future = + modelServiceClient.exportModelOperationCallable().futureCall(request); + // Do something. + ExportModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ExportModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModel.java new file mode 100644 index 000000000000..082f47ad6f66 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ExportModel_sync] +import com.google.cloud.aiplatform.v1.ExportModelRequest; +import com.google.cloud.aiplatform.v1.ExportModelResponse; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncExportModel { + + public static void main(String[] args) throws Exception { + syncExportModel(); + } + + public static void syncExportModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ExportModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java new file mode 100644 index 000000000000..6354da10e78b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ExportModel_ModelnameExportmodelrequestoutputconfig_sync] +import com.google.cloud.aiplatform.v1.ExportModelRequest; +import com.google.cloud.aiplatform.v1.ExportModelResponse; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncExportModelModelnameExportmodelrequestoutputconfig { + + public static void main(String[] args) throws Exception { + syncExportModelModelnameExportmodelrequestoutputconfig(); + } + + public static void syncExportModelModelnameExportmodelrequestoutputconfig() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + ExportModelRequest.OutputConfig outputConfig = + ExportModelRequest.OutputConfig.newBuilder().build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ExportModel_ModelnameExportmodelrequestoutputconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java new file mode 100644 index 000000000000..866a8560ce39 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ExportModel_StringExportmodelrequestoutputconfig_sync] +import com.google.cloud.aiplatform.v1.ExportModelRequest; +import com.google.cloud.aiplatform.v1.ExportModelResponse; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncExportModelStringExportmodelrequestoutputconfig { + + public static void main(String[] args) throws Exception { + syncExportModelStringExportmodelrequestoutputconfig(); + } + + public static void syncExportModelStringExportmodelrequestoutputconfig() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + ExportModelRequest.OutputConfig outputConfig = + ExportModelRequest.OutputConfig.newBuilder().build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ExportModel_StringExportmodelrequestoutputconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..63c94b9d9d3f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..0bee55f61ff8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = modelServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..f12e819f7273 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = modelServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..6dae775cad1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = modelServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/AsyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/AsyncGetModel.java new file mode 100644 index 000000000000..2dd56463cf57 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/AsyncGetModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetModelRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncGetModel { + + public static void main(String[] args) throws Exception { + asyncGetModel(); + } + + public static void asyncGetModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelRequest request = + GetModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = modelServiceClient.getModelCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..72f842ea7b84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModel.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModel_sync] +import com.google.cloud.aiplatform.v1.GetModelRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelRequest request = + GetModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + Model response = modelServiceClient.getModel(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelModelname.java new file mode 100644 index 000000000000..c81880e3edfd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModel_Modelname_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelModelname { + + public static void main(String[] args) throws Exception { + syncGetModelModelname(); + } + + public static void syncGetModelModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + Model response = modelServiceClient.getModel(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModel_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelString.java new file mode 100644 index 000000000000..64287490d6c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodel/SyncGetModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModel_String_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelString { + + public static void main(String[] args) throws Exception { + syncGetModelString(); + } + + public static void syncGetModelString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + Model response = modelServiceClient.getModel(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java new file mode 100644 index 000000000000..c384ac850d3e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetModelEvaluationRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncGetModelEvaluation { + + public static void main(String[] args) throws Exception { + asyncGetModelEvaluation(); + } + + public static void asyncGetModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationRequest request = + GetModelEvaluationRequest.newBuilder() + .setName( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .build(); + ApiFuture future = + modelServiceClient.getModelEvaluationCallable().futureCall(request); + // Do something. + ModelEvaluation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java new file mode 100644 index 000000000000..9b6fe3edafa7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluation_sync] +import com.google.cloud.aiplatform.v1.GetModelEvaluationRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluation { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluation(); + } + + public static void syncGetModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationRequest request = + GetModelEvaluationRequest.newBuilder() + .setName( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .build(); + ModelEvaluation response = modelServiceClient.getModelEvaluation(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java new file mode 100644 index 000000000000..c887ac136a06 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluation_Modelevaluationname_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluationModelevaluationname { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationModelevaluationname(); + } + + public static void syncGetModelEvaluationModelevaluationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName name = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + ModelEvaluation response = modelServiceClient.getModelEvaluation(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluation_Modelevaluationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java new file mode 100644 index 000000000000..3c8d06539f4b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluation_String_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluationString { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationString(); + } + + public static void syncGetModelEvaluationString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + ModelEvaluation response = modelServiceClient.getModelEvaluation(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluation_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java new file mode 100644 index 000000000000..b71769d29125 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetModelEvaluationSliceRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncGetModelEvaluationSlice { + + public static void main(String[] args) throws Exception { + asyncGetModelEvaluationSlice(); + } + + public static void asyncGetModelEvaluationSlice() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationSliceRequest request = + GetModelEvaluationSliceRequest.newBuilder() + .setName( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .build(); + ApiFuture future = + modelServiceClient.getModelEvaluationSliceCallable().futureCall(request); + // Do something. + ModelEvaluationSlice response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java new file mode 100644 index 000000000000..f10a27e25f46 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_sync] +import com.google.cloud.aiplatform.v1.GetModelEvaluationSliceRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluationSlice { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSlice(); + } + + public static void syncGetModelEvaluationSlice() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationSliceRequest request = + GetModelEvaluationSliceRequest.newBuilder() + .setName( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .build(); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java new file mode 100644 index 000000000000..3ef28f9bc332 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_Modelevaluationslicename_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluationSliceModelevaluationslicename { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSliceModelevaluationslicename(); + } + + public static void syncGetModelEvaluationSliceModelevaluationslicename() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationSliceName name = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_Modelevaluationslicename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java new file mode 100644 index 000000000000..864681563d8a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_String_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncGetModelEvaluationSliceString { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSliceString(); + } + + public static void syncGetModelEvaluationSliceString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString(); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); + } + } +} +// [END aiplatform_v1_generated_ModelService_GetModelEvaluationSlice_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java new file mode 100644 index 000000000000..6a172d4a9056 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ImportModelEvaluation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ImportModelEvaluationRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class AsyncImportModelEvaluation { + + public static void main(String[] args) throws Exception { + asyncImportModelEvaluation(); + } + + public static void asyncImportModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ImportModelEvaluationRequest request = + ImportModelEvaluationRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setModelEvaluation(ModelEvaluation.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.importModelEvaluationCallable().futureCall(request); + // Do something. + ModelEvaluation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_ImportModelEvaluation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java new file mode 100644 index 000000000000..c06c201b8eae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ImportModelEvaluation_sync] +import com.google.cloud.aiplatform.v1.ImportModelEvaluationRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncImportModelEvaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluation(); + } + + public static void syncImportModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ImportModelEvaluationRequest request = + ImportModelEvaluationRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setModelEvaluation(ModelEvaluation.newBuilder().build()) + .build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_ImportModelEvaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java new file mode 100644 index 000000000000..ec26d342ea54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ImportModelEvaluation_ModelnameModelevaluation_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncImportModelEvaluationModelnameModelevaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluationModelnameModelevaluation(); + } + + public static void syncImportModelEvaluationModelnameModelevaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); + } + } +} +// [END aiplatform_v1_generated_ModelService_ImportModelEvaluation_ModelnameModelevaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java new file mode 100644 index 000000000000..04eb44ade19c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ImportModelEvaluation_StringModelevaluation_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncImportModelEvaluationStringModelevaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluationStringModelevaluation(); + } + + public static void syncImportModelEvaluationStringModelevaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); + } + } +} +// [END aiplatform_v1_generated_ModelService_ImportModelEvaluation_StringModelevaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..9abf01e7ac66 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + modelServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..c648d983a19c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = modelServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..ac1ded43dd2c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : modelServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java new file mode 100644 index 000000000000..a92ec6805588 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluations { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluations(); + } + + public static void asyncListModelEvaluations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.listModelEvaluationsPagedCallable().futureCall(request); + // Do something. + for (ModelEvaluation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java new file mode 100644 index 000000000000..3bf73f7113d6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluations_Paged_async] +import com.google.cloud.aiplatform.v1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1.ListModelEvaluationsResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationsPaged(); + } + + public static void asyncListModelEvaluationsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelEvaluationsResponse response = + modelServiceClient.listModelEvaluationsCallable().call(request); + for (ModelEvaluation element : response.getModelEvaluationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluations.java new file mode 100644 index 000000000000..350cfd07cb02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluations_sync] +import com.google.cloud.aiplatform.v1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelEvaluations { + + public static void main(String[] args) throws Exception { + syncListModelEvaluations(); + } + + public static void syncListModelEvaluations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelEvaluation element : + modelServiceClient.listModelEvaluations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java new file mode 100644 index 000000000000..cc265921db7a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluations_Modelname_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelEvaluationsModelname { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationsModelname(); + } + + public static void syncListModelEvaluationsModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluations_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java new file mode 100644 index 000000000000..ab0a76b3f5d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluations_String_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluation; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelEvaluationsString { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationsString(); + } + + public static void syncListModelEvaluationsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluations_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java new file mode 100644 index 000000000000..830a153a6824 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationSlices(); + } + + public static void asyncListModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.listModelEvaluationSlicesPagedCallable().futureCall(request); + // Do something. + for (ModelEvaluationSlice element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java new file mode 100644 index 000000000000..779a198be5d4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_Paged_async] +import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationSlicesPaged { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationSlicesPaged(); + } + + public static void asyncListModelEvaluationSlicesPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelEvaluationSlicesResponse response = + modelServiceClient.listModelEvaluationSlicesCallable().call(request); + for (ModelEvaluationSlice element : response.getModelEvaluationSlicesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java new file mode 100644 index 000000000000..3dedac0018e9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_sync] +import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlices(); + } + + public static void syncListModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java new file mode 100644 index 000000000000..aac6036eda78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_Modelevaluationname_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelEvaluationSlicesModelevaluationname { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlicesModelevaluationname(); + } + + public static void syncListModelEvaluationSlicesModelevaluationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_Modelevaluationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java new file mode 100644 index 000000000000..da7f71702afe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_String_sync] +import com.google.cloud.aiplatform.v1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelEvaluationSlicesString { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlicesString(); + } + + public static void syncListModelEvaluationSlicesString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelEvaluationSlices_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModels.java new file mode 100644 index 000000000000..2d8b3d6a9ff5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModels.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModels_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListModelsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModels { + + public static void main(String[] args) throws Exception { + asyncListModels(); + } + + public static void asyncListModels() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = modelServiceClient.listModelsPagedCallable().futureCall(request); + // Do something. + for (Model element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModels_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModelsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModelsPaged.java new file mode 100644 index 000000000000..7f7cccccd24d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/AsyncListModelsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModels_Paged_async] +import com.google.cloud.aiplatform.v1.ListModelsRequest; +import com.google.cloud.aiplatform.v1.ListModelsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelsPaged(); + } + + public static void asyncListModelsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListModelsResponse response = modelServiceClient.listModelsCallable().call(request); + for (Model element : response.getModelsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModels_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModels.java new file mode 100644 index 000000000000..0e574877328e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModels.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModels_sync] +import com.google.cloud.aiplatform.v1.ListModelsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModels { + + public static void main(String[] args) throws Exception { + syncListModels(); + } + + public static void syncListModels() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Model element : modelServiceClient.listModels(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModels_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsLocationname.java new file mode 100644 index 000000000000..0644ef8ee5e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModels_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelsLocationname { + + public static void main(String[] args) throws Exception { + syncListModelsLocationname(); + } + + public static void syncListModelsLocationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Model element : modelServiceClient.listModels(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModels_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsString.java new file mode 100644 index 000000000000..01afc6ed0825 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodels/SyncListModelsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModels_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelsString { + + public static void main(String[] args) throws Exception { + syncListModelsString(); + } + + public static void syncListModelsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Model element : modelServiceClient.listModels(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModels_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersions.java new file mode 100644 index 000000000000..0a6580b3a454 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersions.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelVersions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelVersions { + + public static void main(String[] args) throws Exception { + asyncListModelVersions(); + } + + public static void asyncListModelVersions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + modelServiceClient.listModelVersionsPagedCallable().futureCall(request); + // Do something. + for (Model element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelVersions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java new file mode 100644 index 000000000000..5392b2798d05 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelVersions_Paged_async] +import com.google.cloud.aiplatform.v1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1.ListModelVersionsResponse; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelVersionsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelVersionsPaged(); + } + + public static void asyncListModelVersionsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListModelVersionsResponse response = + modelServiceClient.listModelVersionsCallable().call(request); + for (Model element : response.getModelsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelVersions_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersions.java new file mode 100644 index 000000000000..258832ffb0c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersions.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelVersions_sync] +import com.google.cloud.aiplatform.v1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelVersions { + + public static void main(String[] args) throws Exception { + syncListModelVersions(); + } + + public static void syncListModelVersions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Model element : modelServiceClient.listModelVersions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelVersions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsModelname.java new file mode 100644 index 000000000000..170bce5d3191 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelVersions_Modelname_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelVersionsModelname { + + public static void main(String[] args) throws Exception { + syncListModelVersionsModelname(); + } + + public static void syncListModelVersionsModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelVersions_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsString.java new file mode 100644 index 000000000000..c1a747fa1804 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/listmodelversions/SyncListModelVersionsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_ListModelVersions_String_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; + +public class SyncListModelVersionsString { + + public static void main(String[] args) throws Exception { + syncListModelVersionsString(); + } + + public static void syncListModelVersionsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ModelService_ListModelVersions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java new file mode 100644 index 000000000000..49b44f367291 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_MergeVersionAliases_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.MergeVersionAliasesRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncMergeVersionAliases { + + public static void main(String[] args) throws Exception { + asyncMergeVersionAliases(); + } + + public static void asyncMergeVersionAliases() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + MergeVersionAliasesRequest request = + MergeVersionAliasesRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .addAllVersionAliases(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.mergeVersionAliasesCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_MergeVersionAliases_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java new file mode 100644 index 000000000000..20e0056b6857 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_MergeVersionAliases_sync] +import com.google.cloud.aiplatform.v1.MergeVersionAliasesRequest; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncMergeVersionAliases { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliases(); + } + + public static void syncMergeVersionAliases() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + MergeVersionAliasesRequest request = + MergeVersionAliasesRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .addAllVersionAliases(new ArrayList()) + .build(); + Model response = modelServiceClient.mergeVersionAliases(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_MergeVersionAliases_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java new file mode 100644 index 000000000000..2355a9d8c63b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_MergeVersionAliases_ModelnameListstring_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncMergeVersionAliasesModelnameListstring { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliasesModelnameListstring(); + } + + public static void syncMergeVersionAliasesModelnameListstring() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + List versionAliases = new ArrayList<>(); + Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); + } + } +} +// [END aiplatform_v1_generated_ModelService_MergeVersionAliases_ModelnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java new file mode 100644 index 000000000000..4c3b354a10e4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_MergeVersionAliases_StringListstring_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncMergeVersionAliasesStringListstring { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliasesStringListstring(); + } + + public static void syncMergeVersionAliasesStringListstring() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + List versionAliases = new ArrayList<>(); + Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); + } + } +} +// [END aiplatform_v1_generated_ModelService_MergeVersionAliases_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..69d581d00b55 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..401b2cfd1fad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = modelServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..99e53f2ddb3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..0bc56f607312 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = modelServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java new file mode 100644 index 000000000000..ff29d008bd4a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateExplanationDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Examples; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetRequest; +import com.google.longrunning.Operation; + +public class AsyncUpdateExplanationDataset { + + public static void main(String[] args) throws Exception { + asyncUpdateExplanationDataset(); + } + + public static void asyncUpdateExplanationDataset() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.updateExplanationDatasetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateExplanationDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java new file mode 100644 index 000000000000..9af0952844fc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateExplanationDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.Examples; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetRequest; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetResponse; + +public class AsyncUpdateExplanationDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateExplanationDatasetLRO(); + } + + public static void asyncUpdateExplanationDatasetLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + OperationFuture + future = + modelServiceClient.updateExplanationDatasetOperationCallable().futureCall(request); + // Do something. + UpdateExplanationDatasetResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateExplanationDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java new file mode 100644 index 000000000000..54c23b31110e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateExplanationDataset_sync] +import com.google.cloud.aiplatform.v1.Examples; +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetRequest; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDataset { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDataset(); + } + + public static void syncUpdateExplanationDataset() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateExplanationDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java new file mode 100644 index 000000000000..7e220e6335ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateExplanationDataset_Modelname_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDatasetModelname { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDatasetModelname(); + } + + public static void syncUpdateExplanationDatasetModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(model).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateExplanationDataset_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java new file mode 100644 index 000000000000..bcef1e692b98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateExplanationDataset_String_sync] +import com.google.cloud.aiplatform.v1.ModelName; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDatasetString { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDatasetString(); + } + + public static void syncUpdateExplanationDatasetString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(model).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateExplanationDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/AsyncUpdateModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/AsyncUpdateModel.java new file mode 100644 index 000000000000..842e73ab43d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/AsyncUpdateModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateModelRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModel { + + public static void main(String[] args) throws Exception { + asyncUpdateModel(); + } + + public static void asyncUpdateModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateModelRequest request = + UpdateModelRequest.newBuilder() + .setModel(Model.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.updateModelCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModel.java new file mode 100644 index 000000000000..a64d4cb8b6c0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateModel_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UpdateModelRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModel { + + public static void main(String[] args) throws Exception { + syncUpdateModel(); + } + + public static void syncUpdateModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateModelRequest request = + UpdateModelRequest.newBuilder() + .setModel(Model.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Model response = modelServiceClient.updateModel(request); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java new file mode 100644 index 000000000000..8edb3e13b367 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UpdateModel_ModelFieldmask_sync] +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelModelFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateModelModelFieldmask(); + } + + public static void syncUpdateModelModelFieldmask() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + Model model = Model.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Model response = modelServiceClient.updateModel(model, updateMask); + } + } +} +// [END aiplatform_v1_generated_ModelService_UpdateModel_ModelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModel.java new file mode 100644 index 000000000000..8841ab7b6faf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModel.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UploadModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UploadModelRequest; +import com.google.longrunning.Operation; + +public class AsyncUploadModel { + + public static void main(String[] args) throws Exception { + asyncUploadModel(); + } + + public static void asyncUploadModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + ApiFuture future = modelServiceClient.uploadModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UploadModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModelLRO.java new file mode 100644 index 000000000000..c5ed7f54d3bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/AsyncUploadModelLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UploadModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UploadModelOperationMetadata; +import com.google.cloud.aiplatform.v1.UploadModelRequest; +import com.google.cloud.aiplatform.v1.UploadModelResponse; + +public class AsyncUploadModelLRO { + + public static void main(String[] args) throws Exception { + asyncUploadModelLRO(); + } + + public static void asyncUploadModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + OperationFuture future = + modelServiceClient.uploadModelOperationCallable().futureCall(request); + // Do something. + UploadModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UploadModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModel.java new file mode 100644 index 000000000000..c8907ecb45a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModel.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UploadModel_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UploadModelRequest; +import com.google.cloud.aiplatform.v1.UploadModelResponse; + +public class SyncUploadModel { + + public static void main(String[] args) throws Exception { + syncUploadModel(); + } + + public static void syncUploadModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UploadModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java new file mode 100644 index 000000000000..d800fc221b87 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UploadModel_LocationnameModel_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UploadModelResponse; + +public class SyncUploadModelLocationnameModel { + + public static void main(String[] args) throws Exception { + syncUploadModelLocationnameModel(); + } + + public static void syncUploadModelLocationnameModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Model model = Model.newBuilder().build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UploadModel_LocationnameModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelStringModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelStringModel.java new file mode 100644 index 000000000000..dcd94d8c9d78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservice/uploadmodel/SyncUploadModelStringModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelService_UploadModel_StringModel_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Model; +import com.google.cloud.aiplatform.v1.ModelServiceClient; +import com.google.cloud.aiplatform.v1.UploadModelResponse; + +public class SyncUploadModelStringModel { + + public static void main(String[] args) throws Exception { + syncUploadModelStringModel(); + } + + public static void syncUploadModelStringModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Model model = Model.newBuilder().build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); + } + } +} +// [END aiplatform_v1_generated_ModelService_UploadModel_StringModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservicesettings/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservicesettings/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..0dfa66e6b397 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/modelservicesettings/getmodel/SyncGetModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ModelServiceSettings_GetModel_sync] +import com.google.cloud.aiplatform.v1.ModelServiceSettings; +import java.time.Duration; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 + ModelServiceSettings.Builder modelServiceSettingsBuilder = ModelServiceSettings.newBuilder(); + modelServiceSettingsBuilder + .getModelSettings() + .setRetrySettings( + modelServiceSettingsBuilder + .getModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelServiceSettings modelServiceSettings = modelServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ModelServiceSettings_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java new file mode 100644 index 000000000000..ff8f6805c0f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelPipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelPipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelPipelineJob { + + public static void main(String[] args) throws Exception { + asyncCancelPipelineJob(); + } + + public static void asyncCancelPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelPipelineJobRequest request = + CancelPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.cancelPipelineJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelPipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java new file mode 100644 index 000000000000..d2206e67c159 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelPipelineJob_sync] +import com.google.cloud.aiplatform.v1.CancelPipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJob { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJob(); + } + + public static void syncCancelPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelPipelineJobRequest request = + CancelPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + pipelineServiceClient.cancelPipelineJob(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelPipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java new file mode 100644 index 000000000000..897e6288227e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelPipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJobPipelinejobname(); + } + + public static void syncCancelPipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + pipelineServiceClient.cancelPipelineJob(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelPipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java new file mode 100644 index 000000000000..610bc1f76419 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelPipelineJob_String_sync] +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJobString { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJobString(); + } + + public static void syncCancelPipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + pipelineServiceClient.cancelPipelineJob(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelPipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java new file mode 100644 index 000000000000..fd0513616e8b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CancelTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class AsyncCancelTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncCancelTrainingPipeline(); + } + + public static void asyncCancelTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelTrainingPipelineRequest request = + CancelTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.cancelTrainingPipelineCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java new file mode 100644 index 000000000000..ae2e185b53b2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.CancelTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipeline(); + } + + public static void syncCancelTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelTrainingPipelineRequest request = + CancelTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + pipelineServiceClient.cancelTrainingPipeline(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java new file mode 100644 index 000000000000..21e43f74dc11 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipelineString(); + } + + public static void syncCancelTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + pipelineServiceClient.cancelTrainingPipeline(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..ef451ea38752 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipelineTrainingpipelinename(); + } + + public static void syncCancelTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + pipelineServiceClient.cancelTrainingPipeline(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CancelTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..23325c97d5f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.PipelineServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + PipelineServiceSettings pipelineServiceSettings = + PipelineServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PipelineServiceClient pipelineServiceClient = + PipelineServiceClient.create(pipelineServiceSettings); + } +} +// [END aiplatform_v1_generated_PipelineService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..afb685d6a323 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.PipelineServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + PipelineServiceSettings pipelineServiceSettings = + PipelineServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PipelineServiceClient pipelineServiceClient = + PipelineServiceClient.create(pipelineServiceSettings); + } +} +// [END aiplatform_v1_generated_PipelineService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java new file mode 100644 index 000000000000..4ea8f3b878fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreatePipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreatePipelineJobRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class AsyncCreatePipelineJob { + + public static void main(String[] args) throws Exception { + asyncCreatePipelineJob(); + } + + public static void asyncCreatePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreatePipelineJobRequest request = + CreatePipelineJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPipelineJob(PipelineJob.newBuilder().build()) + .setPipelineJobId("pipelineJobId-1711315914") + .build(); + ApiFuture future = + pipelineServiceClient.createPipelineJobCallable().futureCall(request); + // Do something. + PipelineJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreatePipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java new file mode 100644 index 000000000000..77df07346f0e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreatePipelineJob_sync] +import com.google.cloud.aiplatform.v1.CreatePipelineJobRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncCreatePipelineJob { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJob(); + } + + public static void syncCreatePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreatePipelineJobRequest request = + CreatePipelineJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPipelineJob(PipelineJob.newBuilder().build()) + .setPipelineJobId("pipelineJobId-1711315914") + .build(); + PipelineJob response = pipelineServiceClient.createPipelineJob(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreatePipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java new file mode 100644 index 000000000000..b62241a69bb4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreatePipelineJob_LocationnamePipelinejobString_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncCreatePipelineJobLocationnamePipelinejobString { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJobLocationnamePipelinejobString(); + } + + public static void syncCreatePipelineJobLocationnamePipelinejobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PipelineJob pipelineJob = PipelineJob.newBuilder().build(); + String pipelineJobId = "pipelineJobId-1711315914"; + PipelineJob response = + pipelineServiceClient.createPipelineJob(parent, pipelineJob, pipelineJobId); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreatePipelineJob_LocationnamePipelinejobString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java new file mode 100644 index 000000000000..30a9711390b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreatePipelineJob_StringPipelinejobString_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncCreatePipelineJobStringPipelinejobString { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJobStringPipelinejobString(); + } + + public static void syncCreatePipelineJobStringPipelinejobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PipelineJob pipelineJob = PipelineJob.newBuilder().build(); + String pipelineJobId = "pipelineJobId-1711315914"; + PipelineJob response = + pipelineServiceClient.createPipelineJob(parent, pipelineJob, pipelineJobId); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreatePipelineJob_StringPipelinejobString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..3157352d083a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class AsyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncCreateTrainingPipeline(); + } + + public static void asyncCreateTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreateTrainingPipelineRequest request = + CreateTrainingPipelineRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTrainingPipeline(TrainingPipeline.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.createTrainingPipelineCallable().futureCall(request); + // Do something. + TrainingPipeline response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..1cb674e0f3a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.CreateTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreateTrainingPipelineRequest request = + CreateTrainingPipelineRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTrainingPipeline(TrainingPipeline.newBuilder().build()) + .build(); + TrainingPipeline response = pipelineServiceClient.createTrainingPipeline(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java new file mode 100644 index 000000000000..131bae5f786c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_LocationnameTrainingpipeline_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class SyncCreateTrainingPipelineLocationnameTrainingpipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipelineLocationnameTrainingpipeline(); + } + + public static void syncCreateTrainingPipelineLocationnameTrainingpipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + TrainingPipeline trainingPipeline = TrainingPipeline.newBuilder().build(); + TrainingPipeline response = + pipelineServiceClient.createTrainingPipeline(parent, trainingPipeline); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_LocationnameTrainingpipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java new file mode 100644 index 000000000000..5daa6734cedf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_StringTrainingpipeline_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class SyncCreateTrainingPipelineStringTrainingpipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipelineStringTrainingpipeline(); + } + + public static void syncCreateTrainingPipelineStringTrainingpipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + TrainingPipeline trainingPipeline = TrainingPipeline.newBuilder().build(); + TrainingPipeline response = + pipelineServiceClient.createTrainingPipeline(parent, trainingPipeline); + } + } +} +// [END aiplatform_v1_generated_PipelineService_CreateTrainingPipeline_StringTrainingpipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java new file mode 100644 index 000000000000..7afe22bf66e5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeletePipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeletePipelineJob { + + public static void main(String[] args) throws Exception { + asyncDeletePipelineJob(); + } + + public static void asyncDeletePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.deletePipelineJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeletePipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java new file mode 100644 index 000000000000..21b32c4009d2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeletePipelineJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeletePipelineJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePipelineJobLRO(); + } + + public static void asyncDeletePipelineJobLRO() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + OperationFuture future = + pipelineServiceClient.deletePipelineJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeletePipelineJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java new file mode 100644 index 000000000000..21dc8f3b7200 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeletePipelineJob_sync] +import com.google.cloud.aiplatform.v1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJob { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJob(); + } + + public static void syncDeletePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + pipelineServiceClient.deletePipelineJobAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeletePipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java new file mode 100644 index 000000000000..4f354138356c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeletePipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJobPipelinejobname(); + } + + public static void syncDeletePipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + pipelineServiceClient.deletePipelineJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeletePipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java new file mode 100644 index 000000000000..1658b73461f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeletePipelineJob_String_sync] +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJobString { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJobString(); + } + + public static void syncDeletePipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + pipelineServiceClient.deletePipelineJobAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeletePipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java new file mode 100644 index 000000000000..7fd724ea4c08 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.longrunning.Operation; + +public class AsyncDeleteTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncDeleteTrainingPipeline(); + } + + public static void asyncDeleteTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.deleteTrainingPipelineCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java new file mode 100644 index 000000000000..44af763ef8ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTrainingPipelineLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTrainingPipelineLRO(); + } + + public static void asyncDeleteTrainingPipelineLRO() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + OperationFuture future = + pipelineServiceClient.deleteTrainingPipelineOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java new file mode 100644 index 000000000000..4114e34c29bf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipeline(); + } + + public static void syncDeleteTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + pipelineServiceClient.deleteTrainingPipelineAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java new file mode 100644 index 000000000000..729dea712884 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipelineString(); + } + + public static void syncDeleteTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + pipelineServiceClient.deleteTrainingPipelineAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..54f34acbd83a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipelineTrainingpipelinename(); + } + + public static void syncDeleteTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + pipelineServiceClient.deleteTrainingPipelineAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_DeleteTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..9cb803a2a5f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = pipelineServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..b0700f97b167 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = pipelineServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..e4218450263e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = pipelineServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..efed88fe6e6e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = pipelineServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java new file mode 100644 index 000000000000..0904e9ec10f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetPipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetPipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class AsyncGetPipelineJob { + + public static void main(String[] args) throws Exception { + asyncGetPipelineJob(); + } + + public static void asyncGetPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetPipelineJobRequest request = + GetPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.getPipelineJobCallable().futureCall(request); + // Do something. + PipelineJob response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetPipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java new file mode 100644 index 000000000000..5fdbc2ea3add --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetPipelineJob_sync] +import com.google.cloud.aiplatform.v1.GetPipelineJobRequest; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncGetPipelineJob { + + public static void main(String[] args) throws Exception { + syncGetPipelineJob(); + } + + public static void syncGetPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetPipelineJobRequest request = + GetPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + PipelineJob response = pipelineServiceClient.getPipelineJob(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetPipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java new file mode 100644 index 000000000000..f3a5280ad34e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetPipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncGetPipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncGetPipelineJobPipelinejobname(); + } + + public static void syncGetPipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + PipelineJob response = pipelineServiceClient.getPipelineJob(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetPipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java new file mode 100644 index 000000000000..5ad82c39b2cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetPipelineJob_String_sync] +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineJobName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncGetPipelineJobString { + + public static void main(String[] args) throws Exception { + syncGetPipelineJobString(); + } + + public static void syncGetPipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + PipelineJob response = pipelineServiceClient.getPipelineJob(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetPipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java new file mode 100644 index 000000000000..8ed14e1db367 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; + +public class AsyncGetTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncGetTrainingPipeline(); + } + + public static void asyncGetTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetTrainingPipelineRequest request = + GetTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.getTrainingPipelineCallable().futureCall(request); + // Do something. + TrainingPipeline response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java new file mode 100644 index 000000000000..3954831b3bc5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.GetTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; + +public class SyncGetTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipeline(); + } + + public static void syncGetTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetTrainingPipelineRequest request = + GetTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java new file mode 100644 index 000000000000..89f73e5c456b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; + +public class SyncGetTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipelineString(); + } + + public static void syncGetTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..3b646f84e04a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_GetTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.cloud.aiplatform.v1.TrainingPipelineName; + +public class SyncGetTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipelineTrainingpipelinename(); + } + + public static void syncGetTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(name); + } + } +} +// [END aiplatform_v1_generated_PipelineService_GetTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..d16f34bfe27f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + pipelineServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..bd5ebbe675ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + pipelineServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..efe895d83425 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : pipelineServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java new file mode 100644 index 000000000000..8c34057eff0d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListPipelineJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListPipelineJobs { + + public static void main(String[] args) throws Exception { + asyncListPipelineJobs(); + } + + public static void asyncListPipelineJobs() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.listPipelineJobsPagedCallable().futureCall(request); + // Do something. + for (PipelineJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListPipelineJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java new file mode 100644 index 000000000000..3d297a10aa26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListPipelineJobs_Paged_async] +import com.google.cloud.aiplatform.v1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1.ListPipelineJobsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListPipelineJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListPipelineJobsPaged(); + } + + public static void asyncListPipelineJobsPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListPipelineJobsResponse response = + pipelineServiceClient.listPipelineJobsCallable().call(request); + for (PipelineJob element : response.getPipelineJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListPipelineJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java new file mode 100644 index 000000000000..1ab2252dce8e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListPipelineJobs_sync] +import com.google.cloud.aiplatform.v1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListPipelineJobs { + + public static void main(String[] args) throws Exception { + syncListPipelineJobs(); + } + + public static void syncListPipelineJobs() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListPipelineJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java new file mode 100644 index 000000000000..4249e4c5e7e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListPipelineJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncListPipelineJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListPipelineJobsLocationname(); + } + + public static void syncListPipelineJobsLocationname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListPipelineJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java new file mode 100644 index 000000000000..4de1c6a44f3e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListPipelineJobs_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineJob; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; + +public class SyncListPipelineJobsString { + + public static void main(String[] args) throws Exception { + syncListPipelineJobsString(); + } + + public static void syncListPipelineJobsString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListPipelineJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java new file mode 100644 index 000000000000..d9eab65f1335 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListTrainingPipelines_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.protobuf.FieldMask; + +public class AsyncListTrainingPipelines { + + public static void main(String[] args) throws Exception { + asyncListTrainingPipelines(); + } + + public static void asyncListTrainingPipelines() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.listTrainingPipelinesPagedCallable().futureCall(request); + // Do something. + for (TrainingPipeline element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListTrainingPipelines_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java new file mode 100644 index 000000000000..faaf9cff71d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListTrainingPipelines_Paged_async] +import com.google.cloud.aiplatform.v1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1.ListTrainingPipelinesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTrainingPipelinesPaged { + + public static void main(String[] args) throws Exception { + asyncListTrainingPipelinesPaged(); + } + + public static void asyncListTrainingPipelinesPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTrainingPipelinesResponse response = + pipelineServiceClient.listTrainingPipelinesCallable().call(request); + for (TrainingPipeline element : response.getTrainingPipelinesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListTrainingPipelines_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java new file mode 100644 index 000000000000..241170808ee3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListTrainingPipelines_sync] +import com.google.cloud.aiplatform.v1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; +import com.google.protobuf.FieldMask; + +public class SyncListTrainingPipelines { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelines(); + } + + public static void syncListTrainingPipelines() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListTrainingPipelines_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java new file mode 100644 index 000000000000..5194685652fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListTrainingPipelines_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class SyncListTrainingPipelinesLocationname { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelinesLocationname(); + } + + public static void syncListTrainingPipelinesLocationname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListTrainingPipelines_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java new file mode 100644 index 000000000000..60967a1cc3cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_ListTrainingPipelines_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.TrainingPipeline; + +public class SyncListTrainingPipelinesString { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelinesString(); + } + + public static void syncListTrainingPipelinesString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PipelineService_ListTrainingPipelines_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..52e1712f09b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = pipelineServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..a68edc63575a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = pipelineServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..03bcc6c86208 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + pipelineServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PipelineService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..62d0e52958a0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PipelineServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = pipelineServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_PipelineService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..0b899478e4c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PipelineServiceSettings_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.PipelineServiceSettings; +import java.time.Duration; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 + PipelineServiceSettings.Builder pipelineServiceSettingsBuilder = + PipelineServiceSettings.newBuilder(); + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings( + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PipelineServiceSettings pipelineServiceSettings = pipelineServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_PipelineServiceSettings_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5a3c7e78eab2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.PredictionServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + PredictionServiceSettings predictionServiceSettings = + PredictionServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PredictionServiceClient predictionServiceClient = + PredictionServiceClient.create(predictionServiceSettings); + } +} +// [END aiplatform_v1_generated_PredictionService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..3257a5ff1304 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.PredictionServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + PredictionServiceSettings predictionServiceSettings = + PredictionServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PredictionServiceClient predictionServiceClient = + PredictionServiceClient.create(predictionServiceSettings); + } +} +// [END aiplatform_v1_generated_PredictionService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/AsyncExplain.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/AsyncExplain.java new file mode 100644 index 000000000000..c913c7ed7ee4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/AsyncExplain.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Explain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ExplainRequest; +import com.google.cloud.aiplatform.v1.ExplainResponse; +import com.google.cloud.aiplatform.v1.ExplanationSpecOverride; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class AsyncExplain { + + public static void main(String[] args) throws Exception { + asyncExplain(); + } + + public static void asyncExplain() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ExplainRequest request = + ExplainRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .setExplanationSpecOverride(ExplanationSpecOverride.newBuilder().build()) + .setDeployedModelId("deployedModelId-1817547906") + .build(); + ApiFuture future = + predictionServiceClient.explainCallable().futureCall(request); + // Do something. + ExplainResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Explain_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplain.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplain.java new file mode 100644 index 000000000000..410b0798d0d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Explain_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ExplainRequest; +import com.google.cloud.aiplatform.v1.ExplainResponse; +import com.google.cloud.aiplatform.v1.ExplanationSpecOverride; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class SyncExplain { + + public static void main(String[] args) throws Exception { + syncExplain(); + } + + public static void syncExplain() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ExplainRequest request = + ExplainRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .setExplanationSpecOverride(ExplanationSpecOverride.newBuilder().build()) + .setDeployedModelId("deployedModelId-1817547906") + .build(); + ExplainResponse response = predictionServiceClient.explain(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Explain_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java new file mode 100644 index 000000000000..9fb25958238e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Explain_EndpointnameListvalueValueString_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ExplainResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncExplainEndpointnameListvalueValueString { + + public static void main(String[] args) throws Exception { + syncExplainEndpointnameListvalueValueString(); + } + + public static void syncExplainEndpointnameListvalueValueString() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + String deployedModelId = "deployedModelId-1817547906"; + ExplainResponse response = + predictionServiceClient.explain(endpoint, instances, parameters, deployedModelId); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Explain_EndpointnameListvalueValueString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainStringListvalueValueString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainStringListvalueValueString.java new file mode 100644 index 000000000000..ec29bd821a0f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/explain/SyncExplainStringListvalueValueString.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Explain_StringListvalueValueString_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ExplainResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncExplainStringListvalueValueString { + + public static void main(String[] args) throws Exception { + syncExplainStringListvalueValueString(); + } + + public static void syncExplainStringListvalueValueString() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + String deployedModelId = "deployedModelId-1817547906"; + ExplainResponse response = + predictionServiceClient.explain(endpoint, instances, parameters, deployedModelId); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Explain_StringListvalueValueString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..fab829d56f38 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..bb7c924688ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = predictionServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..1c44aacbd405 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + predictionServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..0302401ccbe9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = predictionServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..2e7819b1f733 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + predictionServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PredictionService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..f58ea5739a79 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + predictionServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_PredictionService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..8714c29c6782 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : predictionServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_PredictionService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/AsyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/AsyncPredict.java new file mode 100644 index 000000000000..b908bf917158 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/AsyncPredict.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Predict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictRequest; +import com.google.cloud.aiplatform.v1.PredictResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class AsyncPredict { + + public static void main(String[] args) throws Exception { + asyncPredict(); + } + + public static void asyncPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + PredictRequest request = + PredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .build(); + ApiFuture future = + predictionServiceClient.predictCallable().futureCall(request); + // Do something. + PredictResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Predict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredict.java new file mode 100644 index 000000000000..ae853240acae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredict.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Predict_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictRequest; +import com.google.cloud.aiplatform.v1.PredictResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + PredictRequest request = + PredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .build(); + PredictResponse response = predictionServiceClient.predict(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java new file mode 100644 index 000000000000..6997ac9501cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Predict_EndpointnameListvalueValue_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncPredictEndpointnameListvalueValue { + + public static void main(String[] args) throws Exception { + syncPredictEndpointnameListvalueValue(); + } + + public static void syncPredictEndpointnameListvalueValue() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + PredictResponse response = predictionServiceClient.predict(endpoint, instances, parameters); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Predict_EndpointnameListvalueValue_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictStringListvalueValue.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictStringListvalueValue.java new file mode 100644 index 000000000000..ac285b09f55e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/predict/SyncPredictStringListvalueValue.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_Predict_StringListvalueValue_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictResponse; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncPredictStringListvalueValue { + + public static void main(String[] args) throws Exception { + syncPredictStringListvalueValue(); + } + + public static void syncPredictStringListvalueValue() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + PredictResponse response = predictionServiceClient.predict(endpoint, instances, parameters); + } + } +} +// [END aiplatform_v1_generated_PredictionService_Predict_StringListvalueValue_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/AsyncRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/AsyncRawPredict.java new file mode 100644 index 000000000000..475abcbbefc2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/AsyncRawPredict.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_RawPredict_async] +import com.google.api.HttpBody; +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.RawPredictRequest; + +public class AsyncRawPredict { + + public static void main(String[] args) throws Exception { + asyncRawPredict(); + } + + public static void asyncRawPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + RawPredictRequest request = + RawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setHttpBody(HttpBody.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.rawPredictCallable().futureCall(request); + // Do something. + HttpBody response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_RawPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredict.java new file mode 100644 index 000000000000..e2632d820f70 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredict.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_RawPredict_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.RawPredictRequest; + +public class SyncRawPredict { + + public static void main(String[] args) throws Exception { + syncRawPredict(); + } + + public static void syncRawPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + RawPredictRequest request = + RawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setHttpBody(HttpBody.newBuilder().build()) + .build(); + HttpBody response = predictionServiceClient.rawPredict(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_RawPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java new file mode 100644 index 000000000000..130fc5274119 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_RawPredict_EndpointnameHttpbody_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; + +public class SyncRawPredictEndpointnameHttpbody { + + public static void main(String[] args) throws Exception { + syncRawPredictEndpointnameHttpbody(); + } + + public static void syncRawPredictEndpointnameHttpbody() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + HttpBody httpBody = HttpBody.newBuilder().build(); + HttpBody response = predictionServiceClient.rawPredict(endpoint, httpBody); + } + } +} +// [END aiplatform_v1_generated_PredictionService_RawPredict_EndpointnameHttpbody_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java new file mode 100644 index 000000000000..181b590f149d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_RawPredict_StringHttpbody_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; + +public class SyncRawPredictStringHttpbody { + + public static void main(String[] args) throws Exception { + syncRawPredictStringHttpbody(); + } + + public static void syncRawPredictStringHttpbody() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + HttpBody httpBody = HttpBody.newBuilder().build(); + HttpBody response = predictionServiceClient.rawPredict(endpoint, httpBody); + } + } +} +// [END aiplatform_v1_generated_PredictionService_RawPredict_StringHttpbody_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java new file mode 100644 index 000000000000..d12f56acf52f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_ServerStreamingPredict_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1.Tensor; +import java.util.ArrayList; + +public class AsyncServerStreamingPredict { + + public static void main(String[] args) throws Exception { + asyncServerStreamingPredict(); + } + + public static void asyncServerStreamingPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + ServerStream stream = + predictionServiceClient.serverStreamingPredictCallable().call(request); + for (StreamingPredictResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1_generated_PredictionService_ServerStreamingPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..7e6045023e0d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..26e30bc5e335 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = predictionServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..af08ad987287 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + predictionServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_PredictionService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..ef4ceea2a237 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = predictionServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_PredictionService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservicesettings/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservicesettings/predict/SyncPredict.java new file mode 100644 index 000000000000..25a8ad7b776e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservicesettings/predict/SyncPredict.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_PredictionServiceSettings_Predict_sync] +import com.google.cloud.aiplatform.v1.PredictionServiceSettings; +import java.time.Duration; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 + PredictionServiceSettings.Builder predictionServiceSettingsBuilder = + PredictionServiceSettings.newBuilder(); + predictionServiceSettingsBuilder + .predictSettings() + .setRetrySettings( + predictionServiceSettingsBuilder + .predictSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PredictionServiceSettings predictionServiceSettings = predictionServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_PredictionServiceSettings_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..38b5addd0c62 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1.ScheduleServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ScheduleServiceSettings scheduleServiceSettings = + ScheduleServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ScheduleServiceClient scheduleServiceClient = + ScheduleServiceClient.create(scheduleServiceSettings); + } +} +// [END aiplatform_v1_generated_ScheduleService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..40edb68e633d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1.ScheduleServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ScheduleServiceSettings scheduleServiceSettings = + ScheduleServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ScheduleServiceClient scheduleServiceClient = + ScheduleServiceClient.create(scheduleServiceSettings); + } +} +// [END aiplatform_v1_generated_ScheduleService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/AsyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/AsyncCreateSchedule.java new file mode 100644 index 000000000000..3577e2bd1204 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/AsyncCreateSchedule.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class AsyncCreateSchedule { + + public static void main(String[] args) throws Exception { + asyncCreateSchedule(); + } + + public static void asyncCreateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSchedule(Schedule.newBuilder().build()) + .build(); + ApiFuture future = + scheduleServiceClient.createScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..3792496d5b98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSchedule(Schedule.newBuilder().build()) + .build(); + Schedule response = scheduleServiceClient.createSchedule(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java new file mode 100644 index 000000000000..7685479f2646 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_LocationnameSchedule_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncCreateScheduleLocationnameSchedule { + + public static void main(String[] args) throws Exception { + syncCreateScheduleLocationnameSchedule(); + } + + public static void syncCreateScheduleLocationnameSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Schedule schedule = Schedule.newBuilder().build(); + Schedule response = scheduleServiceClient.createSchedule(parent, schedule); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_LocationnameSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java new file mode 100644 index 000000000000..8199964bd144 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_StringSchedule_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncCreateScheduleStringSchedule { + + public static void main(String[] args) throws Exception { + syncCreateScheduleStringSchedule(); + } + + public static void syncCreateScheduleStringSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Schedule schedule = Schedule.newBuilder().build(); + Schedule response = scheduleServiceClient.createSchedule(parent, schedule); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_StringSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java new file mode 100644 index 000000000000..3e3989ab138a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteSchedule { + + public static void main(String[] args) throws Exception { + asyncDeleteSchedule(); + } + + public static void asyncDeleteSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = + scheduleServiceClient.deleteScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java new file mode 100644 index 000000000000..291e996b5d2d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteScheduleLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteScheduleLRO(); + } + + public static void asyncDeleteScheduleLRO() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + OperationFuture future = + scheduleServiceClient.deleteScheduleOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteSchedule.java new file mode 100644 index 000000000000..091178b3e5ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_sync] +import com.google.cloud.aiplatform.v1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSchedule { + + public static void main(String[] args) throws Exception { + syncDeleteSchedule(); + } + + public static void syncDeleteSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + scheduleServiceClient.deleteScheduleAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java new file mode 100644 index 000000000000..2f90fe19c6a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncDeleteScheduleSchedulename(); + } + + public static void syncDeleteScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.deleteScheduleAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java new file mode 100644 index 000000000000..80618408afcb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_String_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteScheduleString { + + public static void main(String[] args) throws Exception { + syncDeleteScheduleString(); + } + + public static void syncDeleteScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.deleteScheduleAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..1d657aeccc03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = scheduleServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..7d0a7cd5aca3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = scheduleServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..10cec378a721 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = scheduleServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..95b66048f5c9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = scheduleServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/AsyncGetSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/AsyncGetSchedule.java new file mode 100644 index 000000000000..847c3114ca40 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/AsyncGetSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class AsyncGetSchedule { + + public static void main(String[] args) throws Exception { + asyncGetSchedule(); + } + + public static void asyncGetSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetScheduleRequest request = + GetScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = scheduleServiceClient.getScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetSchedule.java new file mode 100644 index 000000000000..22aef31144c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetSchedule_sync] +import com.google.cloud.aiplatform.v1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncGetSchedule { + + public static void main(String[] args) throws Exception { + syncGetSchedule(); + } + + public static void syncGetSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetScheduleRequest request = + GetScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + Schedule response = scheduleServiceClient.getSchedule(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java new file mode 100644 index 000000000000..046741a16edc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncGetScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncGetScheduleSchedulename(); + } + + public static void syncGetScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + Schedule response = scheduleServiceClient.getSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleString.java new file mode 100644 index 000000000000..15f319758096 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/getschedule/SyncGetScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_GetSchedule_String_sync] +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncGetScheduleString { + + public static void main(String[] args) throws Exception { + syncGetScheduleString(); + } + + public static void syncGetScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + Schedule response = scheduleServiceClient.getSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_GetSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..ed2db882b732 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + scheduleServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..5321498e8fe1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + scheduleServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..751d2d8665ba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : scheduleServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedules.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedules.java new file mode 100644 index 000000000000..31e9c356d47b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedules.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListSchedules_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class AsyncListSchedules { + + public static void main(String[] args) throws Exception { + asyncListSchedules(); + } + + public static void asyncListSchedules() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + scheduleServiceClient.listSchedulesPagedCallable().futureCall(request); + // Do something. + for (Schedule element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListSchedules_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedulesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedulesPaged.java new file mode 100644 index 000000000000..50cfe531a6a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/AsyncListSchedulesPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListSchedules_Paged_async] +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.ListSchedulesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.common.base.Strings; + +public class AsyncListSchedulesPaged { + + public static void main(String[] args) throws Exception { + asyncListSchedulesPaged(); + } + + public static void asyncListSchedulesPaged() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSchedulesResponse response = + scheduleServiceClient.listSchedulesCallable().call(request); + for (Schedule element : response.getSchedulesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListSchedules_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedules.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedules.java new file mode 100644 index 000000000000..948b78ba5034 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedules.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListSchedules_sync] +import com.google.cloud.aiplatform.v1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncListSchedules { + + public static void main(String[] args) throws Exception { + syncListSchedules(); + } + + public static void syncListSchedules() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + for (Schedule element : scheduleServiceClient.listSchedules(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListSchedules_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesLocationname.java new file mode 100644 index 000000000000..e12f501a5982 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListSchedules_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncListSchedulesLocationname { + + public static void main(String[] args) throws Exception { + syncListSchedulesLocationname(); + } + + public static void syncListSchedulesLocationname() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListSchedules_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesString.java new file mode 100644 index 000000000000..e2a9ef62cad0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/listschedules/SyncListSchedulesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ListSchedules_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; + +public class SyncListSchedulesString { + + public static void main(String[] args) throws Exception { + syncListSchedulesString(); + } + + public static void syncListSchedulesString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ListSchedules_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/AsyncPauseSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/AsyncPauseSchedule.java new file mode 100644 index 000000000000..d613a57b8cb0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/AsyncPauseSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_PauseSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncPauseSchedule { + + public static void main(String[] args) throws Exception { + asyncPauseSchedule(); + } + + public static void asyncPauseSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + PauseScheduleRequest request = + PauseScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = scheduleServiceClient.pauseScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_PauseSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseSchedule.java new file mode 100644 index 000000000000..63fd1adddf03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_PauseSchedule_sync] +import com.google.cloud.aiplatform.v1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseSchedule { + + public static void main(String[] args) throws Exception { + syncPauseSchedule(); + } + + public static void syncPauseSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + PauseScheduleRequest request = + PauseScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + scheduleServiceClient.pauseSchedule(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_PauseSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java new file mode 100644 index 000000000000..f1d5d15f61af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_PauseSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncPauseScheduleSchedulename(); + } + + public static void syncPauseScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.pauseSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_PauseSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleString.java new file mode 100644 index 000000000000..0bd5195e4b8e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/pauseschedule/SyncPauseScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_PauseSchedule_String_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseScheduleString { + + public static void main(String[] args) throws Exception { + syncPauseScheduleString(); + } + + public static void syncPauseScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.pauseSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_PauseSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/AsyncResumeSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/AsyncResumeSchedule.java new file mode 100644 index 000000000000..f00f59dcfdd3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/AsyncResumeSchedule.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncResumeSchedule { + + public static void main(String[] args) throws Exception { + asyncResumeSchedule(); + } + + public static void asyncResumeSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setCatchUp(true) + .build(); + ApiFuture future = scheduleServiceClient.resumeScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeSchedule.java new file mode 100644 index 000000000000..75d81941e0d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_sync] +import com.google.cloud.aiplatform.v1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeSchedule { + + public static void main(String[] args) throws Exception { + syncResumeSchedule(); + } + + public static void syncResumeSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setCatchUp(true) + .build(); + scheduleServiceClient.resumeSchedule(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java new file mode 100644 index 000000000000..f316aa653322 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncResumeScheduleSchedulename(); + } + + public static void syncResumeScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.resumeSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java new file mode 100644 index 000000000000..7a065cdcc079 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_SchedulenameBoolean_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleSchedulenameBoolean { + + public static void main(String[] args) throws Exception { + syncResumeScheduleSchedulenameBoolean(); + } + + public static void syncResumeScheduleSchedulenameBoolean() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + boolean catchUp = true; + scheduleServiceClient.resumeSchedule(name, catchUp); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_SchedulenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleString.java new file mode 100644 index 000000000000..66102997cb0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_String_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleString { + + public static void main(String[] args) throws Exception { + syncResumeScheduleString(); + } + + public static void syncResumeScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.resumeSchedule(name); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java new file mode 100644 index 000000000000..8bb957118915 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_ResumeSchedule_StringBoolean_sync] +import com.google.cloud.aiplatform.v1.ScheduleName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleStringBoolean { + + public static void main(String[] args) throws Exception { + syncResumeScheduleStringBoolean(); + } + + public static void syncResumeScheduleStringBoolean() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + boolean catchUp = true; + scheduleServiceClient.resumeSchedule(name, catchUp); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_ResumeSchedule_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..aad79a2b0739 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = scheduleServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..5e66271f3771 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = scheduleServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..6f9f6448f15c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + scheduleServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..9ecc86c56ff7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = scheduleServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/AsyncUpdateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/AsyncUpdateSchedule.java new file mode 100644 index 000000000000..5a0b5f2a3c22 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/AsyncUpdateSchedule.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_UpdateSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1.UpdateScheduleRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSchedule { + + public static void main(String[] args) throws Exception { + asyncUpdateSchedule(); + } + + public static void asyncUpdateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + UpdateScheduleRequest request = + UpdateScheduleRequest.newBuilder() + .setSchedule(Schedule.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + scheduleServiceClient.updateScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_UpdateSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateSchedule.java new file mode 100644 index 000000000000..5e9c4da4d132 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_UpdateSchedule_sync] +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1.UpdateScheduleRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSchedule { + + public static void main(String[] args) throws Exception { + syncUpdateSchedule(); + } + + public static void syncUpdateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + UpdateScheduleRequest request = + UpdateScheduleRequest.newBuilder() + .setSchedule(Schedule.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Schedule response = scheduleServiceClient.updateSchedule(request); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_UpdateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java new file mode 100644 index 000000000000..f68b47ae3fb4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleService_UpdateSchedule_ScheduleFieldmask_sync] +import com.google.cloud.aiplatform.v1.Schedule; +import com.google.cloud.aiplatform.v1.ScheduleServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateScheduleScheduleFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateScheduleScheduleFieldmask(); + } + + public static void syncUpdateScheduleScheduleFieldmask() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + Schedule schedule = Schedule.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Schedule response = scheduleServiceClient.updateSchedule(schedule, updateMask); + } + } +} +// [END aiplatform_v1_generated_ScheduleService_UpdateSchedule_ScheduleFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservicesettings/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservicesettings/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..9be45af8bcf2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/scheduleservicesettings/createschedule/SyncCreateSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_ScheduleServiceSettings_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1.ScheduleServiceSettings; +import java.time.Duration; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 + ScheduleServiceSettings.Builder scheduleServiceSettingsBuilder = + ScheduleServiceSettings.newBuilder(); + scheduleServiceSettingsBuilder + .createScheduleSettings() + .setRetrySettings( + scheduleServiceSettingsBuilder + .createScheduleSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ScheduleServiceSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ScheduleServiceSettings_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..7694612890f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + SpecialistPoolServiceSettings specialistPoolServiceSettings = + SpecialistPoolServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create(specialistPoolServiceSettings); + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..589ed2b27cfc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + SpecialistPoolServiceSettings specialistPoolServiceSettings = + SpecialistPoolServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create(specialistPoolServiceSettings); + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java new file mode 100644 index 000000000000..dc0fca7d1204 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncCreateSpecialistPool(); + } + + public static void asyncCreateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.createSpecialistPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java new file mode 100644 index 000000000000..a54ae3333d19 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateSpecialistPoolOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class AsyncCreateSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateSpecialistPoolLRO(); + } + + public static void asyncCreateSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + OperationFuture future = + specialistPoolServiceClient.createSpecialistPoolOperationCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java new file mode 100644 index 000000000000..2024129b4873 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPool(); + } + + public static void syncCreateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java new file mode 100644 index 000000000000..102135fe13bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_LocationnameSpecialistpool_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPoolLocationnameSpecialistpool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPoolLocationnameSpecialistpool(); + } + + public static void syncCreateSpecialistPoolLocationnameSpecialistpool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(parent, specialistPool).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_LocationnameSpecialistpool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java new file mode 100644 index 000000000000..b0876db421cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_StringSpecialistpool_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPoolStringSpecialistpool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPoolStringSpecialistpool(); + } + + public static void syncCreateSpecialistPoolStringSpecialistpool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(parent, specialistPool).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_CreateSpecialistPool_StringSpecialistpool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java new file mode 100644 index 000000000000..80afde4f9aad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncDeleteSpecialistPool(); + } + + public static void asyncDeleteSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + ApiFuture future = + specialistPoolServiceClient.deleteSpecialistPoolCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java new file mode 100644 index 000000000000..faaecdf99f07 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSpecialistPoolLRO(); + } + + public static void asyncDeleteSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + OperationFuture future = + specialistPoolServiceClient.deleteSpecialistPoolOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java new file mode 100644 index 000000000000..608ed287d2f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPool { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPool(); + } + + public static void syncDeleteSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + specialistPoolServiceClient.deleteSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java new file mode 100644 index 000000000000..958e940b367e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_Specialistpoolname_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPoolSpecialistpoolname { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPoolSpecialistpoolname(); + } + + public static void syncDeleteSpecialistPoolSpecialistpoolname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPoolName name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"); + specialistPoolServiceClient.deleteSpecialistPoolAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_Specialistpoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java new file mode 100644 index 000000000000..3b28b67360fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_String_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPoolString { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPoolString(); + } + + public static void syncDeleteSpecialistPoolString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString(); + specialistPoolServiceClient.deleteSpecialistPoolAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_DeleteSpecialistPool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..faca11d5686d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..64508f3f6959 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = specialistPoolServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..d8bfc6746336 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + specialistPoolServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..d9fd3de26acc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = specialistPoolServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java new file mode 100644 index 000000000000..72e1790a7211 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class AsyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncGetSpecialistPool(); + } + + public static void asyncGetSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetSpecialistPoolRequest request = + GetSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .build(); + ApiFuture future = + specialistPoolServiceClient.getSpecialistPoolCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..d18de679922b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.GetSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetSpecialistPoolRequest request = + GetSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .build(); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(request); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java new file mode 100644 index 000000000000..0891068008ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_Specialistpoolname_sync] +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPoolSpecialistpoolname { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPoolSpecialistpoolname(); + } + + public static void syncGetSpecialistPoolSpecialistpoolname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPoolName name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(name); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_Specialistpoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java new file mode 100644 index 000000000000..067e028addc1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_String_sync] +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPoolString { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPoolString(); + } + + public static void syncGetSpecialistPoolString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString(); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(name); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..e59747cc4356 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + specialistPoolServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..907fa118438f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + specialistPoolServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..969c987959bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listlocations/SyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : specialistPoolServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java new file mode 100644 index 000000000000..f8b40a2a3ded --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListSpecialistPools { + + public static void main(String[] args) throws Exception { + asyncListSpecialistPools(); + } + + public static void asyncListSpecialistPools() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.listSpecialistPoolsPagedCallable().futureCall(request); + // Do something. + for (SpecialistPool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java new file mode 100644 index 000000000000..e1ca956d02fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_Paged_async] +import com.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1.ListSpecialistPoolsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListSpecialistPoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListSpecialistPoolsPaged(); + } + + public static void asyncListSpecialistPoolsPaged() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListSpecialistPoolsResponse response = + specialistPoolServiceClient.listSpecialistPoolsCallable().call(request); + for (SpecialistPool element : response.getSpecialistPoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java new file mode 100644 index 000000000000..4e51a8b21302 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_sync] +import com.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListSpecialistPools { + + public static void main(String[] args) throws Exception { + syncListSpecialistPools(); + } + + public static void syncListSpecialistPools() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java new file mode 100644 index 000000000000..d833cbc6b1b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncListSpecialistPoolsLocationname { + + public static void main(String[] args) throws Exception { + syncListSpecialistPoolsLocationname(); + } + + public static void syncListSpecialistPoolsLocationname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java new file mode 100644 index 000000000000..98e21c349a67 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; + +public class SyncListSpecialistPoolsString { + + public static void main(String[] args) throws Exception { + syncListSpecialistPoolsString(); + } + + public static void syncListSpecialistPoolsString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_ListSpecialistPools_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..01859b8ac993 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..198d92d957e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = specialistPoolServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..81f4471d9603 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + specialistPoolServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..5f411f9b905f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = specialistPoolServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java new file mode 100644 index 000000000000..5828ed6fbe82 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncUpdateSpecialistPool(); + } + + public static void asyncUpdateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.updateSpecialistPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java new file mode 100644 index 000000000000..2276f4fc13e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.UpdateSpecialistPoolOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateSpecialistPoolLRO(); + } + + public static void asyncUpdateSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + specialistPoolServiceClient.updateSpecialistPoolOperationCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java new file mode 100644 index 000000000000..40485d7ef921 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpecialistPool { + + public static void main(String[] args) throws Exception { + syncUpdateSpecialistPool(); + } + + public static void syncUpdateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + SpecialistPool response = + specialistPoolServiceClient.updateSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java new file mode 100644 index 000000000000..2f7cb43196e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_SpecialistpoolFieldmask_sync] +import com.google.cloud.aiplatform.v1.SpecialistPool; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpecialistPoolSpecialistpoolFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSpecialistPoolSpecialistpoolFieldmask(); + } + + public static void syncUpdateSpecialistPoolSpecialistpoolFieldmask() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.updateSpecialistPoolAsync(specialistPool, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_SpecialistPoolService_UpdateSpecialistPool_SpecialistpoolFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..86b4ec0e9333 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_SpecialistPoolServiceSettings_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceSettings; +import java.time.Duration; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 + SpecialistPoolServiceSettings.Builder specialistPoolServiceSettingsBuilder = + SpecialistPoolServiceSettings.newBuilder(); + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings( + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpecialistPoolServiceSettings specialistPoolServiceSettings = + specialistPoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_SpecialistPoolServiceSettings_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..178d7f02858d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_DatasetServiceStubSettings_GetDataset_sync] +import com.google.cloud.aiplatform.v1.stub.DatasetServiceStubSettings; +import java.time.Duration; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 + DatasetServiceStubSettings.Builder datasetServiceSettingsBuilder = + DatasetServiceStubSettings.newBuilder(); + datasetServiceSettingsBuilder + .getDatasetSettings() + .setRetrySettings( + datasetServiceSettingsBuilder + .getDatasetSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatasetServiceStubSettings datasetServiceSettings = datasetServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_DatasetServiceStubSettings_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..d8d78400bc44 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_EndpointServiceStubSettings_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1.stub.EndpointServiceStubSettings; +import java.time.Duration; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 + EndpointServiceStubSettings.Builder endpointServiceSettingsBuilder = + EndpointServiceStubSettings.newBuilder(); + endpointServiceSettingsBuilder + .getEndpointSettings() + .setRetrySettings( + endpointServiceSettingsBuilder + .getEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EndpointServiceStubSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_EndpointServiceStubSettings_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..0eeb86406dad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingServiceStubSettings_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1.stub.FeaturestoreOnlineServingServiceStubSettings; +import java.time.Duration; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 + FeaturestoreOnlineServingServiceStubSettings.Builder + featurestoreOnlineServingServiceSettingsBuilder = + FeaturestoreOnlineServingServiceStubSettings.newBuilder(); + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings( + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreOnlineServingServiceStubSettings featurestoreOnlineServingServiceSettings = + featurestoreOnlineServingServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_FeaturestoreOnlineServingServiceStubSettings_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..8758a14f9258 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_FeaturestoreServiceStubSettings_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1.stub.FeaturestoreServiceStubSettings; +import java.time.Duration; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 + FeaturestoreServiceStubSettings.Builder featurestoreServiceSettingsBuilder = + FeaturestoreServiceStubSettings.newBuilder(); + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings( + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreServiceStubSettings featurestoreServiceSettings = + featurestoreServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_FeaturestoreServiceStubSettings_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..5c9f2172b562 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_IndexEndpointServiceStubSettings_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1.stub.IndexEndpointServiceStubSettings; +import java.time.Duration; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 + IndexEndpointServiceStubSettings.Builder indexEndpointServiceSettingsBuilder = + IndexEndpointServiceStubSettings.newBuilder(); + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings( + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexEndpointServiceStubSettings indexEndpointServiceSettings = + indexEndpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_IndexEndpointServiceStubSettings_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexservicestubsettings/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexservicestubsettings/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..c65dae916e5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/indexservicestubsettings/getindex/SyncGetIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_IndexServiceStubSettings_GetIndex_sync] +import com.google.cloud.aiplatform.v1.stub.IndexServiceStubSettings; +import java.time.Duration; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 + IndexServiceStubSettings.Builder indexServiceSettingsBuilder = + IndexServiceStubSettings.newBuilder(); + indexServiceSettingsBuilder + .getIndexSettings() + .setRetrySettings( + indexServiceSettingsBuilder + .getIndexSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexServiceStubSettings indexServiceSettings = indexServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_IndexServiceStubSettings_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..97462cc5adf0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_JobServiceStubSettings_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1.stub.JobServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 + JobServiceStubSettings.Builder jobServiceSettingsBuilder = JobServiceStubSettings.newBuilder(); + jobServiceSettingsBuilder + .createCustomJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder + .createCustomJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceStubSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_JobServiceStubSettings_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..cfae0a19b355 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_MatchServiceStubSettings_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1.stub.MatchServiceStubSettings; +import java.time.Duration; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 + MatchServiceStubSettings.Builder matchServiceSettingsBuilder = + MatchServiceStubSettings.newBuilder(); + matchServiceSettingsBuilder + .findNeighborsSettings() + .setRetrySettings( + matchServiceSettingsBuilder + .findNeighborsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MatchServiceStubSettings matchServiceSettings = matchServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MatchServiceStubSettings_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..ea18c599033b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_MetadataServiceStubSettings_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1.stub.MetadataServiceStubSettings; +import java.time.Duration; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 + MetadataServiceStubSettings.Builder metadataServiceSettingsBuilder = + MetadataServiceStubSettings.newBuilder(); + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings( + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MetadataServiceStubSettings metadataServiceSettings = metadataServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MetadataServiceStubSettings_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..96bbc0a0923a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_MigrationServiceStubSettings_GetLocation_sync] +import com.google.cloud.aiplatform.v1.stub.MigrationServiceStubSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 + MigrationServiceStubSettings.Builder migrationServiceSettingsBuilder = + MigrationServiceStubSettings.newBuilder(); + migrationServiceSettingsBuilder + .getLocationSettings() + .setRetrySettings( + migrationServiceSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MigrationServiceStubSettings migrationServiceSettings = migrationServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_MigrationServiceStubSettings_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..0a989f5fb71a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_ModelGardenServiceStubSettings_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1.stub.ModelGardenServiceStubSettings; +import java.time.Duration; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 + ModelGardenServiceStubSettings.Builder modelGardenServiceSettingsBuilder = + ModelGardenServiceStubSettings.newBuilder(); + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .setRetrySettings( + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelGardenServiceStubSettings modelGardenServiceSettings = + modelGardenServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ModelGardenServiceStubSettings_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelservicestubsettings/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelservicestubsettings/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..95d23f2ce56d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/modelservicestubsettings/getmodel/SyncGetModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_ModelServiceStubSettings_GetModel_sync] +import com.google.cloud.aiplatform.v1.stub.ModelServiceStubSettings; +import java.time.Duration; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 + ModelServiceStubSettings.Builder modelServiceSettingsBuilder = + ModelServiceStubSettings.newBuilder(); + modelServiceSettingsBuilder + .getModelSettings() + .setRetrySettings( + modelServiceSettingsBuilder + .getModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelServiceStubSettings modelServiceSettings = modelServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ModelServiceStubSettings_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..9f3bb09aabf0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_PipelineServiceStubSettings_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1.stub.PipelineServiceStubSettings; +import java.time.Duration; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 + PipelineServiceStubSettings.Builder pipelineServiceSettingsBuilder = + PipelineServiceStubSettings.newBuilder(); + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings( + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PipelineServiceStubSettings pipelineServiceSettings = pipelineServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_PipelineServiceStubSettings_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/predictionservicestubsettings/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/predictionservicestubsettings/predict/SyncPredict.java new file mode 100644 index 000000000000..503f1a42939c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/predictionservicestubsettings/predict/SyncPredict.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_PredictionServiceStubSettings_Predict_sync] +import com.google.cloud.aiplatform.v1.stub.PredictionServiceStubSettings; +import java.time.Duration; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 + PredictionServiceStubSettings.Builder predictionServiceSettingsBuilder = + PredictionServiceStubSettings.newBuilder(); + predictionServiceSettingsBuilder + .predictSettings() + .setRetrySettings( + predictionServiceSettingsBuilder + .predictSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PredictionServiceStubSettings predictionServiceSettings = + predictionServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_PredictionServiceStubSettings_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..bdfdf3faa001 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_ScheduleServiceStubSettings_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1.stub.ScheduleServiceStubSettings; +import java.time.Duration; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 + ScheduleServiceStubSettings.Builder scheduleServiceSettingsBuilder = + ScheduleServiceStubSettings.newBuilder(); + scheduleServiceSettingsBuilder + .createScheduleSettings() + .setRetrySettings( + scheduleServiceSettingsBuilder + .createScheduleSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ScheduleServiceStubSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_ScheduleServiceStubSettings_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..815d26076cfe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_SpecialistPoolServiceStubSettings_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1.stub.SpecialistPoolServiceStubSettings; +import java.time.Duration; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 + SpecialistPoolServiceStubSettings.Builder specialistPoolServiceSettingsBuilder = + SpecialistPoolServiceStubSettings.newBuilder(); + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings( + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpecialistPoolServiceStubSettings specialistPoolServiceSettings = + specialistPoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_SpecialistPoolServiceStubSettings_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..1eb13a2424e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_TensorboardServiceStubSettings_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1.stub.TensorboardServiceStubSettings; +import java.time.Duration; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 + TensorboardServiceStubSettings.Builder tensorboardServiceSettingsBuilder = + TensorboardServiceStubSettings.newBuilder(); + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .setRetrySettings( + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TensorboardServiceStubSettings tensorboardServiceSettings = + tensorboardServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_TensorboardServiceStubSettings_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..0a892b464d81 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.stub.samples; + +// [START aiplatform_v1_generated_VizierServiceStubSettings_CreateStudy_sync] +import com.google.cloud.aiplatform.v1.stub.VizierServiceStubSettings; +import java.time.Duration; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 + VizierServiceStubSettings.Builder vizierServiceSettingsBuilder = + VizierServiceStubSettings.newBuilder(); + vizierServiceSettingsBuilder + .createStudySettings() + .setRetrySettings( + vizierServiceSettingsBuilder + .createStudySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + VizierServiceStubSettings vizierServiceSettings = vizierServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_VizierServiceStubSettings_CreateStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java new file mode 100644 index 000000000000..b128d05cad26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateTensorboardRuns { + + public static void main(String[] args) throws Exception { + asyncBatchCreateTensorboardRuns(); + } + + public static void asyncBatchCreateTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardRunsRequest request = + BatchCreateTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchCreateTensorboardRunsCallable().futureCall(request); + // Do something. + BatchCreateTensorboardRunsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java new file mode 100644 index 000000000000..bf82e1fe8e94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateTensorboardRuns { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRuns(); + } + + public static void syncBatchCreateTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardRunsRequest request = + BatchCreateTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java new file mode 100644 index 000000000000..f34c1c033705 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_StringListcreatetensorboardrunrequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest(); + } + + public static void syncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(parent, requests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_StringListcreatetensorboardrunrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java new file mode 100644 index 000000000000..cf976ea061a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_TensorboardexperimentnameListcreatetensorboardrunrequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public +class SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest(); + } + + public static void + syncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List requests = new ArrayList<>(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(parent, requests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardRuns_TensorboardexperimentnameListcreatetensorboardrunrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..693246de0b98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncBatchCreateTensorboardTimeSeries(); + } + + public static void asyncBatchCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardTimeSeriesRequest request = + BatchCreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchCreateTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + BatchCreateTensorboardTimeSeriesResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..b47e65d6da61 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeries(); + } + + public static void syncBatchCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardTimeSeriesRequest request = + BatchCreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java new file mode 100644 index 000000000000..c2580af5f644 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_StringListcreatetensorboardtimeseriesrequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest(); + } + + public static void + syncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(parent, requests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_StringListcreatetensorboardtimeseriesrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java new file mode 100644 index 000000000000..56a37f0ca3d4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_TensorboardexperimentnameListcreatetensorboardtimeseriesrequest_sync] +import com.google.cloud.aiplatform.v1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public +class SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest(); + } + + public static void + syncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List requests = new ArrayList<>(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(parent, requests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_TensorboardexperimentnameListcreatetensorboardtimeseriesrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..d15498c76b12 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncBatchReadTensorboardTimeSeriesData(); + } + + public static void asyncBatchReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchReadTensorboardTimeSeriesDataRequest request = + BatchReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .addAllTimeSeries(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchReadTensorboardTimeSeriesDataCallable().futureCall(request); + // Do something. + BatchReadTensorboardTimeSeriesDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..63a8ad18be7a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesData(); + } + + public static void syncBatchReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchReadTensorboardTimeSeriesDataRequest request = + BatchReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .addAllTimeSeries(new ArrayList()) + .build(); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..1ed3389970ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncBatchReadTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesDataString(); + } + + public static void syncBatchReadTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboard = + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(tensorboard); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java new file mode 100644 index 000000000000..d4d40ad3b846 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncBatchReadTensorboardTimeSeriesDataTensorboardname { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesDataTensorboardname(); + } + + public static void syncBatchReadTensorboardTimeSeriesDataTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName tensorboard = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(tensorboard); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..3ebf3fbabe20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + TensorboardServiceSettings tensorboardServiceSettings = + TensorboardServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TensorboardServiceClient tensorboardServiceClient = + TensorboardServiceClient.create(tensorboardServiceSettings); + } +} +// [END aiplatform_v1_generated_TensorboardService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a598b62f35c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + TensorboardServiceSettings tensorboardServiceSettings = + TensorboardServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + TensorboardServiceClient tensorboardServiceClient = + TensorboardServiceClient.create(tensorboardServiceSettings); + } +} +// [END aiplatform_v1_generated_TensorboardService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java new file mode 100644 index 000000000000..d8f14b1a44f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateTensorboard { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboard(); + } + + public static void asyncCreateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java new file mode 100644 index 000000000000..93dfa5a3e819 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CreateTensorboardOperationMetadata; +import com.google.cloud.aiplatform.v1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncCreateTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardLRO(); + } + + public static void asyncCreateTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + OperationFuture future = + tensorboardServiceClient.createTensorboardOperationCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java new file mode 100644 index 000000000000..6d5b187a16f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboard_sync] +import com.google.cloud.aiplatform.v1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboard(); + } + + public static void syncCreateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + Tensorboard response = tensorboardServiceClient.createTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java new file mode 100644 index 000000000000..8f4c35942dff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboard_StringTensorboard_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardStringTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardStringTensorboard(); + } + + public static void syncCreateTensorboardStringTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.createTensorboardAsync(parent, tensorboard).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboard_StringTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java new file mode 100644 index 000000000000..8cbb78968b5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboard_TensorboardnameTensorboard_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardTensorboardnameTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTensorboardnameTensorboard(); + } + + public static void syncCreateTensorboardTensorboardnameTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.createTensorboardAsync(parent, tensorboard).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboard_TensorboardnameTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java new file mode 100644 index 000000000000..505e3da519dc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncCreateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardExperiment(); + } + + public static void asyncCreateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardExperimentRequest request = + CreateTensorboardExperimentRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .setTensorboardExperimentId("tensorboardExperimentId1267328197") + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java new file mode 100644 index 000000000000..3cc604d548c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1.CreateTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperiment(); + } + + public static void syncCreateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardExperimentRequest request = + CreateTensorboardExperimentRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .setTensorboardExperimentId("tensorboardExperimentId1267328197") + .build(); + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java new file mode 100644 index 000000000000..425846bdee6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_StringTensorboardexperimentString_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperimentStringTensorboardexperimentString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperimentStringTensorboardexperimentString(); + } + + public static void syncCreateTensorboardExperimentStringTensorboardexperimentString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + String tensorboardExperimentId = "tensorboardExperimentId1267328197"; + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment( + parent, tensorboardExperiment, tensorboardExperimentId); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_StringTensorboardexperimentString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java new file mode 100644 index 000000000000..88888d6f5c33 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_TensorboardexperimentnameTensorboardexperimentString_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString(); + } + + public static void + syncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + String tensorboardExperimentId = "tensorboardExperimentId1267328197"; + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment( + parent, tensorboardExperiment, tensorboardExperimentId); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardExperiment_TensorboardexperimentnameTensorboardexperimentString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java new file mode 100644 index 000000000000..f8d39e45a94c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncCreateTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardRun(); + } + + public static void asyncCreateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRunRequest request = + CreateTensorboardRunRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .setTensorboardRunId("tensorboardRunId-407822631") + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java new file mode 100644 index 000000000000..9743e06e95e9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_sync] +import com.google.cloud.aiplatform.v1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardRun { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRun(); + } + + public static void syncCreateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRunRequest request = + CreateTensorboardRunRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .setTensorboardRunId("tensorboardRunId-407822631") + .build(); + TensorboardRun response = tensorboardServiceClient.createTensorboardRun(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java new file mode 100644 index 000000000000..ddfe52858155 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_StringTensorboardrunString_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardRunStringTensorboardrunString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRunStringTensorboardrunString(); + } + + public static void syncCreateTensorboardRunStringTensorboardrunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + String tensorboardRunId = "tensorboardRunId-407822631"; + TensorboardRun response = + tensorboardServiceClient.createTensorboardRun(parent, tensorboardRun, tensorboardRunId); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_StringTensorboardrunString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java new file mode 100644 index 000000000000..06a0ca1a8009 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_TensorboardrunnameTensorboardrunString_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRunTensorboardrunnameTensorboardrunString(); + } + + public static void syncCreateTensorboardRunTensorboardrunnameTensorboardrunString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName parent = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + String tensorboardRunId = "tensorboardRunId-407822631"; + TensorboardRun response = + tensorboardServiceClient.createTensorboardRun(parent, tensorboardRun, tensorboardRunId); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardRun_TensorboardrunnameTensorboardrunString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..3962dbe0200f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class AsyncCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardTimeSeries(); + } + + public static void asyncCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardTimeSeriesRequest request = + CreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setTensorboardTimeSeriesId("tensorboardTimeSeriesId-913380692") + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..86d01bd89958 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeries(); + } + + public static void syncCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardTimeSeriesRequest request = + CreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setTensorboardTimeSeriesId("tensorboardTimeSeriesId-913380692") + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java new file mode 100644 index 000000000000..bba73db9ea42 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_StringTensorboardtimeseries_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeriesStringTensorboardtimeseries(); + } + + public static void syncCreateTensorboardTimeSeriesStringTensorboardtimeseries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(parent, tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_StringTensorboardtimeseries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java new file mode 100644 index 000000000000..9dc32cb99eba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_TensorboardtimeseriesnameTensorboardtimeseries_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries(); + } + + public static void syncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName parent = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(parent, tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_CreateTensorboardTimeSeries_TensorboardtimeseriesnameTensorboardtimeseries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java new file mode 100644 index 000000000000..c401c03c0097 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboard { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboard(); + } + + public static void asyncDeleteTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java new file mode 100644 index 000000000000..81283f9f133f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardLRO(); + } + + public static void asyncDeleteTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + OperationFuture future = + tensorboardServiceClient.deleteTensorboardOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java new file mode 100644 index 000000000000..5fbed6c3fd6f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboard_sync] +import com.google.cloud.aiplatform.v1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboard { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboard(); + } + + public static void syncDeleteTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + tensorboardServiceClient.deleteTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java new file mode 100644 index 000000000000..9c2db909259a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboard_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardString(); + } + + public static void syncDeleteTensorboardString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + tensorboardServiceClient.deleteTensorboardAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboard_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java new file mode 100644 index 000000000000..8c41e66fe575 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboard_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTensorboardname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTensorboardname(); + } + + public static void syncDeleteTensorboardTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + tensorboardServiceClient.deleteTensorboardAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboard_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java new file mode 100644 index 000000000000..3aeb1c8a4e7b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardExperiment(); + } + + public static void asyncDeleteTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardExperimentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java new file mode 100644 index 000000000000..7d5ea92e01fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardExperimentLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardExperimentLRO(); + } + + public static void asyncDeleteTensorboardExperimentLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient + .deleteTensorboardExperimentOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java new file mode 100644 index 000000000000..08dbe29bc4bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperiment(); + } + + public static void syncDeleteTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardExperimentAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java new file mode 100644 index 000000000000..4b294f11b496 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperimentString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperimentString(); + } + + public static void syncDeleteTensorboardExperimentString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + tensorboardServiceClient.deleteTensorboardExperimentAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java new file mode 100644 index 000000000000..e26a9eaf73bf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperimentTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperimentTensorboardexperimentname(); + } + + public static void syncDeleteTensorboardExperimentTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + tensorboardServiceClient.deleteTensorboardExperimentAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardExperiment_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java new file mode 100644 index 000000000000..365464dc5cca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardRun(); + } + + public static void asyncDeleteTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardRunCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java new file mode 100644 index 000000000000..4ee455282601 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardRunLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardRunLRO(); + } + + public static void asyncDeleteTensorboardRunLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient.deleteTensorboardRunOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java new file mode 100644 index 000000000000..da662d029d62 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_sync] +import com.google.cloud.aiplatform.v1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRun { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRun(); + } + + public static void syncDeleteTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardRunAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java new file mode 100644 index 000000000000..54606b04c844 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRunString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRunString(); + } + + public static void syncDeleteTensorboardRunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + tensorboardServiceClient.deleteTensorboardRunAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java new file mode 100644 index 000000000000..b92ae3dcb68a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRunTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRunTensorboardrunname(); + } + + public static void syncDeleteTensorboardRunTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName name = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + tensorboardServiceClient.deleteTensorboardRunAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardRun_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java new file mode 100644 index 000000000000..027a96f57e5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardTimeSeries(); + } + + public static void asyncDeleteTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java new file mode 100644 index 000000000000..3c679cf4cd09 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardTimeSeriesLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardTimeSeriesLRO(); + } + + public static void asyncDeleteTensorboardTimeSeriesLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient + .deleteTensorboardTimeSeriesOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java new file mode 100644 index 000000000000..d87b13c29391 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeries(); + } + + public static void syncDeleteTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..9db3b6acfa36 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeriesString(); + } + + public static void syncDeleteTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java new file mode 100644 index 000000000000..8d90549f7b15 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeriesTensorboardtimeseriesname(); + } + + public static void syncDeleteTensorboardTimeSeriesTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName name = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(name).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_DeleteTensorboardTimeSeries_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..9f64842d0c1d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1.TimeSeriesDataPoint; + +public class AsyncExportTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncExportTensorboardTimeSeriesData(); + } + + public static void asyncExportTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tensorboardServiceClient + .exportTensorboardTimeSeriesDataPagedCallable() + .futureCall(request); + // Do something. + for (TimeSeriesDataPoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java new file mode 100644 index 000000000000..88ee9316f274 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Paged_async] +import com.google.cloud.aiplatform.v1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.ExportTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1.TimeSeriesDataPoint; +import com.google.common.base.Strings; + +public class AsyncExportTensorboardTimeSeriesDataPaged { + + public static void main(String[] args) throws Exception { + asyncExportTensorboardTimeSeriesDataPaged(); + } + + public static void asyncExportTensorboardTimeSeriesDataPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ExportTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.exportTensorboardTimeSeriesDataCallable().call(request); + for (TimeSeriesDataPoint element : response.getTimeSeriesDataPointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..bf76b8436a78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesData(); + } + + public static void syncExportTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + for (TimeSeriesDataPoint element : + tensorboardServiceClient.exportTensorboardTimeSeriesData(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..c695c2235179 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesDataString(); + } + + public static void syncExportTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + for (TimeSeriesDataPoint element : + tensorboardServiceClient + .exportTensorboardTimeSeriesData(tensorboardTimeSeries) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java new file mode 100644 index 000000000000..0a417b284338 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesDataTensorboardtimeseriesname(); + } + + public static void syncExportTensorboardTimeSeriesDataTensorboardtimeseriesname() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + for (TimeSeriesDataPoint element : + tensorboardServiceClient + .exportTensorboardTimeSeriesData(tensorboardTimeSeries) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..88f51f8b5633 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..c760cde201f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = tensorboardServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..5f97a319d7b8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + tensorboardServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..2de346c7c6ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = tensorboardServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java new file mode 100644 index 000000000000..8329d93a263b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTensorboardRequest; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncGetTensorboard { + + public static void main(String[] args) throws Exception { + asyncGetTensorboard(); + } + + public static void asyncGetTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRequest request = + GetTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..4f3372e79610 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1.GetTensorboardRequest; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRequest request = + GetTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + Tensorboard response = tensorboardServiceClient.getTensorboard(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java new file mode 100644 index 000000000000..3827dfcf20b0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboard_String_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardString(); + } + + public static void syncGetTensorboardString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + Tensorboard response = tensorboardServiceClient.getTensorboard(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboard_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java new file mode 100644 index 000000000000..a196b06fc2fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboard_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardTensorboardname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTensorboardname(); + } + + public static void syncGetTensorboardTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + Tensorboard response = tensorboardServiceClient.getTensorboard(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboard_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java new file mode 100644 index 000000000000..ac59ecd06a06 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncGetTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardExperiment(); + } + + public static void asyncGetTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardExperimentRequest request = + GetTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java new file mode 100644 index 000000000000..9ab76648210d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1.GetTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperiment(); + } + + public static void syncGetTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardExperimentRequest request = + GetTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java new file mode 100644 index 000000000000..3b7fb8202a02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardExperimentString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperimentString(); + } + + public static void syncGetTensorboardExperimentString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java new file mode 100644 index 000000000000..72af11ddf32c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardExperimentTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperimentTensorboardexperimentname(); + } + + public static void syncGetTensorboardExperimentTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java new file mode 100644 index 000000000000..e90bac46823f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncGetTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardRun(); + } + + public static void asyncGetTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRunRequest request = + GetTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java new file mode 100644 index 000000000000..438ada6f621e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardRun_sync] +import com.google.cloud.aiplatform.v1.GetTensorboardRunRequest; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardRun { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRun(); + } + + public static void syncGetTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRunRequest request = + GetTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java new file mode 100644 index 000000000000..c39599e41a96 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardRun_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardRunString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRunString(); + } + + public static void syncGetTensorboardRunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardRun_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java new file mode 100644 index 000000000000..b863b3318cb6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardRun_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncGetTensorboardRunTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRunTensorboardrunname(); + } + + public static void syncGetTensorboardRunTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName name = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardRun_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java new file mode 100644 index 000000000000..2efaafea02ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class AsyncGetTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardTimeSeries(); + } + + public static void asyncGetTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardTimeSeriesRequest request = + GetTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java new file mode 100644 index 000000000000..c2d7bb360764 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.GetTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeries(); + } + + public static void syncGetTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardTimeSeriesRequest request = + GetTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..a0655bd5b4e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeriesString(); + } + + public static void syncGetTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java new file mode 100644 index 000000000000..0719a517db59 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeriesTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeriesTensorboardtimeseriesname(); + } + + public static void syncGetTensorboardTimeSeriesTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName name = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(name); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_GetTensorboardTimeSeries_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..689f68756295 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + tensorboardServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..c34820b4c194 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + tensorboardServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..5ee1e70c3eea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : tensorboardServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java new file mode 100644 index 000000000000..426c429a95a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardExperiments { + + public static void main(String[] args) throws Exception { + asyncListTensorboardExperiments(); + } + + public static void asyncListTensorboardExperiments() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardExperimentsPagedCallable().futureCall(request); + // Do something. + for (TensorboardExperiment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java new file mode 100644 index 000000000000..fe5642123253 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_Paged_async] +import com.google.cloud.aiplatform.v1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1.ListTensorboardExperimentsResponse; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardExperimentsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardExperimentsPaged(); + } + + public static void asyncListTensorboardExperimentsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardExperimentsResponse response = + tensorboardServiceClient.listTensorboardExperimentsCallable().call(request); + for (TensorboardExperiment element : response.getTensorboardExperimentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java new file mode 100644 index 000000000000..9e90534fac1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_sync] +import com.google.cloud.aiplatform.v1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardExperiments { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperiments(); + } + + public static void syncListTensorboardExperiments() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java new file mode 100644 index 000000000000..daefff7f7d38 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardExperimentsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperimentsString(); + } + + public static void syncListTensorboardExperimentsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java new file mode 100644 index 000000000000..91a698f265b2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardExperimentsTensorboardname { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperimentsTensorboardname(); + } + + public static void syncListTensorboardExperimentsTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardExperiments_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java new file mode 100644 index 000000000000..03a1b6d97df5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardRuns { + + public static void main(String[] args) throws Exception { + asyncListTensorboardRuns(); + } + + public static void asyncListTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardRunsPagedCallable().futureCall(request); + // Do something. + for (TensorboardRun element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java new file mode 100644 index 000000000000..8d80ee835b03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_Paged_async] +import com.google.cloud.aiplatform.v1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1.ListTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardRunsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardRunsPaged(); + } + + public static void asyncListTensorboardRunsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardRunsResponse response = + tensorboardServiceClient.listTensorboardRunsCallable().call(request); + for (TensorboardRun element : response.getTensorboardRunsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java new file mode 100644 index 000000000000..86d75e37dbd0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_sync] +import com.google.cloud.aiplatform.v1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardRuns { + + public static void main(String[] args) throws Exception { + syncListTensorboardRuns(); + } + + public static void syncListTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java new file mode 100644 index 000000000000..065da56c2532 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardRunsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardRunsString(); + } + + public static void syncListTensorboardRunsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java new file mode 100644 index 000000000000..7805e5df626e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardRunsTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncListTensorboardRunsTensorboardexperimentname(); + } + + public static void syncListTensorboardRunsTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardRuns_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboards.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboards.java new file mode 100644 index 000000000000..5a790dc78728 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboards.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboards_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboards { + + public static void main(String[] args) throws Exception { + asyncListTensorboards(); + } + + public static void asyncListTensorboards() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardsPagedCallable().futureCall(request); + // Do something. + for (Tensorboard element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboards_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java new file mode 100644 index 000000000000..ebab9433ad4c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboards_Paged_async] +import com.google.cloud.aiplatform.v1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1.ListTensorboardsResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardsPaged(); + } + + public static void asyncListTensorboardsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardsResponse response = + tensorboardServiceClient.listTensorboardsCallable().call(request); + for (Tensorboard element : response.getTensorboardsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboards_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboards.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboards.java new file mode 100644 index 000000000000..95f34b8a1140 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboards.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboards_sync] +import com.google.cloud.aiplatform.v1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboards { + + public static void main(String[] args) throws Exception { + syncListTensorboards(); + } + + public static void syncListTensorboards() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboards_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java new file mode 100644 index 000000000000..0b01836692f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboards_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardsLocationname { + + public static void main(String[] args) throws Exception { + syncListTensorboardsLocationname(); + } + + public static void syncListTensorboardsLocationname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboards_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java new file mode 100644 index 000000000000..77337c8477ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboards_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncListTensorboardsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardsString(); + } + + public static void syncListTensorboardsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboards_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java new file mode 100644 index 000000000000..237ed8702060 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncListTensorboardTimeSeries(); + } + + public static void asyncListTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardTimeSeriesPagedCallable().futureCall(request); + // Do something. + for (TensorboardTimeSeries element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java new file mode 100644 index 000000000000..f4cec08ce337 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_Paged_async] +import com.google.cloud.aiplatform.v1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.ListTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardTimeSeriesPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardTimeSeriesPaged(); + } + + public static void asyncListTensorboardTimeSeriesPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardTimeSeriesResponse response = + tensorboardServiceClient.listTensorboardTimeSeriesCallable().call(request); + for (TensorboardTimeSeries element : response.getTensorboardTimeSeriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java new file mode 100644 index 000000000000..5bc3cb20ccdb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeries(); + } + + public static void syncListTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..9211825b3f6c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; + +public class SyncListTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeriesString(); + } + + public static void syncListTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java new file mode 100644 index 000000000000..965aa29bf504 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; + +public class SyncListTensorboardTimeSeriesTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeriesTensorboardrunname(); + } + + public static void syncListTensorboardTimeSeriesTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName parent = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ListTensorboardTimeSeries_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java new file mode 100644 index 000000000000..16fc17265e71 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardBlobData_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1.ReadTensorboardBlobDataRequest; +import com.google.cloud.aiplatform.v1.ReadTensorboardBlobDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; +import java.util.ArrayList; + +public class AsyncReadTensorboardBlobData { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardBlobData(); + } + + public static void asyncReadTensorboardBlobData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardBlobDataRequest request = + ReadTensorboardBlobDataRequest.newBuilder() + .setTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .addAllBlobIds(new ArrayList()) + .build(); + ServerStream stream = + tensorboardServiceClient.readTensorboardBlobDataCallable().call(request); + for (ReadTensorboardBlobDataResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardBlobData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..23ad2accb6a1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class AsyncReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardTimeSeriesData(); + } + + public static void asyncReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardTimeSeriesDataRequest request = + ReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setMaxDataPoints(724001981) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + tensorboardServiceClient.readTensorboardTimeSeriesDataCallable().futureCall(request); + // Do something. + ReadTensorboardTimeSeriesDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..fbe8a84e8229 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesData(); + } + + public static void syncReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardTimeSeriesDataRequest request = + ReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setMaxDataPoints(724001981) + .setFilter("filter-1274492040") + .build(); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..f13fe23dd3bf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesDataString(); + } + + public static void syncReadTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java new file mode 100644 index 000000000000..e0abf5a930b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesDataTensorboardtimeseriesname(); + } + + public static void syncReadTensorboardTimeSeriesDataTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java new file mode 100644 index 000000000000..e41bbfc9ef7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageRequest; +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class AsyncReadTensorboardUsage { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardUsage(); + } + + public static void asyncReadTensorboardUsage() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardUsageRequest request = + ReadTensorboardUsageRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.readTensorboardUsageCallable().futureCall(request); + // Do something. + ReadTensorboardUsageResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java new file mode 100644 index 000000000000..10480a820e12 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageRequest; +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncReadTensorboardUsage { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsage(); + } + + public static void syncReadTensorboardUsage() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardUsageRequest request = + ReadTensorboardUsageRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java new file mode 100644 index 000000000000..a1198128932b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_String_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncReadTensorboardUsageString { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsageString(); + } + + public static void syncReadTensorboardUsageString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboard = + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(tensorboard); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java new file mode 100644 index 000000000000..161a96da68c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1.TensorboardName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; + +public class SyncReadTensorboardUsageTensorboardname { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsageTensorboardname(); + } + + public static void syncReadTensorboardUsageTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName tensorboard = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(tensorboard); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_ReadTensorboardUsage_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..e7e906300779 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..ccbc5bba2b33 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = tensorboardServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..90ec4397bd00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..954fdf444c98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = tensorboardServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java new file mode 100644 index 000000000000..5e17bd48c940 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboard { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboard(); + } + + public static void asyncUpdateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java new file mode 100644 index 000000000000..4aa7d7ba3255 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardOperationMetadata; +import com.google.cloud.aiplatform.v1.UpdateTensorboardRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardLRO(); + } + + public static void asyncUpdateTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + OperationFuture future = + tensorboardServiceClient.updateTensorboardOperationCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java new file mode 100644 index 000000000000..294deb3bfd45 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboard_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboard { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboard(); + } + + public static void syncUpdateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + Tensorboard response = tensorboardServiceClient.updateTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java new file mode 100644 index 000000000000..b54de090f3c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboard_TensorboardFieldmask_sync] +import com.google.cloud.aiplatform.v1.Tensorboard; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTensorboardFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTensorboardFieldmask(); + } + + public static void syncUpdateTensorboardTensorboardFieldmask() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.updateTensorboardAsync(tensorboard, updateMask).get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboard_TensorboardFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java new file mode 100644 index 000000000000..8ef66633b2be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardExperimentRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardExperiment(); + } + + public static void asyncUpdateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardExperimentRequest request = + UpdateTensorboardExperimentRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java new file mode 100644 index 000000000000..c8e7f8492ca0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardExperimentRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardExperiment(); + } + + public static void syncUpdateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardExperimentRequest request = + UpdateTensorboardExperimentRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .build(); + TensorboardExperiment response = + tensorboardServiceClient.updateTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java new file mode 100644 index 000000000000..3319105095aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_TensorboardexperimentFieldmask_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardExperimentTensorboardexperimentFieldmask(); + } + + public static void syncUpdateTensorboardExperimentTensorboardexperimentFieldmask() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardExperiment response = + tensorboardServiceClient.updateTensorboardExperiment(tensorboardExperiment, updateMask); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardExperiment_TensorboardexperimentFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java new file mode 100644 index 000000000000..b9feced98869 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardRunRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardRun(); + } + + public static void asyncUpdateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRunRequest request = + UpdateTensorboardRunRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java new file mode 100644 index 000000000000..4fd8bdcbd99a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.UpdateTensorboardRunRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardRun { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardRun(); + } + + public static void syncUpdateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRunRequest request = + UpdateTensorboardRunRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .build(); + TensorboardRun response = tensorboardServiceClient.updateTensorboardRun(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java new file mode 100644 index 000000000000..290f92a85320 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_TensorboardrunFieldmask_sync] +import com.google.cloud.aiplatform.v1.TensorboardRun; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardRunTensorboardrunFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardRunTensorboardrunFieldmask(); + } + + public static void syncUpdateTensorboardRunTensorboardrunFieldmask() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardRun response = + tensorboardServiceClient.updateTensorboardRun(tensorboardRun, updateMask); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardRun_TensorboardrunFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java new file mode 100644 index 000000000000..ef9181c9a0b8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.UpdateTensorboardTimeSeriesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardTimeSeries(); + } + + public static void asyncUpdateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardTimeSeriesRequest request = + UpdateTensorboardTimeSeriesRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java new file mode 100644 index 000000000000..396354f302c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1.UpdateTensorboardTimeSeriesRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTimeSeries(); + } + + public static void syncUpdateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardTimeSeriesRequest request = + UpdateTensorboardTimeSeriesRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + TensorboardTimeSeries response = + tensorboardServiceClient.updateTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java new file mode 100644 index 000000000000..8e22f365d102 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_TensorboardtimeseriesFieldmask_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask(); + } + + public static void syncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.updateTensorboardTimeSeries(tensorboardTimeSeries, updateMask); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_UpdateTensorboardTimeSeries_TensorboardtimeseriesFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java new file mode 100644 index 000000000000..3041be6415aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataRequest; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; + +public class AsyncWriteTensorboardExperimentData { + + public static void main(String[] args) throws Exception { + asyncWriteTensorboardExperimentData(); + } + + public static void asyncWriteTensorboardExperimentData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardExperimentDataRequest request = + WriteTensorboardExperimentDataRequest.newBuilder() + .setTensorboardExperiment( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllWriteRunDataRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.writeTensorboardExperimentDataCallable().futureCall(request); + // Do something. + WriteTensorboardExperimentDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java new file mode 100644 index 000000000000..01013ce833f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataRequest; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; + +public class SyncWriteTensorboardExperimentData { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentData(); + } + + public static void syncWriteTensorboardExperimentData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardExperimentDataRequest request = + WriteTensorboardExperimentDataRequest.newBuilder() + .setTensorboardExperiment( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllWriteRunDataRequests(new ArrayList()) + .build(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java new file mode 100644 index 000000000000..cb7f09438e8b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_StringListwritetensorboardrundatarequest_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest(); + } + + public static void syncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardExperiment = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List writeRunDataRequests = new ArrayList<>(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData( + tensorboardExperiment, writeRunDataRequests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_StringListwritetensorboardrundatarequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java new file mode 100644 index 000000000000..d84f0cb8ac15 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_TensorboardexperimentnameListwritetensorboardrundatarequest_sync] +import com.google.cloud.aiplatform.v1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; +import java.util.List; + +public +class SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest(); + } + + public static void + syncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName tensorboardExperiment = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List writeRunDataRequests = new ArrayList<>(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData( + tensorboardExperiment, writeRunDataRequests); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardExperimentData_TensorboardexperimentnameListwritetensorboardrundatarequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java new file mode 100644 index 000000000000..0759cd2808f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TimeSeriesData; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; + +public class AsyncWriteTensorboardRunData { + + public static void main(String[] args) throws Exception { + asyncWriteTensorboardRunData(); + } + + public static void asyncWriteTensorboardRunData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardRunDataRequest request = + WriteTensorboardRunDataRequest.newBuilder() + .setTensorboardRun( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .addAllTimeSeriesData(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.writeTensorboardRunDataCallable().futureCall(request); + // Do something. + WriteTensorboardRunDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java new file mode 100644 index 000000000000..7013c89d3414 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TimeSeriesData; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataRequest; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; + +public class SyncWriteTensorboardRunData { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunData(); + } + + public static void syncWriteTensorboardRunData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardRunDataRequest request = + WriteTensorboardRunDataRequest.newBuilder() + .setTensorboardRun( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .addAllTimeSeriesData(new ArrayList()) + .build(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(request); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java new file mode 100644 index 000000000000..69678e59fe53 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_StringListtimeseriesdata_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TimeSeriesData; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardRunDataStringListtimeseriesdata { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunDataStringListtimeseriesdata(); + } + + public static void syncWriteTensorboardRunDataStringListtimeseriesdata() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardRun = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + List timeSeriesData = new ArrayList<>(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(tensorboardRun, timeSeriesData); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_StringListtimeseriesdata_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java new file mode 100644 index 000000000000..b341a04b020d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_TensorboardrunnameListtimeseriesdata_sync] +import com.google.cloud.aiplatform.v1.TensorboardRunName; +import com.google.cloud.aiplatform.v1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TimeSeriesData; +import com.google.cloud.aiplatform.v1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata(); + } + + public static void syncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName tensorboardRun = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + List timeSeriesData = new ArrayList<>(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(tensorboardRun, timeSeriesData); + } + } +} +// [END aiplatform_v1_generated_TensorboardService_WriteTensorboardRunData_TensorboardrunnameListtimeseriesdata_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..a01a4928ef51 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_TensorboardServiceSettings_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1.TensorboardServiceSettings; +import java.time.Duration; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 + TensorboardServiceSettings.Builder tensorboardServiceSettingsBuilder = + TensorboardServiceSettings.newBuilder(); + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .setRetrySettings( + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TensorboardServiceSettings tensorboardServiceSettings = + tensorboardServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_TensorboardServiceSettings_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java new file mode 100644 index 000000000000..dbf183868b58 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_AddTrialMeasurement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.AddTrialMeasurementRequest; +import com.google.cloud.aiplatform.v1.Measurement; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncAddTrialMeasurement { + + public static void main(String[] args) throws Exception { + asyncAddTrialMeasurement(); + } + + public static void asyncAddTrialMeasurement() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + AddTrialMeasurementRequest request = + AddTrialMeasurementRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setMeasurement(Measurement.newBuilder().build()) + .build(); + ApiFuture future = + vizierServiceClient.addTrialMeasurementCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_AddTrialMeasurement_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java new file mode 100644 index 000000000000..967d64a5636a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_AddTrialMeasurement_sync] +import com.google.cloud.aiplatform.v1.AddTrialMeasurementRequest; +import com.google.cloud.aiplatform.v1.Measurement; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncAddTrialMeasurement { + + public static void main(String[] args) throws Exception { + syncAddTrialMeasurement(); + } + + public static void syncAddTrialMeasurement() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + AddTrialMeasurementRequest request = + AddTrialMeasurementRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setMeasurement(Measurement.newBuilder().build()) + .build(); + Trial response = vizierServiceClient.addTrialMeasurement(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_AddTrialMeasurement_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java new file mode 100644 index 000000000000..0cf0d02bdcf4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCheckTrialEarlyStoppingState { + + public static void main(String[] args) throws Exception { + asyncCheckTrialEarlyStoppingState(); + } + + public static void asyncCheckTrialEarlyStoppingState() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = + vizierServiceClient.checkTrialEarlyStoppingStateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java new file mode 100644 index 000000000000..610a5b835f57 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateMetatdata; +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncCheckTrialEarlyStoppingStateLRO { + + public static void main(String[] args) throws Exception { + asyncCheckTrialEarlyStoppingStateLRO(); + } + + public static void asyncCheckTrialEarlyStoppingStateLRO() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + OperationFuture + future = + vizierServiceClient + .checkTrialEarlyStoppingStateOperationCallable() + .futureCall(request); + // Do something. + CheckTrialEarlyStoppingStateResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java new file mode 100644 index 000000000000..fa77efcf0ab7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_sync] +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCheckTrialEarlyStoppingState { + + public static void main(String[] args) throws Exception { + syncCheckTrialEarlyStoppingState(); + } + + public static void syncCheckTrialEarlyStoppingState() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + CheckTrialEarlyStoppingStateResponse response = + vizierServiceClient.checkTrialEarlyStoppingStateAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CheckTrialEarlyStoppingState_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/AsyncCompleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/AsyncCompleteTrial.java new file mode 100644 index 000000000000..ed5c28a1b666 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/AsyncCompleteTrial.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CompleteTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CompleteTrialRequest; +import com.google.cloud.aiplatform.v1.Measurement; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncCompleteTrial { + + public static void main(String[] args) throws Exception { + asyncCompleteTrial(); + } + + public static void asyncCompleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CompleteTrialRequest request = + CompleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setFinalMeasurement(Measurement.newBuilder().build()) + .setTrialInfeasible(true) + .setInfeasibleReason("infeasibleReason1040725388") + .build(); + ApiFuture future = vizierServiceClient.completeTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CompleteTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/SyncCompleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/SyncCompleteTrial.java new file mode 100644 index 000000000000..25dfd4e5a88c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/completetrial/SyncCompleteTrial.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CompleteTrial_sync] +import com.google.cloud.aiplatform.v1.CompleteTrialRequest; +import com.google.cloud.aiplatform.v1.Measurement; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCompleteTrial { + + public static void main(String[] args) throws Exception { + syncCompleteTrial(); + } + + public static void syncCompleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CompleteTrialRequest request = + CompleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setFinalMeasurement(Measurement.newBuilder().build()) + .setTrialInfeasible(true) + .setInfeasibleReason("infeasibleReason1040725388") + .build(); + Trial response = vizierServiceClient.completeTrial(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_CompleteTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..1b12741f1259 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.aiplatform.v1.VizierServiceSettings; +import com.google.cloud.aiplatform.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + VizierServiceSettings vizierServiceSettings = + VizierServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings); + } +} +// [END aiplatform_v1_generated_VizierService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..8810fffce612 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.aiplatform.v1.VizierServiceSettings; +import com.google.cloud.aiplatform.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + VizierServiceSettings vizierServiceSettings = + VizierServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings); + } +} +// [END aiplatform_v1_generated_VizierService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/AsyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/AsyncCreateStudy.java new file mode 100644 index 000000000000..003db8ca1d2a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/AsyncCreateStudy.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateStudyRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncCreateStudy { + + public static void main(String[] args) throws Exception { + asyncCreateStudy(); + } + + public static void asyncCreateStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateStudyRequest request = + CreateStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStudy(Study.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.createStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..86e84f1102db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateStudy_sync] +import com.google.cloud.aiplatform.v1.CreateStudyRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateStudyRequest request = + CreateStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStudy(Study.newBuilder().build()) + .build(); + Study response = vizierServiceClient.createStudy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java new file mode 100644 index 000000000000..f599d30685af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateStudy_LocationnameStudy_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateStudyLocationnameStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudyLocationnameStudy(); + } + + public static void syncCreateStudyLocationnameStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Study study = Study.newBuilder().build(); + Study response = vizierServiceClient.createStudy(parent, study); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateStudy_LocationnameStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyStringStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyStringStudy.java new file mode 100644 index 000000000000..97ccfc5f1c32 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createstudy/SyncCreateStudyStringStudy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateStudy_StringStudy_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateStudyStringStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudyStringStudy(); + } + + public static void syncCreateStudyStringStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Study study = Study.newBuilder().build(); + Study response = vizierServiceClient.createStudy(parent, study); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateStudy_StringStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/AsyncCreateTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/AsyncCreateTrial.java new file mode 100644 index 000000000000..0aebc1df44bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/AsyncCreateTrial.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.CreateTrialRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncCreateTrial { + + public static void main(String[] args) throws Exception { + asyncCreateTrial(); + } + + public static void asyncCreateTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateTrialRequest request = + CreateTrialRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setTrial(Trial.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.createTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrial.java new file mode 100644 index 000000000000..4c3057989d5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrial.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateTrial_sync] +import com.google.cloud.aiplatform.v1.CreateTrialRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrial(); + } + + public static void syncCreateTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateTrialRequest request = + CreateTrialRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setTrial(Trial.newBuilder().build()) + .build(); + Trial response = vizierServiceClient.createTrial(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStringTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStringTrial.java new file mode 100644 index 000000000000..56d3a51db8b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStringTrial.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateTrial_StringTrial_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateTrialStringTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrialStringTrial(); + } + + public static void syncCreateTrialStringTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + Trial trial = Trial.newBuilder().build(); + Trial response = vizierServiceClient.createTrial(parent, trial); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateTrial_StringTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java new file mode 100644 index 000000000000..8a0f4759a7f5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_CreateTrial_StudynameTrial_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncCreateTrialStudynameTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrialStudynameTrial(); + } + + public static void syncCreateTrialStudynameTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + Trial trial = Trial.newBuilder().build(); + Trial response = vizierServiceClient.createTrial(parent, trial); + } + } +} +// [END aiplatform_v1_generated_VizierService_CreateTrial_StudynameTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/AsyncDeleteStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/AsyncDeleteStudy.java new file mode 100644 index 000000000000..98da8ca98526 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/AsyncDeleteStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteStudyRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteStudy { + + public static void main(String[] args) throws Exception { + asyncDeleteStudy(); + } + + public static void asyncDeleteStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteStudyRequest request = + DeleteStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = vizierServiceClient.deleteStudyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudy.java new file mode 100644 index 000000000000..7b922f43e0d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteStudy_sync] +import com.google.cloud.aiplatform.v1.DeleteStudyRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudy { + + public static void main(String[] args) throws Exception { + syncDeleteStudy(); + } + + public static void syncDeleteStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteStudyRequest request = + DeleteStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + vizierServiceClient.deleteStudy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyString.java new file mode 100644 index 000000000000..fcdad69134c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteStudy_String_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudyString { + + public static void main(String[] args) throws Exception { + syncDeleteStudyString(); + } + + public static void syncDeleteStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + vizierServiceClient.deleteStudy(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java new file mode 100644 index 000000000000..ed331e8c90c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteStudy_Studyname_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudyStudyname { + + public static void main(String[] args) throws Exception { + syncDeleteStudyStudyname(); + } + + public static void syncDeleteStudyStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + vizierServiceClient.deleteStudy(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteStudy_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/AsyncDeleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/AsyncDeleteTrial.java new file mode 100644 index 000000000000..8a266c44d5de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/AsyncDeleteTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DeleteTrialRequest; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTrial { + + public static void main(String[] args) throws Exception { + asyncDeleteTrial(); + } + + public static void asyncDeleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteTrialRequest request = + DeleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.deleteTrialCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrial.java new file mode 100644 index 000000000000..daf6e41212fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteTrial_sync] +import com.google.cloud.aiplatform.v1.DeleteTrialRequest; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrial { + + public static void main(String[] args) throws Exception { + syncDeleteTrial(); + } + + public static void syncDeleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteTrialRequest request = + DeleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + vizierServiceClient.deleteTrial(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialString.java new file mode 100644 index 000000000000..aa7d9f977046 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteTrial_String_sync] +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrialString { + + public static void main(String[] args) throws Exception { + syncDeleteTrialString(); + } + + public static void syncDeleteTrialString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); + vizierServiceClient.deleteTrial(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteTrial_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java new file mode 100644 index 000000000000..a02cac5a22b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_DeleteTrial_Trialname_sync] +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrialTrialname { + + public static void main(String[] args) throws Exception { + syncDeleteTrialTrialname(); + } + + public static void syncDeleteTrialTrialname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); + vizierServiceClient.deleteTrial(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_DeleteTrial_Trialname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..0b41279642b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..adf43ec13501 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = vizierServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..7a169bc3cdcd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = vizierServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..8eb40d04c9d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetLocation_sync] +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = vizierServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/AsyncGetStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/AsyncGetStudy.java new file mode 100644 index 000000000000..53137d578209 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/AsyncGetStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetStudyRequest; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncGetStudy { + + public static void main(String[] args) throws Exception { + asyncGetStudy(); + } + + public static void asyncGetStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetStudyRequest request = + GetStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = vizierServiceClient.getStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudy.java new file mode 100644 index 000000000000..5dba9c8eb6b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetStudy_sync] +import com.google.cloud.aiplatform.v1.GetStudyRequest; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetStudy { + + public static void main(String[] args) throws Exception { + syncGetStudy(); + } + + public static void syncGetStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetStudyRequest request = + GetStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + Study response = vizierServiceClient.getStudy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyString.java new file mode 100644 index 000000000000..e9e8e5afed16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetStudy_String_sync] +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetStudyString { + + public static void main(String[] args) throws Exception { + syncGetStudyString(); + } + + public static void syncGetStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + Study response = vizierServiceClient.getStudy(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyStudyname.java new file mode 100644 index 000000000000..5946e1d13d00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/getstudy/SyncGetStudyStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetStudy_Studyname_sync] +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetStudyStudyname { + + public static void main(String[] args) throws Exception { + syncGetStudyStudyname(); + } + + public static void syncGetStudyStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + Study response = vizierServiceClient.getStudy(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetStudy_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/AsyncGetTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/AsyncGetTrial.java new file mode 100644 index 000000000000..4d77b2a1565f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/AsyncGetTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.GetTrialRequest; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncGetTrial { + + public static void main(String[] args) throws Exception { + asyncGetTrial(); + } + + public static void asyncGetTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetTrialRequest request = + GetTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.getTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrial.java new file mode 100644 index 000000000000..fc32d87275b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetTrial_sync] +import com.google.cloud.aiplatform.v1.GetTrialRequest; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetTrial { + + public static void main(String[] args) throws Exception { + syncGetTrial(); + } + + public static void syncGetTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetTrialRequest request = + GetTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + Trial response = vizierServiceClient.getTrial(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialString.java new file mode 100644 index 000000000000..5167593d5312 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetTrial_String_sync] +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetTrialString { + + public static void main(String[] args) throws Exception { + syncGetTrialString(); + } + + public static void syncGetTrialString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); + Trial response = vizierServiceClient.getTrial(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetTrial_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialTrialname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialTrialname.java new file mode 100644 index 000000000000..1f82cf9a7af3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/gettrial/SyncGetTrialTrialname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_GetTrial_Trialname_sync] +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncGetTrialTrialname { + + public static void main(String[] args) throws Exception { + syncGetTrialTrialname(); + } + + public static void syncGetTrialTrialname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); + Trial response = vizierServiceClient.getTrial(name); + } + } +} +// [END aiplatform_v1_generated_VizierService_GetTrial_Trialname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..8d8d369cca62 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + vizierServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..6aa0ec9b66bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = vizierServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..7e2604c02965 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListLocations_sync] +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : vizierServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java new file mode 100644 index 000000000000..464ffbddb1f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListOptimalTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListOptimalTrialsRequest; +import com.google.cloud.aiplatform.v1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncListOptimalTrials { + + public static void main(String[] args) throws Exception { + asyncListOptimalTrials(); + } + + public static void asyncListOptimalTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListOptimalTrialsRequest request = + ListOptimalTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = + vizierServiceClient.listOptimalTrialsCallable().futureCall(request); + // Do something. + ListOptimalTrialsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_ListOptimalTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java new file mode 100644 index 000000000000..4125b49abf7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListOptimalTrials_sync] +import com.google.cloud.aiplatform.v1.ListOptimalTrialsRequest; +import com.google.cloud.aiplatform.v1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListOptimalTrials { + + public static void main(String[] args) throws Exception { + syncListOptimalTrials(); + } + + public static void syncListOptimalTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListOptimalTrialsRequest request = + ListOptimalTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_ListOptimalTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java new file mode 100644 index 000000000000..4195e84cd91b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListOptimalTrials_String_sync] +import com.google.cloud.aiplatform.v1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListOptimalTrialsString { + + public static void main(String[] args) throws Exception { + syncListOptimalTrialsString(); + } + + public static void syncListOptimalTrialsString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); + } + } +} +// [END aiplatform_v1_generated_VizierService_ListOptimalTrials_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java new file mode 100644 index 000000000000..ba15b610f783 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListOptimalTrials_Studyname_sync] +import com.google.cloud.aiplatform.v1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListOptimalTrialsStudyname { + + public static void main(String[] args) throws Exception { + syncListOptimalTrialsStudyname(); + } + + public static void syncListOptimalTrialsStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); + } + } +} +// [END aiplatform_v1_generated_VizierService_ListOptimalTrials_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudies.java new file mode 100644 index 000000000000..f0a60d4d8e41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudies.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListStudies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncListStudies { + + public static void main(String[] args) throws Exception { + asyncListStudies(); + } + + public static void asyncListStudies() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = vizierServiceClient.listStudiesPagedCallable().futureCall(request); + // Do something. + for (Study element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListStudies_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudiesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudiesPaged.java new file mode 100644 index 000000000000..7af090dc5115 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/AsyncListStudiesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListStudies_Paged_async] +import com.google.cloud.aiplatform.v1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1.ListStudiesResponse; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.common.base.Strings; + +public class AsyncListStudiesPaged { + + public static void main(String[] args) throws Exception { + asyncListStudiesPaged(); + } + + public static void asyncListStudiesPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListStudiesResponse response = vizierServiceClient.listStudiesCallable().call(request); + for (Study element : response.getStudiesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListStudies_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudies.java new file mode 100644 index 000000000000..6a99a1bb160a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudies.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListStudies_sync] +import com.google.cloud.aiplatform.v1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListStudies { + + public static void main(String[] args) throws Exception { + syncListStudies(); + } + + public static void syncListStudies() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Study element : vizierServiceClient.listStudies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListStudies_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesLocationname.java new file mode 100644 index 000000000000..ecd960311fe2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListStudies_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListStudiesLocationname { + + public static void main(String[] args) throws Exception { + syncListStudiesLocationname(); + } + + public static void syncListStudiesLocationname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListStudies_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesString.java new file mode 100644 index 000000000000..222f8252293d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/liststudies/SyncListStudiesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListStudies_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListStudiesString { + + public static void main(String[] args) throws Exception { + syncListStudiesString(); + } + + public static void syncListStudiesString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListStudies_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrials.java new file mode 100644 index 000000000000..05ebc1663dd8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrials.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncListTrials { + + public static void main(String[] args) throws Exception { + asyncListTrials(); + } + + public static void asyncListTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = vizierServiceClient.listTrialsPagedCallable().futureCall(request); + // Do something. + for (Trial element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrialsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrialsPaged.java new file mode 100644 index 000000000000..5c77ee6f477b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/AsyncListTrialsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListTrials_Paged_async] +import com.google.cloud.aiplatform.v1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1.ListTrialsResponse; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTrialsPaged { + + public static void main(String[] args) throws Exception { + asyncListTrialsPaged(); + } + + public static void asyncListTrialsPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListTrialsResponse response = vizierServiceClient.listTrialsCallable().call(request); + for (Trial element : response.getTrialsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListTrials_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrials.java new file mode 100644 index 000000000000..9f1b7d307f32 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrials.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListTrials_sync] +import com.google.cloud.aiplatform.v1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListTrials { + + public static void main(String[] args) throws Exception { + syncListTrials(); + } + + public static void syncListTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Trial element : vizierServiceClient.listTrials(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsString.java new file mode 100644 index 000000000000..780cfdbebd92 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListTrials_String_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListTrialsString { + + public static void main(String[] args) throws Exception { + syncListTrialsString(); + } + + public static void syncListTrialsString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListTrials_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsStudyname.java new file mode 100644 index 000000000000..1d0f24d9ef6b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/listtrials/SyncListTrialsStudyname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_ListTrials_Studyname_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncListTrialsStudyname { + + public static void main(String[] args) throws Exception { + syncListTrialsStudyname(); + } + + public static void syncListTrialsStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1_generated_VizierService_ListTrials_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/AsyncLookupStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/AsyncLookupStudy.java new file mode 100644 index 000000000000..414a93f34d50 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/AsyncLookupStudy.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_LookupStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.LookupStudyRequest; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncLookupStudy { + + public static void main(String[] args) throws Exception { + asyncLookupStudy(); + } + + public static void asyncLookupStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LookupStudyRequest request = + LookupStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDisplayName("displayName1714148973") + .build(); + ApiFuture future = vizierServiceClient.lookupStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_LookupStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudy.java new file mode 100644 index 000000000000..3b3932b91cd5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_LookupStudy_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.LookupStudyRequest; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncLookupStudy { + + public static void main(String[] args) throws Exception { + syncLookupStudy(); + } + + public static void syncLookupStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LookupStudyRequest request = + LookupStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDisplayName("displayName1714148973") + .build(); + Study response = vizierServiceClient.lookupStudy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_LookupStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java new file mode 100644 index 000000000000..84950167b277 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_LookupStudy_Locationname_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncLookupStudyLocationname { + + public static void main(String[] args) throws Exception { + syncLookupStudyLocationname(); + } + + public static void syncLookupStudyLocationname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Study response = vizierServiceClient.lookupStudy(parent); + } + } +} +// [END aiplatform_v1_generated_VizierService_LookupStudy_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyString.java new file mode 100644 index 000000000000..64e60d69d995 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/lookupstudy/SyncLookupStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_LookupStudy_String_sync] +import com.google.cloud.aiplatform.v1.LocationName; +import com.google.cloud.aiplatform.v1.Study; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncLookupStudyString { + + public static void main(String[] args) throws Exception { + syncLookupStudyString(); + } + + public static void syncLookupStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Study response = vizierServiceClient.lookupStudy(parent); + } + } +} +// [END aiplatform_v1_generated_VizierService_LookupStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..958bd57a4544 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..8985c16af22a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = vizierServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/AsyncStopTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/AsyncStopTrial.java new file mode 100644 index 000000000000..c2c323ae77e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/AsyncStopTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_StopTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.StopTrialRequest; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncStopTrial { + + public static void main(String[] args) throws Exception { + asyncStopTrial(); + } + + public static void asyncStopTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StopTrialRequest request = + StopTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.stopTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_StopTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/SyncStopTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/SyncStopTrial.java new file mode 100644 index 000000000000..d6d43ccc83d2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/stoptrial/SyncStopTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_StopTrial_sync] +import com.google.cloud.aiplatform.v1.StopTrialRequest; +import com.google.cloud.aiplatform.v1.Trial; +import com.google.cloud.aiplatform.v1.TrialName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncStopTrial { + + public static void main(String[] args) throws Exception { + syncStopTrial(); + } + + public static void syncStopTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StopTrialRequest request = + StopTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + Trial response = vizierServiceClient.stopTrial(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_StopTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrials.java new file mode 100644 index 000000000000..6fb81de25356 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrials.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_SuggestTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.longrunning.Operation; + +public class AsyncSuggestTrials { + + public static void main(String[] args) throws Exception { + asyncSuggestTrials(); + } + + public static void asyncSuggestTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + ApiFuture future = vizierServiceClient.suggestTrialsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_SuggestTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java new file mode 100644 index 000000000000..2e70745dac3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_SuggestTrials_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.SuggestTrialsMetadata; +import com.google.cloud.aiplatform.v1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1.SuggestTrialsResponse; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class AsyncSuggestTrialsLRO { + + public static void main(String[] args) throws Exception { + asyncSuggestTrialsLRO(); + } + + public static void asyncSuggestTrialsLRO() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + OperationFuture future = + vizierServiceClient.suggestTrialsOperationCallable().futureCall(request); + // Do something. + SuggestTrialsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_SuggestTrials_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/SyncSuggestTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/SyncSuggestTrials.java new file mode 100644 index 000000000000..174b37e22757 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/suggesttrials/SyncSuggestTrials.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_SuggestTrials_sync] +import com.google.cloud.aiplatform.v1.StudyName; +import com.google.cloud.aiplatform.v1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1.SuggestTrialsResponse; +import com.google.cloud.aiplatform.v1.VizierServiceClient; + +public class SyncSuggestTrials { + + public static void main(String[] args) throws Exception { + syncSuggestTrials(); + } + + public static void syncSuggestTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + SuggestTrialsResponse response = vizierServiceClient.suggestTrialsAsync(request).get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_SuggestTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..4af80567c1f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + vizierServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1_generated_VizierService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..ea18e1b28fa4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.VizierServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = vizierServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1_generated_VizierService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservicesettings/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservicesettings/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..0421a5e5ef85 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/vizierservicesettings/createstudy/SyncCreateStudy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.samples; + +// [START aiplatform_v1_generated_VizierServiceSettings_CreateStudy_sync] +import com.google.cloud.aiplatform.v1.VizierServiceSettings; +import java.time.Duration; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 + VizierServiceSettings.Builder vizierServiceSettingsBuilder = VizierServiceSettings.newBuilder(); + vizierServiceSettingsBuilder + .createStudySettings() + .setRetrySettings( + vizierServiceSettingsBuilder + .createStudySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + VizierServiceSettings vizierServiceSettings = vizierServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1_generated_VizierServiceSettings_CreateStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..ee6512c14bce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + DatasetServiceSettings datasetServiceSettings = + DatasetServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_DatasetService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..5f45deddf69e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + DatasetServiceSettings datasetServiceSettings = + DatasetServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_DatasetService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDataset.java new file mode 100644 index 000000000000..b2b7b36c0566 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDataset.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_CreateDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateDataset { + + public static void main(String[] args) throws Exception { + asyncCreateDataset(); + } + + public static void asyncCreateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + ApiFuture future = + datasetServiceClient.createDatasetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_CreateDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDatasetLRO.java new file mode 100644 index 000000000000..91a48a890023 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/AsyncCreateDatasetLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_CreateDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateDatasetOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncCreateDatasetLRO(); + } + + public static void asyncCreateDatasetLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + OperationFuture future = + datasetServiceClient.createDatasetOperationCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_CreateDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDataset.java new file mode 100644 index 000000000000..9730bbe3bc69 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDataset.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_CreateDataset_sync] +import com.google.cloud.aiplatform.v1beta1.CreateDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDataset { + + public static void main(String[] args) throws Exception { + syncCreateDataset(); + } + + public static void syncCreateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + CreateDatasetRequest request = + CreateDatasetRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataset(Dataset.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.createDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_CreateDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java new file mode 100644 index 000000000000..4530d3e6cef0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetLocationnameDataset.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_CreateDataset_LocationnameDataset_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDatasetLocationnameDataset { + + public static void main(String[] args) throws Exception { + syncCreateDatasetLocationnameDataset(); + } + + public static void syncCreateDatasetLocationnameDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Dataset dataset = Dataset.newBuilder().build(); + Dataset response = datasetServiceClient.createDatasetAsync(parent, dataset).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_CreateDataset_LocationnameDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java new file mode 100644 index 000000000000..38db3a205498 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/createdataset/SyncCreateDatasetStringDataset.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_CreateDataset_StringDataset_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDatasetStringDataset { + + public static void main(String[] args) throws Exception { + syncCreateDatasetStringDataset(); + } + + public static void syncCreateDatasetStringDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Dataset dataset = Dataset.newBuilder().build(); + Dataset response = datasetServiceClient.createDatasetAsync(parent, dataset).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_CreateDataset_StringDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDataset.java new file mode 100644 index 000000000000..d2381941cccf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDataset.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteDatasetRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteDataset { + + public static void main(String[] args) throws Exception { + asyncDeleteDataset(); + } + + public static void asyncDeleteDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + ApiFuture future = + datasetServiceClient.deleteDatasetCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java new file mode 100644 index 000000000000..0eeeffe9d6e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/AsyncDeleteDatasetLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDatasetLRO(); + } + + public static void asyncDeleteDatasetLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + OperationFuture future = + datasetServiceClient.deleteDatasetOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDataset.java new file mode 100644 index 000000000000..d825eb96e644 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDataset.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteDataset_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteDatasetRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteDataset { + + public static void main(String[] args) throws Exception { + syncDeleteDataset(); + } + + public static void syncDeleteDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteDatasetRequest request = + DeleteDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .build(); + datasetServiceClient.deleteDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java new file mode 100644 index 000000000000..ab70e899cbdf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetDatasetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteDataset_Datasetname_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDatasetDatasetname { + + public static void main(String[] args) throws Exception { + syncDeleteDatasetDatasetname(); + } + + public static void syncDeleteDatasetDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + datasetServiceClient.deleteDatasetAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteDataset_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetString.java new file mode 100644 index 000000000000..1f7d80a05c4c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletedataset/SyncDeleteDatasetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteDataset_String_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDatasetString { + + public static void main(String[] args) throws Exception { + syncDeleteDatasetString(); + } + + public static void syncDeleteDatasetString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + datasetServiceClient.deleteDatasetAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java new file mode 100644 index 000000000000..dbf3ff59a03a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQuery.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.longrunning.Operation; + +public class AsyncDeleteSavedQuery { + + public static void main(String[] args) throws Exception { + asyncDeleteSavedQuery(); + } + + public static void asyncDeleteSavedQuery() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + ApiFuture future = + datasetServiceClient.deleteSavedQueryCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java new file mode 100644 index 000000000000..4f63c3e70b73 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/AsyncDeleteSavedQueryLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.protobuf.Empty; + +public class AsyncDeleteSavedQueryLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSavedQueryLRO(); + } + + public static void asyncDeleteSavedQueryLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + OperationFuture future = + datasetServiceClient.deleteSavedQueryOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java new file mode 100644 index 000000000000..0dfce2591833 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuery.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeleteSavedQueryRequest; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQuery { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQuery(); + } + + public static void syncDeleteSavedQuery() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DeleteSavedQueryRequest request = + DeleteSavedQueryRequest.newBuilder() + .setName( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .build(); + datasetServiceClient.deleteSavedQueryAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java new file mode 100644 index 000000000000..d90b8226c7f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQuerySavedqueryname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_Savedqueryname_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQuerySavedqueryname { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQuerySavedqueryname(); + } + + public static void syncDeleteSavedQuerySavedqueryname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SavedQueryName name = + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]"); + datasetServiceClient.deleteSavedQueryAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_Savedqueryname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java new file mode 100644 index 000000000000..b8028cc1b2ae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/deletesavedquery/SyncDeleteSavedQueryString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_String_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.protobuf.Empty; + +public class SyncDeleteSavedQueryString { + + public static void main(String[] args) throws Exception { + syncDeleteSavedQueryString(); + } + + public static void syncDeleteSavedQueryString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]").toString(); + datasetServiceClient.deleteSavedQueryAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_DeleteSavedQuery_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportData.java new file mode 100644 index 000000000000..5994b80244e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportData.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ExportData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ExportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ExportDataRequest; +import com.google.longrunning.Operation; + +public class AsyncExportData { + + public static void main(String[] args) throws Exception { + asyncExportData(); + } + + public static void asyncExportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.exportDataCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ExportData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportDataLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportDataLRO.java new file mode 100644 index 000000000000..5d80f9b753fa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/AsyncExportDataLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ExportData_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ExportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ExportDataOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ExportDataRequest; +import com.google.cloud.aiplatform.v1beta1.ExportDataResponse; + +public class AsyncExportDataLRO { + + public static void main(String[] args) throws Exception { + asyncExportDataLRO(); + } + + public static void asyncExportDataLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + OperationFuture future = + datasetServiceClient.exportDataOperationCallable().futureCall(request); + // Do something. + ExportDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ExportData_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportData.java new file mode 100644 index 000000000000..57bea992e2c7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportData.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ExportData_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ExportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ExportDataRequest; +import com.google.cloud.aiplatform.v1beta1.ExportDataResponse; + +public class SyncExportData { + + public static void main(String[] args) throws Exception { + syncExportData(); + } + + public static void syncExportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ExportDataRequest request = + ExportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setExportConfig(ExportDataConfig.newBuilder().build()) + .build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ExportData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java new file mode 100644 index 000000000000..e5e60a1f8a9c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataDatasetnameExportdataconfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ExportData_DatasetnameExportdataconfig_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ExportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ExportDataResponse; + +public class SyncExportDataDatasetnameExportdataconfig { + + public static void main(String[] args) throws Exception { + syncExportDataDatasetnameExportdataconfig(); + } + + public static void syncExportDataDatasetnameExportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + ExportDataConfig exportConfig = ExportDataConfig.newBuilder().build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(name, exportConfig).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ExportData_DatasetnameExportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java new file mode 100644 index 000000000000..17cd550b746f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/exportdata/SyncExportDataStringExportdataconfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ExportData_StringExportdataconfig_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ExportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ExportDataResponse; + +public class SyncExportDataStringExportdataconfig { + + public static void main(String[] args) throws Exception { + syncExportDataStringExportdataconfig(); + } + + public static void syncExportDataStringExportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + ExportDataConfig exportConfig = ExportDataConfig.newBuilder().build(); + ExportDataResponse response = datasetServiceClient.exportDataAsync(name, exportConfig).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ExportData_StringExportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java new file mode 100644 index 000000000000..c2e2f67bac07 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/AsyncGetAnnotationSpec.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.AnnotationSpec; +import com.google.cloud.aiplatform.v1beta1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetAnnotationSpecRequest; +import com.google.protobuf.FieldMask; + +public class AsyncGetAnnotationSpec { + + public static void main(String[] args) throws Exception { + asyncGetAnnotationSpec(); + } + + public static void asyncGetAnnotationSpec() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetAnnotationSpecRequest request = + GetAnnotationSpecRequest.newBuilder() + .setName( + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + datasetServiceClient.getAnnotationSpecCallable().futureCall(request); + // Do something. + AnnotationSpec response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java new file mode 100644 index 000000000000..f04b16664654 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpec.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_sync] +import com.google.cloud.aiplatform.v1beta1.AnnotationSpec; +import com.google.cloud.aiplatform.v1beta1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetAnnotationSpecRequest; +import com.google.protobuf.FieldMask; + +public class SyncGetAnnotationSpec { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpec(); + } + + public static void syncGetAnnotationSpec() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetAnnotationSpecRequest request = + GetAnnotationSpecRequest.newBuilder() + .setName( + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java new file mode 100644 index 000000000000..9ed269f28ef7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecAnnotationspecname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_Annotationspecname_sync] +import com.google.cloud.aiplatform.v1beta1.AnnotationSpec; +import com.google.cloud.aiplatform.v1beta1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncGetAnnotationSpecAnnotationspecname { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpecAnnotationspecname(); + } + + public static void syncGetAnnotationSpecAnnotationspecname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + AnnotationSpecName name = + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(name); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_Annotationspecname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java new file mode 100644 index 000000000000..e22d34ff18f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getannotationspec/SyncGetAnnotationSpecString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_String_sync] +import com.google.cloud.aiplatform.v1beta1.AnnotationSpec; +import com.google.cloud.aiplatform.v1beta1.AnnotationSpecName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncGetAnnotationSpecString { + + public static void main(String[] args) throws Exception { + syncGetAnnotationSpecString(); + } + + public static void syncGetAnnotationSpecString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = + AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") + .toString(); + AnnotationSpec response = datasetServiceClient.getAnnotationSpec(name); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetAnnotationSpec_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/AsyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/AsyncGetDataset.java new file mode 100644 index 000000000000..6069848e2f82 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/AsyncGetDataset.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetDatasetRequest; +import com.google.protobuf.FieldMask; + +public class AsyncGetDataset { + + public static void main(String[] args) throws Exception { + asyncGetDataset(); + } + + public static void asyncGetDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetDatasetRequest request = + GetDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.getDatasetCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..81dba4054cdb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDataset.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetDataset_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetDatasetRequest; +import com.google.protobuf.FieldMask; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetDatasetRequest request = + GetDatasetRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.getDataset(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetDatasetname.java new file mode 100644 index 000000000000..9d89995fd721 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetDatasetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetDataset_Datasetname_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncGetDatasetDatasetname { + + public static void main(String[] args) throws Exception { + syncGetDatasetDatasetname(); + } + + public static void syncGetDatasetDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + Dataset response = datasetServiceClient.getDataset(name); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetDataset_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetString.java new file mode 100644 index 000000000000..f3a2f46e2099 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getdataset/SyncGetDatasetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetDataset_String_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncGetDatasetString { + + public static void main(String[] args) throws Exception { + syncGetDatasetString(); + } + + public static void syncGetDatasetString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + Dataset response = datasetServiceClient.getDataset(name); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..5c3d626b9493 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..486058c2ec52 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = datasetServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..187f119add6c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = datasetServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..03fb1b089055 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = datasetServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportData.java new file mode 100644 index 000000000000..33c1e9dad4d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportData.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ImportData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ImportDataRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncImportData { + + public static void main(String[] args) throws Exception { + asyncImportData(); + } + + public static void asyncImportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + ApiFuture future = datasetServiceClient.importDataCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ImportData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportDataLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportDataLRO.java new file mode 100644 index 000000000000..c6e5f3c01abb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/AsyncImportDataLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ImportData_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ImportDataOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ImportDataRequest; +import com.google.cloud.aiplatform.v1beta1.ImportDataResponse; +import java.util.ArrayList; + +public class AsyncImportDataLRO { + + public static void main(String[] args) throws Exception { + asyncImportDataLRO(); + } + + public static void asyncImportDataLRO() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + OperationFuture future = + datasetServiceClient.importDataOperationCallable().futureCall(request); + // Do something. + ImportDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ImportData_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportData.java new file mode 100644 index 000000000000..c6b90e955aa5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportData.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ImportData_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ImportDataRequest; +import com.google.cloud.aiplatform.v1beta1.ImportDataResponse; +import java.util.ArrayList; + +public class SyncImportData { + + public static void main(String[] args) throws Exception { + syncImportData(); + } + + public static void syncImportData() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ImportDataRequest request = + ImportDataRequest.newBuilder() + .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .addAllImportConfigs(new ArrayList()) + .build(); + ImportDataResponse response = datasetServiceClient.importDataAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ImportData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java new file mode 100644 index 000000000000..462dd49c2ab5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataDatasetnameListimportdataconfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ImportData_DatasetnameListimportdataconfig_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ImportDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncImportDataDatasetnameListimportdataconfig { + + public static void main(String[] args) throws Exception { + syncImportDataDatasetnameListimportdataconfig(); + } + + public static void syncImportDataDatasetnameListimportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + List importConfigs = new ArrayList<>(); + ImportDataResponse response = datasetServiceClient.importDataAsync(name, importConfigs).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ImportData_DatasetnameListimportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java new file mode 100644 index 000000000000..79c8e33ddc7a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/importdata/SyncImportDataStringListimportdataconfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ImportData_StringListimportdataconfig_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportDataConfig; +import com.google.cloud.aiplatform.v1beta1.ImportDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncImportDataStringListimportdataconfig { + + public static void main(String[] args) throws Exception { + syncImportDataStringListimportdataconfig(); + } + + public static void syncImportDataStringListimportdataconfig() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + List importConfigs = new ArrayList<>(); + ImportDataResponse response = datasetServiceClient.importDataAsync(name, importConfigs).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ImportData_StringListimportdataconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotations.java new file mode 100644 index 000000000000..c36c82b999cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotations.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListAnnotations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Annotation; +import com.google.cloud.aiplatform.v1beta1.DataItemName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListAnnotationsRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListAnnotations { + + public static void main(String[] args) throws Exception { + asyncListAnnotations(); + } + + public static void asyncListAnnotations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listAnnotationsPagedCallable().futureCall(request); + // Do something. + for (Annotation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListAnnotations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotationsPaged.java new file mode 100644 index 000000000000..9f9df194a942 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/AsyncListAnnotationsPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListAnnotations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Annotation; +import com.google.cloud.aiplatform.v1beta1.DataItemName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListAnnotationsRequest; +import com.google.cloud.aiplatform.v1beta1.ListAnnotationsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListAnnotationsPaged { + + public static void main(String[] args) throws Exception { + asyncListAnnotationsPaged(); + } + + public static void asyncListAnnotationsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListAnnotationsResponse response = + datasetServiceClient.listAnnotationsCallable().call(request); + for (Annotation element : response.getAnnotationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListAnnotations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotations.java new file mode 100644 index 000000000000..cb2abb0b2253 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListAnnotations_sync] +import com.google.cloud.aiplatform.v1beta1.Annotation; +import com.google.cloud.aiplatform.v1beta1.DataItemName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListAnnotationsRequest; +import com.google.protobuf.FieldMask; + +public class SyncListAnnotations { + + public static void main(String[] args) throws Exception { + syncListAnnotations(); + } + + public static void syncListAnnotations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListAnnotationsRequest request = + ListAnnotationsRequest.newBuilder() + .setParent( + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Annotation element : datasetServiceClient.listAnnotations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListAnnotations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java new file mode 100644 index 000000000000..1687ab917cb4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsDataitemname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListAnnotations_Dataitemname_sync] +import com.google.cloud.aiplatform.v1beta1.Annotation; +import com.google.cloud.aiplatform.v1beta1.DataItemName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncListAnnotationsDataitemname { + + public static void main(String[] args) throws Exception { + syncListAnnotationsDataitemname(); + } + + public static void syncListAnnotationsDataitemname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]"); + for (Annotation element : datasetServiceClient.listAnnotations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListAnnotations_Dataitemname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsString.java new file mode 100644 index 000000000000..e0b10b1ec93b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listannotations/SyncListAnnotationsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListAnnotations_String_sync] +import com.google.cloud.aiplatform.v1beta1.Annotation; +import com.google.cloud.aiplatform.v1beta1.DataItemName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncListAnnotationsString { + + public static void main(String[] args) throws Exception { + syncListAnnotationsString(); + } + + public static void syncListAnnotationsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = + DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]").toString(); + for (Annotation element : datasetServiceClient.listAnnotations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListAnnotations_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItems.java new file mode 100644 index 000000000000..d6b0db4510a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItems.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDataItems_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DataItem; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataItemsRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListDataItems { + + public static void main(String[] args) throws Exception { + asyncListDataItems(); + } + + public static void asyncListDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listDataItemsPagedCallable().futureCall(request); + // Do something. + for (DataItem element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDataItems_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItemsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItemsPaged.java new file mode 100644 index 000000000000..fd619ebd8cd3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/AsyncListDataItemsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDataItems_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DataItem; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataItemsRequest; +import com.google.cloud.aiplatform.v1beta1.ListDataItemsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDataItemsPaged { + + public static void main(String[] args) throws Exception { + asyncListDataItemsPaged(); + } + + public static void asyncListDataItemsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDataItemsResponse response = datasetServiceClient.listDataItemsCallable().call(request); + for (DataItem element : response.getDataItemsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDataItems_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItems.java new file mode 100644 index 000000000000..54ffdd55c092 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItems.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDataItems_sync] +import com.google.cloud.aiplatform.v1beta1.DataItem; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataItemsRequest; +import com.google.protobuf.FieldMask; + +public class SyncListDataItems { + + public static void main(String[] args) throws Exception { + syncListDataItems(); + } + + public static void syncListDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDataItemsRequest request = + ListDataItemsRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (DataItem element : datasetServiceClient.listDataItems(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDataItems_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java new file mode 100644 index 000000000000..f4a72e0b1e0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsDatasetname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDataItems_Datasetname_sync] +import com.google.cloud.aiplatform.v1beta1.DataItem; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncListDataItemsDatasetname { + + public static void main(String[] args) throws Exception { + syncListDataItemsDatasetname(); + } + + public static void syncListDataItemsDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + for (DataItem element : datasetServiceClient.listDataItems(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDataItems_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsString.java new file mode 100644 index 000000000000..36e59272ffc2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdataitems/SyncListDataItemsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDataItems_String_sync] +import com.google.cloud.aiplatform.v1beta1.DataItem; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; + +public class SyncListDataItemsString { + + public static void main(String[] args) throws Exception { + syncListDataItemsString(); + } + + public static void syncListDataItemsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + for (DataItem element : datasetServiceClient.listDataItems(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDataItems_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasets.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasets.java new file mode 100644 index 000000000000..e24a93f3bea5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasets.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDatasets_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListDatasets { + + public static void main(String[] args) throws Exception { + asyncListDatasets(); + } + + public static void asyncListDatasets() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listDatasetsPagedCallable().futureCall(request); + // Do something. + for (Dataset element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDatasets_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasetsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasetsPaged.java new file mode 100644 index 000000000000..12732a492b6d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/AsyncListDatasetsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDatasets_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1beta1.ListDatasetsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDatasetsPaged { + + public static void main(String[] args) throws Exception { + asyncListDatasetsPaged(); + } + + public static void asyncListDatasetsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDatasetsResponse response = datasetServiceClient.listDatasetsCallable().call(request); + for (Dataset element : response.getDatasetsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDatasets_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasets.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasets.java new file mode 100644 index 000000000000..4595c9a47505 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasets.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDatasets_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDatasetsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListDatasets { + + public static void main(String[] args) throws Exception { + syncListDatasets(); + } + + public static void syncListDatasets() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListDatasetsRequest request = + ListDatasetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Dataset element : datasetServiceClient.listDatasets(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDatasets_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsLocationname.java new file mode 100644 index 000000000000..7e483eea4b83 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDatasets_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListDatasetsLocationname { + + public static void main(String[] args) throws Exception { + syncListDatasetsLocationname(); + } + + public static void syncListDatasetsLocationname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Dataset element : datasetServiceClient.listDatasets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDatasets_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsString.java new file mode 100644 index 000000000000..7f95a51f30d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listdatasets/SyncListDatasetsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListDatasets_String_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListDatasetsString { + + public static void main(String[] args) throws Exception { + syncListDatasetsString(); + } + + public static void syncListDatasetsString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Dataset element : datasetServiceClient.listDatasets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListDatasets_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..eb474840a3d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datasetServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..430b6a469e8b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = datasetServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..166456212f68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : datasetServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueries.java new file mode 100644 index 000000000000..48b8fbe1f85c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1beta1.SavedQuery; +import com.google.protobuf.FieldMask; + +public class AsyncListSavedQueries { + + public static void main(String[] args) throws Exception { + asyncListSavedQueries(); + } + + public static void asyncListSavedQueries() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datasetServiceClient.listSavedQueriesPagedCallable().futureCall(request); + // Do something. + for (SavedQuery element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java new file mode 100644 index 000000000000..72f84dd9bd34 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/AsyncListSavedQueriesPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1beta1.ListSavedQueriesResponse; +import com.google.cloud.aiplatform.v1beta1.SavedQuery; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListSavedQueriesPaged { + + public static void main(String[] args) throws Exception { + asyncListSavedQueriesPaged(); + } + + public static void asyncListSavedQueriesPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSavedQueriesResponse response = + datasetServiceClient.listSavedQueriesCallable().call(request); + for (SavedQuery element : response.getSavedQueriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueries.java new file mode 100644 index 000000000000..de146dbc611e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListSavedQueriesRequest; +import com.google.cloud.aiplatform.v1beta1.SavedQuery; +import com.google.protobuf.FieldMask; + +public class SyncListSavedQueries { + + public static void main(String[] args) throws Exception { + syncListSavedQueries(); + } + + public static void syncListSavedQueries() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + ListSavedQueriesRequest request = + ListSavedQueriesRequest.newBuilder() + .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (SavedQuery element : datasetServiceClient.listSavedQueries(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java new file mode 100644 index 000000000000..94630c6d44ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesDatasetname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_Datasetname_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQuery; + +public class SyncListSavedQueriesDatasetname { + + public static void main(String[] args) throws Exception { + syncListSavedQueriesDatasetname(); + } + + public static void syncListSavedQueriesDatasetname() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); + for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_Datasetname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java new file mode 100644 index 000000000000..12cc46d7c17f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/listsavedqueries/SyncListSavedQueriesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_String_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQuery; + +public class SyncListSavedQueriesString { + + public static void main(String[] args) throws Exception { + syncListSavedQueriesString(); + } + + public static void syncListSavedQueriesString() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); + for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_ListSavedQueries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItems.java new file mode 100644 index 000000000000..881aa1bfd2aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItems.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_SearchDataItems_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DataItemView; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.cloud.aiplatform.v1beta1.SearchDataItemsRequest; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncSearchDataItems { + + public static void main(String[] args) throws Exception { + asyncSearchDataItems(); + } + + public static void asyncSearchDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datasetServiceClient.searchDataItemsPagedCallable().futureCall(request); + // Do something. + for (DataItemView element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_SearchDataItems_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java new file mode 100644 index 000000000000..b2b1ab6ca46b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/AsyncSearchDataItemsPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_SearchDataItems_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DataItemView; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.cloud.aiplatform.v1beta1.SearchDataItemsRequest; +import com.google.cloud.aiplatform.v1beta1.SearchDataItemsResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncSearchDataItemsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchDataItemsPaged(); + } + + public static void asyncSearchDataItemsPaged() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchDataItemsResponse response = + datasetServiceClient.searchDataItemsCallable().call(request); + for (DataItemView element : response.getDataItemViewsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_SearchDataItems_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/SyncSearchDataItems.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/SyncSearchDataItems.java new file mode 100644 index 000000000000..ee7dd4266796 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/searchdataitems/SyncSearchDataItems.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_SearchDataItems_sync] +import com.google.cloud.aiplatform.v1beta1.DataItemView; +import com.google.cloud.aiplatform.v1beta1.DatasetName; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.SavedQueryName; +import com.google.cloud.aiplatform.v1beta1.SearchDataItemsRequest; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncSearchDataItems { + + public static void main(String[] args) throws Exception { + syncSearchDataItems(); + } + + public static void syncSearchDataItems() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SearchDataItemsRequest request = + SearchDataItemsRequest.newBuilder() + .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) + .setSavedQuery( + SavedQueryName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[SAVED_QUERY]") + .toString()) + .setDataLabelingJob("dataLabelingJob951814757") + .setDataItemFilter("dataItemFilter1487804341") + .setAnnotationsFilter("annotationsFilter-583841860") + .addAllAnnotationFilters(new ArrayList()) + .setFieldMask(FieldMask.newBuilder().build()) + .setAnnotationsLimit(134561504) + .setPageSize(883849137) + .setOrderBy("orderBy-1207110587") + .setPageToken("pageToken873572522") + .build(); + for (DataItemView element : datasetServiceClient.searchDataItems(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_SearchDataItems_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..824015b91dcb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..8ad047cb35b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = datasetServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..c5f604f11191 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + datasetServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..351cc9d1e888 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = datasetServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/AsyncUpdateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/AsyncUpdateDataset.java new file mode 100644 index 000000000000..5d90b04180d1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/AsyncUpdateDataset.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_UpdateDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateDatasetRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateDataset { + + public static void main(String[] args) throws Exception { + asyncUpdateDataset(); + } + + public static void asyncUpdateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + UpdateDatasetRequest request = + UpdateDatasetRequest.newBuilder() + .setDataset(Dataset.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = datasetServiceClient.updateDatasetCallable().futureCall(request); + // Do something. + Dataset response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_UpdateDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDataset.java new file mode 100644 index 000000000000..bf8e7c0a7989 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDataset.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_UpdateDataset_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateDatasetRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDataset { + + public static void main(String[] args) throws Exception { + syncUpdateDataset(); + } + + public static void syncUpdateDataset() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + UpdateDatasetRequest request = + UpdateDatasetRequest.newBuilder() + .setDataset(Dataset.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Dataset response = datasetServiceClient.updateDataset(request); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_UpdateDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java new file mode 100644 index 000000000000..5dbc87f283e2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservice/updatedataset/SyncUpdateDatasetDatasetFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetService_UpdateDataset_DatasetFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Dataset; +import com.google.cloud.aiplatform.v1beta1.DatasetServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDatasetDatasetFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateDatasetDatasetFieldmask(); + } + + public static void syncUpdateDatasetDatasetFieldmask() throws Exception { + // 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 (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) { + Dataset dataset = Dataset.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Dataset response = datasetServiceClient.updateDataset(dataset, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_DatasetService_UpdateDataset_DatasetFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservicesettings/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservicesettings/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..c162e30ad949 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/datasetservicesettings/getdataset/SyncGetDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DatasetServiceSettings_GetDataset_sync] +import com.google.cloud.aiplatform.v1beta1.DatasetServiceSettings; +import java.time.Duration; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 + DatasetServiceSettings.Builder datasetServiceSettingsBuilder = + DatasetServiceSettings.newBuilder(); + datasetServiceSettingsBuilder + .getDatasetSettings() + .setRetrySettings( + datasetServiceSettingsBuilder + .getDatasetSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatasetServiceSettings datasetServiceSettings = datasetServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_DatasetServiceSettings_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..0de819dd0fd7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettings = + DeploymentResourcePoolServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create(deploymentResourcePoolServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a319a2217920 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettings = + DeploymentResourcePoolServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create(deploymentResourcePoolServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePool.java new file mode 100644 index 000000000000..557dc036121c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePool.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + asyncCreateDeploymentResourcePool(); + } + + public static void asyncCreateDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + CreateDeploymentResourcePoolRequest request = + CreateDeploymentResourcePoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDeploymentResourcePool(DeploymentResourcePool.newBuilder().build()) + .setDeploymentResourcePoolId("deploymentResourcePoolId1805697578") + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient + .createDeploymentResourcePoolCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePoolLRO.java new file mode 100644 index 000000000000..1761824b9fdd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/AsyncCreateDeploymentResourcePoolLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateDeploymentResourcePoolOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateDeploymentResourcePoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateDeploymentResourcePoolLRO(); + } + + public static void asyncCreateDeploymentResourcePoolLRO() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + CreateDeploymentResourcePoolRequest request = + CreateDeploymentResourcePoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDeploymentResourcePool(DeploymentResourcePool.newBuilder().build()) + .setDeploymentResourcePoolId("deploymentResourcePoolId1805697578") + .build(); + OperationFuture + future = + deploymentResourcePoolServiceClient + .createDeploymentResourcePoolOperationCallable() + .futureCall(request); + // Do something. + DeploymentResourcePool response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePool.java new file mode 100644 index 000000000000..d881091c39a0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_sync] +import com.google.cloud.aiplatform.v1beta1.CreateDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + syncCreateDeploymentResourcePool(); + } + + public static void syncCreateDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + CreateDeploymentResourcePoolRequest request = + CreateDeploymentResourcePoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDeploymentResourcePool(DeploymentResourcePool.newBuilder().build()) + .setDeploymentResourcePoolId("deploymentResourcePoolId1805697578") + .build(); + DeploymentResourcePool response = + deploymentResourcePoolServiceClient.createDeploymentResourcePoolAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString.java new file mode 100644 index 000000000000..289a02771401 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_LocationnameDeploymentresourcepoolString_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString { + + public static void main(String[] args) throws Exception { + syncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString(); + } + + public static void syncCreateDeploymentResourcePoolLocationnameDeploymentresourcepoolString() + throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DeploymentResourcePool deploymentResourcePool = DeploymentResourcePool.newBuilder().build(); + String deploymentResourcePoolId = "deploymentResourcePoolId1805697578"; + DeploymentResourcePool response = + deploymentResourcePoolServiceClient + .createDeploymentResourcePoolAsync( + parent, deploymentResourcePool, deploymentResourcePoolId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_LocationnameDeploymentresourcepoolString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolStringDeploymentresourcepoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolStringDeploymentresourcepoolString.java new file mode 100644 index 000000000000..26f8bb7d7ae4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/createdeploymentresourcepool/SyncCreateDeploymentResourcePoolStringDeploymentresourcepoolString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_StringDeploymentresourcepoolString_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDeploymentResourcePoolStringDeploymentresourcepoolString { + + public static void main(String[] args) throws Exception { + syncCreateDeploymentResourcePoolStringDeploymentresourcepoolString(); + } + + public static void syncCreateDeploymentResourcePoolStringDeploymentresourcepoolString() + throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + DeploymentResourcePool deploymentResourcePool = DeploymentResourcePool.newBuilder().build(); + String deploymentResourcePoolId = "deploymentResourcePoolId1805697578"; + DeploymentResourcePool response = + deploymentResourcePoolServiceClient + .createDeploymentResourcePoolAsync( + parent, deploymentResourcePool, deploymentResourcePoolId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_CreateDeploymentResourcePool_StringDeploymentresourcepoolString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePool.java new file mode 100644 index 000000000000..491524510f21 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePool.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + asyncDeleteDeploymentResourcePool(); + } + + public static void asyncDeleteDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + DeleteDeploymentResourcePoolRequest request = + DeleteDeploymentResourcePoolRequest.newBuilder() + .setName( + DeploymentResourcePoolName.of( + "[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString()) + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient + .deleteDeploymentResourcePoolCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePoolLRO.java new file mode 100644 index 000000000000..bc4a15716ad7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/AsyncDeleteDeploymentResourcePoolLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteDeploymentResourcePoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDeploymentResourcePoolLRO(); + } + + public static void asyncDeleteDeploymentResourcePoolLRO() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + DeleteDeploymentResourcePoolRequest request = + DeleteDeploymentResourcePoolRequest.newBuilder() + .setName( + DeploymentResourcePoolName.of( + "[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString()) + .build(); + OperationFuture future = + deploymentResourcePoolServiceClient + .deleteDeploymentResourcePoolOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePool.java new file mode 100644 index 000000000000..4e5ff92d2d82 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteDeploymentResourcePoolRequest; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + syncDeleteDeploymentResourcePool(); + } + + public static void syncDeleteDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + DeleteDeploymentResourcePoolRequest request = + DeleteDeploymentResourcePoolRequest.newBuilder() + .setName( + DeploymentResourcePoolName.of( + "[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString()) + .build(); + deploymentResourcePoolServiceClient.deleteDeploymentResourcePoolAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolDeploymentresourcepoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolDeploymentresourcepoolname.java new file mode 100644 index 000000000000..38df24145fba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolDeploymentresourcepoolname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_Deploymentresourcepoolname_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDeploymentResourcePoolDeploymentresourcepoolname { + + public static void main(String[] args) throws Exception { + syncDeleteDeploymentResourcePoolDeploymentresourcepoolname(); + } + + public static void syncDeleteDeploymentResourcePoolDeploymentresourcepoolname() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + DeploymentResourcePoolName name = + DeploymentResourcePoolName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]"); + deploymentResourcePoolServiceClient.deleteDeploymentResourcePoolAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_Deploymentresourcepoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolString.java new file mode 100644 index 000000000000..289b86b87cdd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/deletedeploymentresourcepool/SyncDeleteDeploymentResourcePoolString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_String_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDeploymentResourcePoolString { + + public static void main(String[] args) throws Exception { + syncDeleteDeploymentResourcePoolString(); + } + + public static void syncDeleteDeploymentResourcePoolString() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + String name = + DeploymentResourcePoolName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString(); + deploymentResourcePoolServiceClient.deleteDeploymentResourcePoolAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_DeleteDeploymentResourcePool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/AsyncGetDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/AsyncGetDeploymentResourcePool.java new file mode 100644 index 000000000000..239e49bbcd31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/AsyncGetDeploymentResourcePool.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetDeploymentResourcePoolRequest; + +public class AsyncGetDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + asyncGetDeploymentResourcePool(); + } + + public static void asyncGetDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetDeploymentResourcePoolRequest request = + GetDeploymentResourcePoolRequest.newBuilder() + .setName( + DeploymentResourcePoolName.of( + "[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString()) + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient + .getDeploymentResourcePoolCallable() + .futureCall(request); + // Do something. + DeploymentResourcePool response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java new file mode 100644 index 000000000000..76fb269afc95 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetDeploymentResourcePoolRequest; + +public class SyncGetDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + syncGetDeploymentResourcePool(); + } + + public static void syncGetDeploymentResourcePool() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetDeploymentResourcePoolRequest request = + GetDeploymentResourcePoolRequest.newBuilder() + .setName( + DeploymentResourcePoolName.of( + "[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString()) + .build(); + DeploymentResourcePool response = + deploymentResourcePoolServiceClient.getDeploymentResourcePool(request); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolDeploymentresourcepoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolDeploymentresourcepoolname.java new file mode 100644 index 000000000000..539f8ac87a02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolDeploymentresourcepoolname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_Deploymentresourcepoolname_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; + +public class SyncGetDeploymentResourcePoolDeploymentresourcepoolname { + + public static void main(String[] args) throws Exception { + syncGetDeploymentResourcePoolDeploymentresourcepoolname(); + } + + public static void syncGetDeploymentResourcePoolDeploymentresourcepoolname() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + DeploymentResourcePoolName name = + DeploymentResourcePoolName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]"); + DeploymentResourcePool response = + deploymentResourcePoolServiceClient.getDeploymentResourcePool(name); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_Deploymentresourcepoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolString.java new file mode 100644 index 000000000000..2e46387d51be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getdeploymentresourcepool/SyncGetDeploymentResourcePoolString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_String_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolName; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; + +public class SyncGetDeploymentResourcePoolString { + + public static void main(String[] args) throws Exception { + syncGetDeploymentResourcePoolString(); + } + + public static void syncGetDeploymentResourcePoolString() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + String name = + DeploymentResourcePoolName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]") + .toString(); + DeploymentResourcePool response = + deploymentResourcePoolServiceClient.getDeploymentResourcePool(name); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetDeploymentResourcePool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..7b7cec3bd561 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..8401e31c40dc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = deploymentResourcePoolServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..acfb8e62e301 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + deploymentResourcePoolServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..296f0412f2a9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = deploymentResourcePoolServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePools.java new file mode 100644 index 000000000000..59d57457618b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePools.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDeploymentResourcePoolsRequest; +import com.google.cloud.aiplatform.v1beta1.ProjectName; + +public class AsyncListDeploymentResourcePools { + + public static void main(String[] args) throws Exception { + asyncListDeploymentResourcePools(); + } + + public static void asyncListDeploymentResourcePools() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListDeploymentResourcePoolsRequest request = + ListDeploymentResourcePoolsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient + .listDeploymentResourcePoolsPagedCallable() + .futureCall(request); + // Do something. + for (DeploymentResourcePool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePoolsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePoolsPaged.java new file mode 100644 index 000000000000..6c644c97a091 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/AsyncListDeploymentResourcePoolsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDeploymentResourcePoolsRequest; +import com.google.cloud.aiplatform.v1beta1.ListDeploymentResourcePoolsResponse; +import com.google.cloud.aiplatform.v1beta1.ProjectName; +import com.google.common.base.Strings; + +public class AsyncListDeploymentResourcePoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListDeploymentResourcePoolsPaged(); + } + + public static void asyncListDeploymentResourcePoolsPaged() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListDeploymentResourcePoolsRequest request = + ListDeploymentResourcePoolsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListDeploymentResourcePoolsResponse response = + deploymentResourcePoolServiceClient.listDeploymentResourcePoolsCallable().call(request); + for (DeploymentResourcePool element : response.getDeploymentResourcePoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePools.java new file mode 100644 index 000000000000..5c02dbd3ab75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePools.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDeploymentResourcePoolsRequest; +import com.google.cloud.aiplatform.v1beta1.ProjectName; + +public class SyncListDeploymentResourcePools { + + public static void main(String[] args) throws Exception { + syncListDeploymentResourcePools(); + } + + public static void syncListDeploymentResourcePools() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListDeploymentResourcePoolsRequest request = + ListDeploymentResourcePoolsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (DeploymentResourcePool element : + deploymentResourcePoolServiceClient.listDeploymentResourcePools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsProjectname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsProjectname.java new file mode 100644 index 000000000000..3dfc94b09fcb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsProjectname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_Projectname_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.ProjectName; + +public class SyncListDeploymentResourcePoolsProjectname { + + public static void main(String[] args) throws Exception { + syncListDeploymentResourcePoolsProjectname(); + } + + public static void syncListDeploymentResourcePoolsProjectname() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (DeploymentResourcePool element : + deploymentResourcePoolServiceClient.listDeploymentResourcePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_Projectname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsString.java new file mode 100644 index 000000000000..5d6291f89e52 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listdeploymentresourcepools/SyncListDeploymentResourcePoolsString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_String_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePool; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.ProjectName; + +public class SyncListDeploymentResourcePoolsString { + + public static void main(String[] args) throws Exception { + syncListDeploymentResourcePoolsString(); + } + + public static void syncListDeploymentResourcePoolsString() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (DeploymentResourcePool element : + deploymentResourcePoolServiceClient.listDeploymentResourcePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListDeploymentResourcePools_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..092e34445217 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..e7db6000e19c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + deploymentResourcePoolServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..36bb07ece3cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/listlocations/SyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : + deploymentResourcePoolServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModels.java new file mode 100644 index 000000000000..bb268aef9870 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModels.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryDeployedModelsRequest; + +public class AsyncQueryDeployedModels { + + public static void main(String[] args) throws Exception { + asyncQueryDeployedModels(); + } + + public static void asyncQueryDeployedModels() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + QueryDeployedModelsRequest request = + QueryDeployedModelsRequest.newBuilder() + .setDeploymentResourcePool("deploymentResourcePool-1928845137") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient + .queryDeployedModelsPagedCallable() + .futureCall(request); + // Do something. + for (DeployedModel element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModelsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModelsPaged.java new file mode 100644 index 000000000000..0bc77ce023b4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/AsyncQueryDeployedModelsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryDeployedModelsRequest; +import com.google.cloud.aiplatform.v1beta1.QueryDeployedModelsResponse; +import com.google.common.base.Strings; + +public class AsyncQueryDeployedModelsPaged { + + public static void main(String[] args) throws Exception { + asyncQueryDeployedModelsPaged(); + } + + public static void asyncQueryDeployedModelsPaged() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + QueryDeployedModelsRequest request = + QueryDeployedModelsRequest.newBuilder() + .setDeploymentResourcePool("deploymentResourcePool-1928845137") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + QueryDeployedModelsResponse response = + deploymentResourcePoolServiceClient.queryDeployedModelsCallable().call(request); + for (DeployedModel element : response.getDeployedModelsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModels.java new file mode 100644 index 000000000000..c8498219c039 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModels.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryDeployedModelsRequest; + +public class SyncQueryDeployedModels { + + public static void main(String[] args) throws Exception { + syncQueryDeployedModels(); + } + + public static void syncQueryDeployedModels() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + QueryDeployedModelsRequest request = + QueryDeployedModelsRequest.newBuilder() + .setDeploymentResourcePool("deploymentResourcePool-1928845137") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (DeployedModel element : + deploymentResourcePoolServiceClient.queryDeployedModels(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModelsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModelsString.java new file mode 100644 index 000000000000..5d1bb909fc27 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/querydeployedmodels/SyncQueryDeployedModelsString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_String_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; + +public class SyncQueryDeployedModelsString { + + public static void main(String[] args) throws Exception { + syncQueryDeployedModelsString(); + } + + public static void syncQueryDeployedModelsString() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + String deploymentResourcePool = "deploymentResourcePool-1928845137"; + for (DeployedModel element : + deploymentResourcePoolServiceClient + .queryDeployedModels(deploymentResourcePool) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_QueryDeployedModels_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..9da205bbc719 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..0646f2d6e6a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = deploymentResourcePoolServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..ee151c1e406e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + deploymentResourcePoolServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..39271e267700 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient = + DeploymentResourcePoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = + deploymentResourcePoolServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservicesettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservicesettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java new file mode 100644 index 000000000000..e4fa86fd1eb5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/deploymentresourcepoolservicesettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolServiceSettings_GetDeploymentResourcePool_sync] +import com.google.cloud.aiplatform.v1beta1.DeploymentResourcePoolServiceSettings; +import java.time.Duration; + +public class SyncGetDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + syncGetDeploymentResourcePool(); + } + + public static void syncGetDeploymentResourcePool() throws Exception { + // 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 + DeploymentResourcePoolServiceSettings.Builder deploymentResourcePoolServiceSettingsBuilder = + DeploymentResourcePoolServiceSettings.newBuilder(); + deploymentResourcePoolServiceSettingsBuilder + .getDeploymentResourcePoolSettings() + .setRetrySettings( + deploymentResourcePoolServiceSettingsBuilder + .getDeploymentResourcePoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettings = + deploymentResourcePoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolServiceSettings_GetDeploymentResourcePool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..9c6c9ceaae17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + EndpointServiceSettings endpointServiceSettings = + EndpointServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + EndpointServiceClient endpointServiceClient = + EndpointServiceClient.create(endpointServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_EndpointService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..ac3859da155e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + EndpointServiceSettings endpointServiceSettings = + EndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + EndpointServiceClient endpointServiceClient = + EndpointServiceClient.create(endpointServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_EndpointService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpoint.java new file mode 100644 index 000000000000..88223eb327b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateEndpoint { + + public static void main(String[] args) throws Exception { + asyncCreateEndpoint(); + } + + public static void asyncCreateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + CreateEndpointRequest request = + CreateEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setEndpoint(Endpoint.newBuilder().build()) + .setEndpointId("endpointId-1837754992") + .build(); + ApiFuture future = + endpointServiceClient.createEndpointCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java new file mode 100644 index 000000000000..fd10146c384e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/AsyncCreateEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateEndpointOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncCreateEndpointLRO(); + } + + public static void asyncCreateEndpointLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + CreateEndpointRequest request = + CreateEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setEndpoint(Endpoint.newBuilder().build()) + .setEndpointId("endpointId-1837754992") + .build(); + OperationFuture future = + endpointServiceClient.createEndpointOperationCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpoint.java new file mode 100644 index 000000000000..885c1e142b99 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.CreateEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpoint(); + } + + public static void syncCreateEndpoint() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java new file mode 100644 index 000000000000..4106fbd88b08 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpoint.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LocationnameEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateEndpointLocationnameEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpointLocationnameEndpoint(); + } + + public static void syncCreateEndpointLocationnameEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Endpoint endpoint = Endpoint.newBuilder().build(); + Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LocationnameEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java new file mode 100644 index 000000000000..356930e5b560 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointLocationnameEndpointString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LocationnameEndpointString_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateEndpointLocationnameEndpointString { + + public static void main(String[] args) throws Exception { + syncCreateEndpointLocationnameEndpointString(); + } + + public static void syncCreateEndpointLocationnameEndpointString() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_LocationnameEndpointString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java new file mode 100644 index 000000000000..d2349b92bd43 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpoint.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_StringEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateEndpointStringEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateEndpointStringEndpoint(); + } + + public static void syncCreateEndpointStringEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Endpoint endpoint = Endpoint.newBuilder().build(); + Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_StringEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java new file mode 100644 index 000000000000..96cce3068971 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/createendpoint/SyncCreateEndpointStringEndpointString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_StringEndpointString_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateEndpointStringEndpointString { + + public static void main(String[] args) throws Exception { + syncCreateEndpointStringEndpointString(); + } + + public static void syncCreateEndpointStringEndpointString() throws Exception { + // 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 (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(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_CreateEndpoint_StringEndpointString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java new file mode 100644 index 000000000000..069cfe22e75d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteEndpoint { + + public static void main(String[] args) throws Exception { + asyncDeleteEndpoint(); + } + + public static void asyncDeleteEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + ApiFuture future = + endpointServiceClient.deleteEndpointCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java new file mode 100644 index 000000000000..6c9e4928f76b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/AsyncDeleteEndpointLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteEndpointLRO(); + } + + public static void asyncDeleteEndpointLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + OperationFuture future = + endpointServiceClient.deleteEndpointOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java new file mode 100644 index 000000000000..a21a5582be90 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpoint { + + public static void main(String[] args) throws Exception { + syncDeleteEndpoint(); + } + + public static void syncDeleteEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeleteEndpointRequest request = + DeleteEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + endpointServiceClient.deleteEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java new file mode 100644 index 000000000000..0b447f622aad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointEndpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_Endpointname_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpointEndpointname { + + public static void main(String[] args) throws Exception { + syncDeleteEndpointEndpointname(); + } + + public static void syncDeleteEndpointEndpointname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + endpointServiceClient.deleteEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_Endpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java new file mode 100644 index 000000000000..30c8415b82ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deleteendpoint/SyncDeleteEndpointString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_String_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEndpointString { + + public static void main(String[] args) throws Exception { + syncDeleteEndpointString(); + } + + public static void syncDeleteEndpointString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + endpointServiceClient.deleteEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeleteEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModel.java new file mode 100644 index 000000000000..87e3b5af99fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModel.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeployModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeployModelRequest; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.longrunning.Operation; +import java.util.HashMap; + +public class AsyncDeployModel { + + public static void main(String[] args) throws Exception { + asyncDeployModel(); + } + + public static void asyncDeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + ApiFuture future = endpointServiceClient.deployModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeployModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModelLRO.java new file mode 100644 index 000000000000..0d300418c103 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/AsyncDeployModelLRO.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeployModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeployModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeployModelRequest; +import com.google.cloud.aiplatform.v1beta1.DeployModelResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import java.util.HashMap; + +public class AsyncDeployModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeployModelLRO(); + } + + public static void asyncDeployModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + OperationFuture future = + endpointServiceClient.deployModelOperationCallable().futureCall(request); + // Do something. + DeployModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeployModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModel.java new file mode 100644 index 000000000000..a2dc97023a0c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeployModel_sync] +import com.google.cloud.aiplatform.v1beta1.DeployModelRequest; +import com.google.cloud.aiplatform.v1beta1.DeployModelResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import java.util.HashMap; + +public class SyncDeployModel { + + public static void main(String[] args) throws Exception { + syncDeployModel(); + } + + public static void syncDeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + DeployModelRequest request = + DeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .putAllTrafficSplit(new HashMap()) + .build(); + DeployModelResponse response = endpointServiceClient.deployModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeployModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java new file mode 100644 index 000000000000..8320bfea1d75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelEndpointnameDeployedmodelMapstringinteger.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeployModel_EndpointnameDeployedmodelMapstringinteger_sync] +import com.google.cloud.aiplatform.v1beta1.DeployModelResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import java.util.HashMap; +import java.util.Map; + +public class SyncDeployModelEndpointnameDeployedmodelMapstringinteger { + + public static void main(String[] args) throws Exception { + syncDeployModelEndpointnameDeployedmodelMapstringinteger(); + } + + public static void syncDeployModelEndpointnameDeployedmodelMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + Map trafficSplit = new HashMap<>(); + DeployModelResponse response = + endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeployModel_EndpointnameDeployedmodelMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java new file mode 100644 index 000000000000..df78481499be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/deploymodel/SyncDeployModelStringDeployedmodelMapstringinteger.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_DeployModel_StringDeployedmodelMapstringinteger_sync] +import com.google.cloud.aiplatform.v1beta1.DeployModelResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import java.util.HashMap; +import java.util.Map; + +public class SyncDeployModelStringDeployedmodelMapstringinteger { + + public static void main(String[] args) throws Exception { + syncDeployModelStringDeployedmodelMapstringinteger(); + } + + public static void syncDeployModelStringDeployedmodelMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + Map trafficSplit = new HashMap<>(); + DeployModelResponse response = + endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_DeployModel_StringDeployedmodelMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/AsyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/AsyncGetEndpoint.java new file mode 100644 index 000000000000..a179c4a4a12a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/AsyncGetEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetEndpointRequest; + +public class AsyncGetEndpoint { + + public static void main(String[] args) throws Exception { + asyncGetEndpoint(); + } + + public static void asyncGetEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetEndpointRequest request = + GetEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + ApiFuture future = endpointServiceClient.getEndpointCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..d4499845f71d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetEndpointRequest; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetEndpointRequest request = + GetEndpointRequest.newBuilder() + .setName( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .build(); + Endpoint response = endpointServiceClient.getEndpoint(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java new file mode 100644 index 000000000000..beef6779944f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointEndpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetEndpoint_Endpointname_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; + +public class SyncGetEndpointEndpointname { + + public static void main(String[] args) throws Exception { + syncGetEndpointEndpointname(); + } + + public static void syncGetEndpointEndpointname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + Endpoint response = endpointServiceClient.getEndpoint(name); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetEndpoint_Endpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointString.java new file mode 100644 index 000000000000..15fe87d83ed2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getendpoint/SyncGetEndpointString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetEndpoint_String_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; + +public class SyncGetEndpointString { + + public static void main(String[] args) throws Exception { + syncGetEndpointString(); + } + + public static void syncGetEndpointString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String name = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + Endpoint response = endpointServiceClient.getEndpoint(name); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..2e80c09b9667 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = endpointServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..f6803676fb11 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = endpointServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..18abd459ae7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = endpointServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..7e1f72699dd4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = endpointServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpoints.java new file mode 100644 index 000000000000..a1581f4db5c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpoints.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListEndpoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListEndpoints { + + public static void main(String[] args) throws Exception { + asyncListEndpoints(); + } + + public static void asyncListEndpoints() throws Exception { + // 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 (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 future = + endpointServiceClient.listEndpointsPagedCallable().futureCall(request); + // Do something. + for (Endpoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListEndpoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpointsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpointsPaged.java new file mode 100644 index 000000000000..d35bb019965f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/AsyncListEndpointsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListEndpoints_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.ListEndpointsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListEndpointsPaged { + + public static void main(String[] args) throws Exception { + asyncListEndpointsPaged(); + } + + public static void asyncListEndpointsPaged() throws Exception { + // 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 (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.getEndpointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListEndpoints_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpoints.java new file mode 100644 index 000000000000..21003cad3080 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpoints.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListEndpoints_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListEndpoints { + + public static void main(String[] args) throws Exception { + syncListEndpoints(); + } + + public static void syncListEndpoints() throws Exception { + // 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 (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); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListEndpoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsLocationname.java new file mode 100644 index 000000000000..bc371a3aea97 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListEndpoints_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListEndpointsLocationname { + + public static void main(String[] args) throws Exception { + syncListEndpointsLocationname(); + } + + public static void syncListEndpointsLocationname() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListEndpoints_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsString.java new file mode 100644 index 000000000000..e05ba05ea9b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listendpoints/SyncListEndpointsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListEndpoints_String_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListEndpointsString { + + public static void main(String[] args) throws Exception { + syncListEndpointsString(); + } + + public static void syncListEndpointsString() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListEndpoints_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..63d83e30e6ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + endpointServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..bb4755cafb91 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + endpointServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..ad07c3a752db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : endpointServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java new file mode 100644 index 000000000000..97fa2fc1ca23 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModel.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncMutateDeployedModel { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedModel(); + } + + public static void asyncMutateDeployedModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + endpointServiceClient.mutateDeployedModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java new file mode 100644 index 000000000000..e41544bf88e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/AsyncMutateDeployedModelLRO.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelRequest; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class AsyncMutateDeployedModelLRO { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedModelLRO(); + } + + public static void asyncMutateDeployedModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + endpointServiceClient.mutateDeployedModelOperationCallable().futureCall(request); + // Do something. + MutateDeployedModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java new file mode 100644 index 000000000000..345730faccfb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModel.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelRequest; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModel { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModel(); + } + + public static void syncMutateDeployedModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + MutateDeployedModelRequest request = + MutateDeployedModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModel(DeployedModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java new file mode 100644 index 000000000000..a630792336c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_EndpointnameDeployedmodelFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModelEndpointnameDeployedmodelFieldmask { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModelEndpointnameDeployedmodelFieldmask(); + } + + public static void syncMutateDeployedModelEndpointnameDeployedmodelFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_EndpointnameDeployedmodelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java new file mode 100644 index 000000000000..efd82777de6c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/mutatedeployedmodel/SyncMutateDeployedModelStringDeployedmodelFieldmask.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_StringDeployedmodelFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedModel; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedModelResponse; +import com.google.protobuf.FieldMask; + +public class SyncMutateDeployedModelStringDeployedmodelFieldmask { + + public static void main(String[] args) throws Exception { + syncMutateDeployedModelStringDeployedmodelFieldmask(); + } + + public static void syncMutateDeployedModelStringDeployedmodelFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + DeployedModel deployedModel = DeployedModel.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + MutateDeployedModelResponse response = + endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_MutateDeployedModel_StringDeployedmodelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..b0c01dade2ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = endpointServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..93237a672453 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = endpointServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..47a7a5cc58ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + endpointServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..1cc14323cd67 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = endpointServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModel.java new file mode 100644 index 000000000000..e368b75bd93d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModel.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UndeployModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployModelRequest; +import com.google.longrunning.Operation; +import java.util.HashMap; + +public class AsyncUndeployModel { + + public static void main(String[] args) throws Exception { + asyncUndeployModel(); + } + + public static void asyncUndeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + ApiFuture future = + endpointServiceClient.undeployModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UndeployModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java new file mode 100644 index 000000000000..839ddd39b14a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/AsyncUndeployModelLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UndeployModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UndeployModelRequest; +import com.google.cloud.aiplatform.v1beta1.UndeployModelResponse; +import java.util.HashMap; + +public class AsyncUndeployModelLRO { + + public static void main(String[] args) throws Exception { + asyncUndeployModelLRO(); + } + + public static void asyncUndeployModelLRO() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + OperationFuture future = + endpointServiceClient.undeployModelOperationCallable().futureCall(request); + // Do something. + UndeployModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UndeployModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModel.java new file mode 100644 index 000000000000..7e1b07daaacc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModel.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UndeployModel_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployModelRequest; +import com.google.cloud.aiplatform.v1beta1.UndeployModelResponse; +import java.util.HashMap; + +public class SyncUndeployModel { + + public static void main(String[] args) throws Exception { + syncUndeployModel(); + } + + public static void syncUndeployModel() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UndeployModelRequest request = + UndeployModelRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .putAllTrafficSplit(new HashMap()) + .build(); + UndeployModelResponse response = endpointServiceClient.undeployModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UndeployModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java new file mode 100644 index 000000000000..8fcd60dae601 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelEndpointnameStringMapstringinteger.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UndeployModel_EndpointnameStringMapstringinteger_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployModelResponse; +import java.util.HashMap; +import java.util.Map; + +public class SyncUndeployModelEndpointnameStringMapstringinteger { + + public static void main(String[] args) throws Exception { + syncUndeployModelEndpointnameStringMapstringinteger(); + } + + public static void syncUndeployModelEndpointnameStringMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + String deployedModelId = "deployedModelId-1817547906"; + Map trafficSplit = new HashMap<>(); + UndeployModelResponse response = + endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UndeployModel_EndpointnameStringMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java new file mode 100644 index 000000000000..afda6ece2862 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/undeploymodel/SyncUndeployModelStringStringMapstringinteger.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UndeployModel_StringStringMapstringinteger_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployModelResponse; +import java.util.HashMap; +import java.util.Map; + +public class SyncUndeployModelStringStringMapstringinteger { + + public static void main(String[] args) throws Exception { + syncUndeployModelStringStringMapstringinteger(); + } + + public static void syncUndeployModelStringStringMapstringinteger() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + String deployedModelId = "deployedModelId-1817547906"; + Map trafficSplit = new HashMap<>(); + UndeployModelResponse response = + endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UndeployModel_StringStringMapstringinteger_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java new file mode 100644 index 000000000000..9469d4ead4a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/AsyncUpdateEndpoint.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateEndpointRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateEndpoint { + + public static void main(String[] args) throws Exception { + asyncUpdateEndpoint(); + } + + public static void asyncUpdateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UpdateEndpointRequest request = + UpdateEndpointRequest.newBuilder() + .setEndpoint(Endpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + endpointServiceClient.updateEndpointCallable().futureCall(request); + // Do something. + Endpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpoint.java new file mode 100644 index 000000000000..8712fec6bfe8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpoint.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateEndpointRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEndpoint { + + public static void main(String[] args) throws Exception { + syncUpdateEndpoint(); + } + + public static void syncUpdateEndpoint() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + UpdateEndpointRequest request = + UpdateEndpointRequest.newBuilder() + .setEndpoint(Endpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Endpoint response = endpointServiceClient.updateEndpoint(request); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java new file mode 100644 index 000000000000..cd420eee101a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservice/updateendpoint/SyncUpdateEndpointEndpointFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_EndpointFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Endpoint; +import com.google.cloud.aiplatform.v1beta1.EndpointServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEndpointEndpointFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateEndpointEndpointFieldmask(); + } + + public static void syncUpdateEndpointEndpointFieldmask() throws Exception { + // 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { + Endpoint endpoint = Endpoint.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Endpoint response = endpointServiceClient.updateEndpoint(endpoint, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_EndpointService_UpdateEndpoint_EndpointFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservicesettings/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservicesettings/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..885aa160ddca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/endpointservicesettings/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_EndpointServiceSettings_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointServiceSettings; +import java.time.Duration; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 + EndpointServiceSettings.Builder endpointServiceSettingsBuilder = + EndpointServiceSettings.newBuilder(); + endpointServiceSettingsBuilder + .getEndpointSettings() + .setRetrySettings( + endpointServiceSettingsBuilder + .getEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EndpointServiceSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_EndpointServiceSettings_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5bf8dbf665e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + FeaturestoreOnlineServingServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create(featurestoreOnlineServingServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..9184bd521985 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + FeaturestoreOnlineServingServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create(featurestoreOnlineServingServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..f387d60d9403 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..43a999c599e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = featurestoreOnlineServingServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..b9da67b8107c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..4bd69f4a65f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = featurestoreOnlineServingServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..e08d9398655f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..be3dfd0e5351 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + featurestoreOnlineServingServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..84ca4e1d2d8e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/listlocations/SyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : + featurestoreOnlineServingServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java new file mode 100644 index 000000000000..b6aa53be04de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/AsyncReadFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse; + +public class AsyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncReadFeatureValues(); + } + + public static void asyncReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ReadFeatureValuesRequest request = + ReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityId("entityId-2102099874") + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.readFeatureValuesCallable().futureCall(request); + // Do something. + ReadFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..186ab1c799b2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + ReadFeatureValuesRequest request = + ReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityId("entityId-2102099874") + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..f57270162a05 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesEntitytypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncReadFeatureValuesEntitytypename(); + } + + public static void syncReadFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(entityType); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java new file mode 100644 index 000000000000..efbe7945d8db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/readfeaturevalues/SyncReadFeatureValuesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse; + +public class SyncReadFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncReadFeatureValuesString(); + } + + public static void syncReadFeatureValuesString() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ReadFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.readFeatureValues(entityType); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..9e4e6b951762 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..7d01a3b22c43 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = featurestoreOnlineServingServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java new file mode 100644 index 000000000000..c53b9e43db6d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/streamingreadfeaturevalues/AsyncStreamingReadFeatureValues.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_StreamingReadFeatureValues_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.StreamingReadFeatureValuesRequest; +import java.util.ArrayList; + +public class AsyncStreamingReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncStreamingReadFeatureValues(); + } + + public static void asyncStreamingReadFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + StreamingReadFeatureValuesRequest request = + StreamingReadFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllEntityIds(new ArrayList()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .build(); + ServerStream stream = + featurestoreOnlineServingServiceClient.streamingReadFeatureValuesCallable().call(request); + for (ReadFeatureValuesResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_StreamingReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..81205c561ed8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..522b27d01d68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = + featurestoreOnlineServingServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java new file mode 100644 index 000000000000..99500f1f0a96 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/AsyncWriteFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse; +import java.util.ArrayList; + +public class AsyncWriteFeatureValues { + + public static void main(String[] args) throws Exception { + asyncWriteFeatureValues(); + } + + public static void asyncWriteFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + WriteFeatureValuesRequest request = + WriteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllPayloads(new ArrayList()) + .build(); + ApiFuture future = + featurestoreOnlineServingServiceClient.writeFeatureValuesCallable().futureCall(request); + // Do something. + WriteFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java new file mode 100644 index 000000000000..5dbc19d903a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse; +import java.util.ArrayList; + +public class SyncWriteFeatureValues { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValues(); + } + + public static void syncWriteFeatureValues() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + WriteFeatureValuesRequest request = + WriteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllPayloads(new ArrayList()) + .build(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java new file mode 100644 index 000000000000..b60257ae2ec6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_EntitytypenameListwritefeaturevaluespayload_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload(); + } + + public static void syncWriteFeatureValuesEntitytypenameListwritefeaturevaluespayload() + throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + List payloads = new ArrayList<>(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_EntitytypenameListwritefeaturevaluespayload_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java new file mode 100644 index 000000000000..157f691d0bdd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservice/writefeaturevalues/SyncWriteFeatureValuesStringListwritefeaturevaluespayload.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_StringListwritefeaturevaluespayload_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesPayload; +import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteFeatureValuesStringListwritefeaturevaluespayload { + + public static void main(String[] args) throws Exception { + syncWriteFeatureValuesStringListwritefeaturevaluespayload(); + } + + public static void syncWriteFeatureValuesStringListwritefeaturevaluespayload() throws Exception { + // 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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = + FeaturestoreOnlineServingServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + List payloads = new ArrayList<>(); + WriteFeatureValuesResponse response = + featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingService_WriteFeatureValues_StringListwritefeaturevaluespayload_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..421e0d4011cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreonlineservingservicesettings/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingServiceSettings_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceSettings; +import java.time.Duration; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 + FeaturestoreOnlineServingServiceSettings.Builder + featurestoreOnlineServingServiceSettingsBuilder = + FeaturestoreOnlineServingServiceSettings.newBuilder(); + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings( + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings = + featurestoreOnlineServingServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingServiceSettings_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java new file mode 100644 index 000000000000..2f2d9cb7287c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeatures.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchCreateFeatures { + + public static void main(String[] args) throws Exception { + asyncBatchCreateFeatures(); + } + + public static void asyncBatchCreateFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.batchCreateFeaturesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java new file mode 100644 index 000000000000..f38d23d21f2b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/AsyncBatchCreateFeaturesLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateFeaturesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchCreateFeaturesLRO(); + } + + public static void asyncBatchCreateFeaturesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + OperationFuture future = + featurestoreServiceClient.batchCreateFeaturesOperationCallable().futureCall(request); + // Do something. + BatchCreateFeaturesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java new file mode 100644 index 000000000000..967d2ed50d1f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeatures.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateFeatures { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeatures(); + } + + public static void syncBatchCreateFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchCreateFeaturesRequest request = + BatchCreateFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java new file mode 100644 index 000000000000..b7a0bba08822 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_EntitytypenameListcreatefeaturerequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest(); + } + + public static void syncBatchCreateFeaturesEntitytypenameListcreatefeaturerequest() + throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + List requests = new ArrayList<>(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(parent, requests).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_EntitytypenameListcreatefeaturerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java new file mode 100644 index 000000000000..11e545bc19af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchcreatefeatures/SyncBatchCreateFeaturesStringListcreatefeaturerequest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_StringListcreatefeaturerequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateFeaturesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateFeaturesStringListcreatefeaturerequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateFeaturesStringListcreatefeaturerequest(); + } + + public static void syncBatchCreateFeaturesStringListcreatefeaturerequest() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateFeaturesResponse response = + featurestoreServiceClient.batchCreateFeaturesAsync(parent, requests).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchCreateFeatures_StringListcreatefeaturerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java new file mode 100644 index 000000000000..7e34f15ac6bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValues.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncBatchReadFeatureValues { + + public static void main(String[] args) throws Exception { + asyncBatchReadFeatureValues(); + } + + public static void asyncBatchReadFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.batchReadFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java new file mode 100644 index 000000000000..3d4fec3e916a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/AsyncBatchReadFeatureValuesLRO.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncBatchReadFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchReadFeatureValuesLRO(); + } + + public static void asyncBatchReadFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + OperationFuture + future = + featurestoreServiceClient + .batchReadFeatureValuesOperationCallable() + .futureCall(request); + // Do something. + BatchReadFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java new file mode 100644 index 000000000000..fe675ca4140d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class SyncBatchReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValues(); + } + + public static void syncBatchReadFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + BatchReadFeatureValuesRequest request = + BatchReadFeatureValuesRequest.newBuilder() + .setFeaturestore( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .addAllPassThroughFields( + new ArrayList()) + .addAllEntityTypeSpecs(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .build(); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java new file mode 100644 index 000000000000..565c5dcfe23c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesFeaturestorename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_Featurestorename_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncBatchReadFeatureValuesFeaturestorename { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValuesFeaturestorename(); + } + + public static void syncBatchReadFeatureValuesFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName featurestore = + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(featurestore).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java new file mode 100644 index 000000000000..31562e304ff3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/batchreadfeaturevalues/SyncBatchReadFeatureValuesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncBatchReadFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncBatchReadFeatureValuesString(); + } + + public static void syncBatchReadFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String featurestore = + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + BatchReadFeatureValuesResponse response = + featurestoreServiceClient.batchReadFeatureValuesAsync(featurestore).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..1616531d94f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + FeaturestoreServiceSettings featurestoreServiceSettings = + FeaturestoreServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + FeaturestoreServiceClient featurestoreServiceClient = + FeaturestoreServiceClient.create(featurestoreServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..50ffce08a461 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + FeaturestoreServiceSettings featurestoreServiceSettings = + FeaturestoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + FeaturestoreServiceClient featurestoreServiceClient = + FeaturestoreServiceClient.create(featurestoreServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityType.java new file mode 100644 index 000000000000..1d9e9bac6b33 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityType.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateEntityType { + + public static void main(String[] args) throws Exception { + asyncCreateEntityType(); + } + + public static void asyncCreateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + ApiFuture future = + featurestoreServiceClient.createEntityTypeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java new file mode 100644 index 000000000000..14fe2bb0407a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/AsyncCreateEntityTypeLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateEntityTypeOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class AsyncCreateEntityTypeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateEntityTypeLRO(); + } + + public static void asyncCreateEntityTypeLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + OperationFuture future = + featurestoreServiceClient.createEntityTypeOperationCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityType.java new file mode 100644 index 000000000000..ace736262b84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityType.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_sync] +import com.google.cloud.aiplatform.v1beta1.CreateEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateEntityType { + + public static void main(String[] args) throws Exception { + syncCreateEntityType(); + } + + public static void syncCreateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateEntityTypeRequest request = + CreateEntityTypeRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setEntityType(EntityType.newBuilder().build()) + .setEntityTypeId("entityTypeId767740856") + .build(); + EntityType response = featurestoreServiceClient.createEntityTypeAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java new file mode 100644 index 000000000000..7cab9a3d805b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytype.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytype_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeFeaturestorenameEntitytype { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeFeaturestorenameEntitytype(); + } + + public static void syncCreateEntityTypeFeaturestorenameEntitytype() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + EntityType entityType = EntityType.newBuilder().build(); + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytype_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java new file mode 100644 index 000000000000..7b0db18e0f72 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeFeaturestorenameEntitytypeString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytypeString_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeFeaturestorenameEntitytypeString { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeFeaturestorenameEntitytypeString(); + } + + public static void syncCreateEntityTypeFeaturestorenameEntitytypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + EntityType entityType = EntityType.newBuilder().build(); + String entityTypeId = "entityTypeId767740856"; + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType, entityTypeId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_FeaturestorenameEntitytypeString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java new file mode 100644 index 000000000000..1c799580a088 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytype.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_StringEntitytype_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeStringEntitytype { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeStringEntitytype(); + } + + public static void syncCreateEntityTypeStringEntitytype() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + EntityType entityType = EntityType.newBuilder().build(); + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_StringEntitytype_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java new file mode 100644 index 000000000000..ffca4be39763 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createentitytype/SyncCreateEntityTypeStringEntitytypeString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_StringEntitytypeString_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateEntityTypeStringEntitytypeString { + + public static void main(String[] args) throws Exception { + syncCreateEntityTypeStringEntitytypeString(); + } + + public static void syncCreateEntityTypeStringEntitytypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + EntityType entityType = EntityType.newBuilder().build(); + String entityTypeId = "entityTypeId767740856"; + EntityType response = + featurestoreServiceClient.createEntityTypeAsync(parent, entityType, entityTypeId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateEntityType_StringEntitytypeString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeature.java new file mode 100644 index 000000000000..681d5375dcb6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeature.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateFeature { + + public static void main(String[] args) throws Exception { + asyncCreateFeature(); + } + + public static void asyncCreateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + ApiFuture future = + featurestoreServiceClient.createFeatureCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java new file mode 100644 index 000000000000..68d4946eba07 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/AsyncCreateFeatureLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class AsyncCreateFeatureLRO { + + public static void main(String[] args) throws Exception { + asyncCreateFeatureLRO(); + } + + public static void asyncCreateFeatureLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + OperationFuture future = + featurestoreServiceClient.createFeatureOperationCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeature.java new file mode 100644 index 000000000000..b260490d435e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeature.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_sync] +import com.google.cloud.aiplatform.v1beta1.CreateFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeature(); + } + + public static void syncCreateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeatureRequest request = + CreateFeatureRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFeature(Feature.newBuilder().build()) + .setFeatureId("featureId-420503887") + .build(); + Feature response = featurestoreServiceClient.createFeatureAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java new file mode 100644 index 000000000000..eebd6fb49d1e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeature.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeature_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateFeatureEntitytypenameFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeatureEntitytypenameFeature(); + } + + public static void syncCreateFeatureEntitytypenameFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + Feature feature = Feature.newBuilder().build(); + Feature response = featurestoreServiceClient.createFeatureAsync(parent, feature).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java new file mode 100644 index 000000000000..445393607891 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureEntitytypenameFeatureString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeatureString_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateFeatureEntitytypenameFeatureString { + + public static void main(String[] args) throws Exception { + syncCreateFeatureEntitytypenameFeatureString(); + } + + public static void syncCreateFeatureEntitytypenameFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + Feature feature = Feature.newBuilder().build(); + String featureId = "featureId-420503887"; + Feature response = + featurestoreServiceClient.createFeatureAsync(parent, feature, featureId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_EntitytypenameFeatureString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java new file mode 100644 index 000000000000..cd6b33e75a9b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeature.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_StringFeature_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateFeatureStringFeature { + + public static void main(String[] args) throws Exception { + syncCreateFeatureStringFeature(); + } + + public static void syncCreateFeatureStringFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + Feature feature = Feature.newBuilder().build(); + Feature response = featurestoreServiceClient.createFeatureAsync(parent, feature).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_StringFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java new file mode 100644 index 000000000000..972aaf4cfa40 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeature/SyncCreateFeatureStringFeatureString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_StringFeatureString_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncCreateFeatureStringFeatureString { + + public static void main(String[] args) throws Exception { + syncCreateFeatureStringFeatureString(); + } + + public static void syncCreateFeatureStringFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + Feature feature = Feature.newBuilder().build(); + String featureId = "featureId-420503887"; + Feature response = + featurestoreServiceClient.createFeatureAsync(parent, feature, featureId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeature_StringFeatureString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java new file mode 100644 index 000000000000..a1b15f988016 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestore.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateFeaturestore { + + public static void main(String[] args) throws Exception { + asyncCreateFeaturestore(); + } + + public static void asyncCreateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + ApiFuture future = + featurestoreServiceClient.createFeaturestoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java new file mode 100644 index 000000000000..795a149cfc69 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/AsyncCreateFeaturestoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncCreateFeaturestoreLRO(); + } + + public static void asyncCreateFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + OperationFuture future = + featurestoreServiceClient.createFeaturestoreOperationCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java new file mode 100644 index 000000000000..096b7b5ca26c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestore(); + } + + public static void syncCreateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + CreateFeaturestoreRequest request = + CreateFeaturestoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFeaturestore(Featurestore.newBuilder().build()) + .setFeaturestoreId("featurestoreId-1315851738") + .build(); + Featurestore response = featurestoreServiceClient.createFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java new file mode 100644 index 000000000000..a401e30d08c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestore.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateFeaturestoreLocationnameFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreLocationnameFeaturestore(); + } + + public static void syncCreateFeaturestoreLocationnameFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Featurestore featurestore = Featurestore.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.createFeaturestoreAsync(parent, featurestore).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java new file mode 100644 index 000000000000..62e7e76db7d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreLocationnameFeaturestoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestoreString_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateFeaturestoreLocationnameFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreLocationnameFeaturestoreString(); + } + + public static void syncCreateFeaturestoreLocationnameFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Featurestore featurestore = Featurestore.newBuilder().build(); + String featurestoreId = "featurestoreId-1315851738"; + Featurestore response = + featurestoreServiceClient + .createFeaturestoreAsync(parent, featurestore, featurestoreId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_LocationnameFeaturestoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java new file mode 100644 index 000000000000..497c12ffba77 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestore.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateFeaturestoreStringFeaturestore { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreStringFeaturestore(); + } + + public static void syncCreateFeaturestoreStringFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Featurestore featurestore = Featurestore.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.createFeaturestoreAsync(parent, featurestore).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java new file mode 100644 index 000000000000..13ec8ca31a03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/createfeaturestore/SyncCreateFeaturestoreStringFeaturestoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestoreString_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateFeaturestoreStringFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncCreateFeaturestoreStringFeaturestoreString(); + } + + public static void syncCreateFeaturestoreStringFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Featurestore featurestore = Featurestore.newBuilder().build(); + String featurestoreId = "featurestoreId-1315851738"; + Featurestore response = + featurestoreServiceClient + .createFeaturestoreAsync(parent, featurestore, featurestoreId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_CreateFeaturestore_StringFeaturestoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java new file mode 100644 index 000000000000..fca8865290fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityType.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteEntityType { + + public static void main(String[] args) throws Exception { + asyncDeleteEntityType(); + } + + public static void asyncDeleteEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteEntityTypeCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java new file mode 100644 index 000000000000..87dc411dfbb1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/AsyncDeleteEntityTypeLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteEntityTypeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteEntityTypeLRO(); + } + + public static void asyncDeleteEntityTypeLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteEntityTypeOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java new file mode 100644 index 000000000000..2ca526c4601c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityType.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteEntityTypeRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityType { + + public static void main(String[] args) throws Exception { + syncDeleteEntityType(); + } + + public static void syncDeleteEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteEntityTypeRequest request = + DeleteEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setForce(true) + .build(); + featurestoreServiceClient.deleteEntityTypeAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java new file mode 100644 index 000000000000..76a75073b0af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeEntitytypename { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeEntitytypename(); + } + + public static void syncDeleteEntityTypeEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + featurestoreServiceClient.deleteEntityTypeAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java new file mode 100644 index 000000000000..3a2753f8b264 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeEntitytypenameBoolean.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_EntitytypenameBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeEntitytypenameBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeEntitytypenameBoolean(); + } + + public static void syncDeleteEntityTypeEntitytypenameBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + boolean force = true; + featurestoreServiceClient.deleteEntityTypeAsync(name, force).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_EntitytypenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java new file mode 100644 index 000000000000..baa590fdf528 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeString { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeString(); + } + + public static void syncDeleteEntityTypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + featurestoreServiceClient.deleteEntityTypeAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java new file mode 100644 index 000000000000..49c58b864816 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deleteentitytype/SyncDeleteEntityTypeStringBoolean.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_StringBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteEntityTypeStringBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteEntityTypeStringBoolean(); + } + + public static void syncDeleteEntityTypeStringBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + boolean force = true; + featurestoreServiceClient.deleteEntityTypeAsync(name, force).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteEntityType_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeature.java new file mode 100644 index 000000000000..adb36c09521f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeature.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeature { + + public static void main(String[] args) throws Exception { + asyncDeleteFeature(); + } + + public static void asyncDeleteFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeatureCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java new file mode 100644 index 000000000000..bda62d50b97f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/AsyncDeleteFeatureLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteFeatureLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureLRO(); + } + + public static void asyncDeleteFeatureLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeatureOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeature.java new file mode 100644 index 000000000000..93cdb3a096ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeature.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureRequest; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeature { + + public static void main(String[] args) throws Exception { + syncDeleteFeature(); + } + + public static void syncDeleteFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureRequest request = + DeleteFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + featurestoreServiceClient.deleteFeatureAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java new file mode 100644 index 000000000000..e1620a5c1d3f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureFeaturename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_Featurename_sync] +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeatureFeaturename { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureFeaturename(); + } + + public static void syncDeleteFeatureFeaturename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeatureName name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]"); + featurestoreServiceClient.deleteFeatureAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_Featurename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java new file mode 100644 index 000000000000..ca450ff2490f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeature/SyncDeleteFeatureString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_String_sync] +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeatureString { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureString(); + } + + public static void syncDeleteFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString(); + featurestoreServiceClient.deleteFeatureAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeature_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java new file mode 100644 index 000000000000..22d3a21c9cd6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestore.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeaturestore { + + public static void main(String[] args) throws Exception { + asyncDeleteFeaturestore(); + } + + public static void asyncDeleteFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeaturestoreCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java new file mode 100644 index 000000000000..0b368d191c2b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/AsyncDeleteFeaturestoreLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeaturestoreLRO(); + } + + public static void asyncDeleteFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeaturestoreOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java new file mode 100644 index 000000000000..4c279fdf9208 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteFeaturestoreRequest; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestore { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestore(); + } + + public static void syncDeleteFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeaturestoreRequest request = + DeleteFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setForce(true) + .build(); + featurestoreServiceClient.deleteFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java new file mode 100644 index 000000000000..3120f4a7355d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_Featurestorename_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreFeaturestorename { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreFeaturestorename(); + } + + public static void syncDeleteFeaturestoreFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + featurestoreServiceClient.deleteFeaturestoreAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java new file mode 100644 index 000000000000..2d9f36bf5bc7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreFeaturestorenameBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_FeaturestorenameBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreFeaturestorenameBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreFeaturestorenameBoolean(); + } + + public static void syncDeleteFeaturestoreFeaturestorenameBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + boolean force = true; + featurestoreServiceClient.deleteFeaturestoreAsync(name, force).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_FeaturestorenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java new file mode 100644 index 000000000000..451dabec2828 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_String_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreString(); + } + + public static void syncDeleteFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + featurestoreServiceClient.deleteFeaturestoreAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java new file mode 100644 index 000000000000..a2272277cbf1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturestore/SyncDeleteFeaturestoreStringBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_StringBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteFeaturestoreStringBoolean { + + public static void main(String[] args) throws Exception { + syncDeleteFeaturestoreStringBoolean(); + } + + public static void syncDeleteFeaturestoreStringBoolean() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + boolean force = true; + featurestoreServiceClient.deleteFeaturestoreAsync(name, force).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeaturestore_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java new file mode 100644 index 000000000000..bf2b6faa6ff4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValues.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteFeatureValues { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureValues(); + } + + public static void asyncDeleteFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.deleteFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java new file mode 100644 index 000000000000..7d7788db22da --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/AsyncDeleteFeatureValuesLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class AsyncDeleteFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteFeatureValuesLRO(); + } + + public static void asyncDeleteFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + OperationFuture future = + featurestoreServiceClient.deleteFeatureValuesOperationCallable().futureCall(request); + // Do something. + DeleteFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java new file mode 100644 index 000000000000..fec6d171047d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValues.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValues { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValues(); + } + + public static void syncDeleteFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + DeleteFeatureValuesRequest request = + DeleteFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..38d5c7af3846 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValuesEntitytypename(); + } + + public static void syncDeleteFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java new file mode 100644 index 000000000000..3e5d9bd1f562 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/deletefeaturevalues/SyncDeleteFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncDeleteFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncDeleteFeatureValuesString(); + } + + public static void syncDeleteFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + DeleteFeatureValuesResponse response = + featurestoreServiceClient.deleteFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_DeleteFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java new file mode 100644 index 000000000000..b3c3a996a75a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValues.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncExportFeatureValues { + + public static void main(String[] args) throws Exception { + asyncExportFeatureValues(); + } + + public static void asyncExportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.exportFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java new file mode 100644 index 000000000000..54fde08d27cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/AsyncExportFeatureValuesLRO.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class AsyncExportFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncExportFeatureValuesLRO(); + } + + public static void asyncExportFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + OperationFuture future = + featurestoreServiceClient.exportFeatureValuesOperationCallable().futureCall(request); + // Do something. + ExportFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java new file mode 100644 index 000000000000..a3229b88f9fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValues.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.DestinationFeatureSetting; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeatureSelector; +import com.google.cloud.aiplatform.v1beta1.FeatureValueDestination; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import java.util.ArrayList; + +public class SyncExportFeatureValues { + + public static void main(String[] args) throws Exception { + syncExportFeatureValues(); + } + + public static void syncExportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ExportFeatureValuesRequest request = + ExportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setDestination(FeatureValueDestination.newBuilder().build()) + .setFeatureSelector(FeatureSelector.newBuilder().build()) + .addAllSettings(new ArrayList()) + .build(); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..58e09941a93f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncExportFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncExportFeatureValuesEntitytypename(); + } + + public static void syncExportFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java new file mode 100644 index 000000000000..f8578e8b9565 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/exportfeaturevalues/SyncExportFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.ExportFeatureValuesResponse; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncExportFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncExportFeatureValuesString(); + } + + public static void syncExportFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ExportFeatureValuesResponse response = + featurestoreServiceClient.exportFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ExportFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/AsyncGetEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/AsyncGetEntityType.java new file mode 100644 index 000000000000..2c22ab1adbc5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/AsyncGetEntityType.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetEntityTypeRequest; + +public class AsyncGetEntityType { + + public static void main(String[] args) throws Exception { + asyncGetEntityType(); + } + + public static void asyncGetEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetEntityTypeRequest request = + GetEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getEntityTypeCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityType.java new file mode 100644 index 000000000000..d0e3f8acffb2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityType.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetEntityTypeRequest; + +public class SyncGetEntityType { + + public static void main(String[] args) throws Exception { + syncGetEntityType(); + } + + public static void syncGetEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetEntityTypeRequest request = + GetEntityTypeRequest.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .build(); + EntityType response = featurestoreServiceClient.getEntityType(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java new file mode 100644 index 000000000000..b834c5ea09e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeEntitytypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetEntityTypeEntitytypename { + + public static void main(String[] args) throws Exception { + syncGetEntityTypeEntitytypename(); + } + + public static void syncGetEntityTypeEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + EntityType response = featurestoreServiceClient.getEntityType(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java new file mode 100644 index 000000000000..ff57d38ab686 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getentitytype/SyncGetEntityTypeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetEntityTypeString { + + public static void main(String[] args) throws Exception { + syncGetEntityTypeString(); + } + + public static void syncGetEntityTypeString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + EntityType response = featurestoreServiceClient.getEntityType(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetEntityType_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/AsyncGetFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/AsyncGetFeature.java new file mode 100644 index 000000000000..ad5ae585326d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/AsyncGetFeature.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetFeatureRequest; + +public class AsyncGetFeature { + + public static void main(String[] args) throws Exception { + asyncGetFeature(); + } + + public static void asyncGetFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeatureRequest request = + GetFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getFeatureCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeature.java new file mode 100644 index 000000000000..d2cca30756c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeature.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetFeatureRequest; + +public class SyncGetFeature { + + public static void main(String[] args) throws Exception { + syncGetFeature(); + } + + public static void syncGetFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeatureRequest request = + GetFeatureRequest.newBuilder() + .setName( + FeatureName.of( + "[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString()) + .build(); + Feature response = featurestoreServiceClient.getFeature(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java new file mode 100644 index 000000000000..c1def7ffeeb6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureFeaturename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_Featurename_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetFeatureFeaturename { + + public static void main(String[] args) throws Exception { + syncGetFeatureFeaturename(); + } + + public static void syncGetFeatureFeaturename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeatureName name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]"); + Feature response = featurestoreServiceClient.getFeature(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_Featurename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureString.java new file mode 100644 index 000000000000..af6f6e1363ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeature/SyncGetFeatureString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_String_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeatureName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetFeatureString { + + public static void main(String[] args) throws Exception { + syncGetFeatureString(); + } + + public static void syncGetFeatureString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = + FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]", "[FEATURE]") + .toString(); + Feature response = featurestoreServiceClient.getFeature(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeature_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java new file mode 100644 index 000000000000..c1c8d196907e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/AsyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetFeaturestoreRequest; + +public class AsyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + asyncGetFeaturestore(); + } + + public static void asyncGetFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeaturestoreRequest request = + GetFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .build(); + ApiFuture future = + featurestoreServiceClient.getFeaturestoreCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..1de527637aa9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.GetFeaturestoreRequest; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetFeaturestoreRequest request = + GetFeaturestoreRequest.newBuilder() + .setName(FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .build(); + Featurestore response = featurestoreServiceClient.getFeaturestore(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java new file mode 100644 index 000000000000..34325ea8a50d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreFeaturestorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_Featurestorename_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetFeaturestoreFeaturestorename { + + public static void main(String[] args) throws Exception { + syncGetFeaturestoreFeaturestorename(); + } + + public static void syncGetFeaturestoreFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + Featurestore response = featurestoreServiceClient.getFeaturestore(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java new file mode 100644 index 000000000000..675571a36fc5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getfeaturestore/SyncGetFeaturestoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_String_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncGetFeaturestoreString { + + public static void main(String[] args) throws Exception { + syncGetFeaturestoreString(); + } + + public static void syncGetFeaturestoreString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String name = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + Featurestore response = featurestoreServiceClient.getFeaturestore(name); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetFeaturestore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..a40b494d50e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..db2a1cbf5fa1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = featurestoreServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..26c0f6d3c609 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + featurestoreServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..18f149749c68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = featurestoreServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java new file mode 100644 index 000000000000..ca79356e059c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValues.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncImportFeatureValues { + + public static void main(String[] args) throws Exception { + asyncImportFeatureValues(); + } + + public static void asyncImportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + ApiFuture future = + featurestoreServiceClient.importFeatureValuesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java new file mode 100644 index 000000000000..3369da48c0b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/AsyncImportFeatureValuesLRO.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesResponse; +import java.util.ArrayList; + +public class AsyncImportFeatureValuesLRO { + + public static void main(String[] args) throws Exception { + asyncImportFeatureValuesLRO(); + } + + public static void asyncImportFeatureValuesLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + OperationFuture future = + featurestoreServiceClient.importFeatureValuesOperationCallable().futureCall(request); + // Do something. + ImportFeatureValuesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java new file mode 100644 index 000000000000..651c0ddc9e2f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValues.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesRequest; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesResponse; +import java.util.ArrayList; + +public class SyncImportFeatureValues { + + public static void main(String[] args) throws Exception { + syncImportFeatureValues(); + } + + public static void syncImportFeatureValues() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ImportFeatureValuesRequest request = + ImportFeatureValuesRequest.newBuilder() + .setEntityType( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setEntityIdField("entityIdField512670524") + .addAllFeatureSpecs(new ArrayList()) + .setDisableOnlineServing(true) + .setWorkerCount(372044046) + .setDisableIngestionAnalysis(true) + .build(); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java new file mode 100644 index 000000000000..7d2fea16dcf5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesEntitytypename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesResponse; + +public class SyncImportFeatureValuesEntitytypename { + + public static void main(String[] args) throws Exception { + syncImportFeatureValuesEntitytypename(); + } + + public static void syncImportFeatureValuesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java new file mode 100644 index 000000000000..d82610fe7a16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/importfeaturevalues/SyncImportFeatureValuesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ImportFeatureValuesResponse; + +public class SyncImportFeatureValuesString { + + public static void main(String[] args) throws Exception { + syncImportFeatureValuesString(); + } + + public static void syncImportFeatureValuesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String entityType = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + ImportFeatureValuesResponse response = + featurestoreServiceClient.importFeatureValuesAsync(entityType).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ImportFeatureValues_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java new file mode 100644 index 000000000000..c07e6d599d78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypes.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEntityTypesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListEntityTypes { + + public static void main(String[] args) throws Exception { + asyncListEntityTypes(); + } + + public static void asyncListEntityTypes() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.listEntityTypesPagedCallable().futureCall(request); + // Do something. + for (EntityType element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java new file mode 100644 index 000000000000..b3f42825b753 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/AsyncListEntityTypesPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_Paged_async] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEntityTypesRequest; +import com.google.cloud.aiplatform.v1beta1.ListEntityTypesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListEntityTypesPaged { + + public static void main(String[] args) throws Exception { + asyncListEntityTypesPaged(); + } + + public static void asyncListEntityTypesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListEntityTypesResponse response = + featurestoreServiceClient.listEntityTypesCallable().call(request); + for (EntityType element : response.getEntityTypesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypes.java new file mode 100644 index 000000000000..b882b72c9f24 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypes.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListEntityTypesRequest; +import com.google.protobuf.FieldMask; + +public class SyncListEntityTypes { + + public static void main(String[] args) throws Exception { + syncListEntityTypes(); + } + + public static void syncListEntityTypes() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListEntityTypesRequest request = + ListEntityTypesRequest.newBuilder() + .setParent( + FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (EntityType element : featurestoreServiceClient.listEntityTypes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java new file mode 100644 index 000000000000..af619e9ff676 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesFeaturestorename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_Featurestorename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncListEntityTypesFeaturestorename { + + public static void main(String[] args) throws Exception { + syncListEntityTypesFeaturestorename(); + } + + public static void syncListEntityTypesFeaturestorename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + FeaturestoreName parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]"); + for (EntityType element : featurestoreServiceClient.listEntityTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_Featurestorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java new file mode 100644 index 000000000000..9931bbbba782 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listentitytypes/SyncListEntityTypesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncListEntityTypesString { + + public static void main(String[] args) throws Exception { + syncListEntityTypesString(); + } + + public static void syncListEntityTypesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = FeaturestoreName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]").toString(); + for (EntityType element : featurestoreServiceClient.listEntityTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListEntityTypes_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeatures.java new file mode 100644 index 000000000000..c91dbea385d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeatures.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncListFeatures { + + public static void main(String[] args) throws Exception { + asyncListFeatures(); + } + + public static void asyncListFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + ApiFuture future = + featurestoreServiceClient.listFeaturesPagedCallable().futureCall(request); + // Do something. + for (Feature element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java new file mode 100644 index 000000000000..edb4f4cc1cfd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/AsyncListFeaturesPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_Paged_async] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturesRequest; +import com.google.cloud.aiplatform.v1beta1.ListFeaturesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturesPaged { + + public static void main(String[] args) throws Exception { + asyncListFeaturesPaged(); + } + + public static void asyncListFeaturesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + while (true) { + ListFeaturesResponse response = + featurestoreServiceClient.listFeaturesCallable().call(request); + for (Feature element : response.getFeaturesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeatures.java new file mode 100644 index 000000000000..d1f83f5f95e4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeatures.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturesRequest; +import com.google.protobuf.FieldMask; + +public class SyncListFeatures { + + public static void main(String[] args) throws Exception { + syncListFeatures(); + } + + public static void syncListFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturesRequest request = + ListFeaturesRequest.newBuilder() + .setParent( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .setLatestStatsCount(-878108489) + .build(); + for (Feature element : featurestoreServiceClient.listFeatures(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java new file mode 100644 index 000000000000..72320492a141 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesEntitytypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_Entitytypename_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncListFeaturesEntitytypename { + + public static void main(String[] args) throws Exception { + syncListFeaturesEntitytypename(); + } + + public static void syncListFeaturesEntitytypename() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityTypeName parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); + for (Feature element : featurestoreServiceClient.listFeatures(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_Entitytypename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesString.java new file mode 100644 index 000000000000..6c90be84f5fc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeatures/SyncListFeaturesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_String_sync] +import com.google.cloud.aiplatform.v1beta1.EntityTypeName; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; + +public class SyncListFeaturesString { + + public static void main(String[] args) throws Exception { + syncListFeaturesString(); + } + + public static void syncListFeaturesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]") + .toString(); + for (Feature element : featurestoreServiceClient.listFeatures(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeatures_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java new file mode 100644 index 000000000000..e751d8f46ba3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestores.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturestores { + + public static void main(String[] args) throws Exception { + asyncListFeaturestores(); + } + + public static void asyncListFeaturestores() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.listFeaturestoresPagedCallable().futureCall(request); + // Do something. + for (Featurestore element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java new file mode 100644 index 000000000000..d30dda61c9bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/AsyncListFeaturestoresPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1beta1.ListFeaturestoresResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListFeaturestoresPaged { + + public static void main(String[] args) throws Exception { + asyncListFeaturestoresPaged(); + } + + public static void asyncListFeaturestoresPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListFeaturestoresResponse response = + featurestoreServiceClient.listFeaturestoresCallable().call(request); + for (Featurestore element : response.getFeaturestoresList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java new file mode 100644 index 000000000000..e4ed4c21e36e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestores.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListFeaturestoresRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListFeaturestores { + + public static void main(String[] args) throws Exception { + syncListFeaturestores(); + } + + public static void syncListFeaturestores() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListFeaturestoresRequest request = + ListFeaturestoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java new file mode 100644 index 000000000000..693fafda3b3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListFeaturestoresLocationname { + + public static void main(String[] args) throws Exception { + syncListFeaturestoresLocationname(); + } + + public static void syncListFeaturestoresLocationname() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java new file mode 100644 index 000000000000..9e660cb17c98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listfeaturestores/SyncListFeaturestoresString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_String_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListFeaturestoresString { + + public static void main(String[] args) throws Exception { + syncListFeaturestoresString(); + } + + public static void syncListFeaturestoresString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Featurestore element : + featurestoreServiceClient.listFeaturestores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListFeaturestores_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..70260b22169f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..f9c4ccbf435a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + featurestoreServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..ae6175e00918 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : featurestoreServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java new file mode 100644 index 000000000000..d910051dc9c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeatures.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SearchFeaturesRequest; + +public class AsyncSearchFeatures { + + public static void main(String[] args) throws Exception { + asyncSearchFeatures(); + } + + public static void asyncSearchFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + featurestoreServiceClient.searchFeaturesPagedCallable().futureCall(request); + // Do something. + for (Feature element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java new file mode 100644 index 000000000000..d2a697d90bdb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/AsyncSearchFeaturesPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SearchFeaturesRequest; +import com.google.cloud.aiplatform.v1beta1.SearchFeaturesResponse; +import com.google.common.base.Strings; + +public class AsyncSearchFeaturesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchFeaturesPaged(); + } + + public static void asyncSearchFeaturesPaged() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchFeaturesResponse response = + featurestoreServiceClient.searchFeaturesCallable().call(request); + for (Feature element : response.getFeaturesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeatures.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeatures.java new file mode 100644 index 000000000000..147d91b0649e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeatures.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SearchFeaturesRequest; + +public class SyncSearchFeatures { + + public static void main(String[] args) throws Exception { + syncSearchFeatures(); + } + + public static void syncSearchFeatures() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SearchFeaturesRequest request = + SearchFeaturesRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Feature element : featurestoreServiceClient.searchFeatures(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java new file mode 100644 index 000000000000..97837db28658 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncSearchFeaturesLocationname { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesLocationname(); + } + + public static void syncSearchFeaturesLocationname() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Feature element : featurestoreServiceClient.searchFeatures(location).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java new file mode 100644 index 000000000000..4fea317521ff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesLocationnameString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_LocationnameString_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncSearchFeaturesLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesLocationnameString(); + } + + public static void syncSearchFeaturesLocationnameString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + for (Feature element : + featurestoreServiceClient.searchFeatures(location, query).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_LocationnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java new file mode 100644 index 000000000000..05b881f6bc87 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_String_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncSearchFeaturesString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesString(); + } + + public static void syncSearchFeaturesString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Feature element : featurestoreServiceClient.searchFeatures(location).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java new file mode 100644 index 000000000000..a7665fe079c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/searchfeatures/SyncSearchFeaturesStringString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_StringString_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncSearchFeaturesStringString { + + public static void main(String[] args) throws Exception { + syncSearchFeaturesStringString(); + } + + public static void syncSearchFeaturesStringString() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + for (Feature element : + featurestoreServiceClient.searchFeatures(location, query).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SearchFeatures_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..13ef6ea949c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..2e1558a36da7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = featurestoreServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..b7a512b532a2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + featurestoreServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..d77c996b159e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = featurestoreServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java new file mode 100644 index 000000000000..da1ead93ce08 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/AsyncUpdateEntityType.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateEntityTypeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateEntityType { + + public static void main(String[] args) throws Exception { + asyncUpdateEntityType(); + } + + public static void asyncUpdateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateEntityTypeRequest request = + UpdateEntityTypeRequest.newBuilder() + .setEntityType(EntityType.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateEntityTypeCallable().futureCall(request); + // Do something. + EntityType response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java new file mode 100644 index 000000000000..0db33d1bf96e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityType.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateEntityTypeRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEntityType { + + public static void main(String[] args) throws Exception { + syncUpdateEntityType(); + } + + public static void syncUpdateEntityType() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateEntityTypeRequest request = + UpdateEntityTypeRequest.newBuilder() + .setEntityType(EntityType.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + EntityType response = featurestoreServiceClient.updateEntityType(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java new file mode 100644 index 000000000000..01de1c49e431 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updateentitytype/SyncUpdateEntityTypeEntitytypeFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_EntitytypeFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.EntityType; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEntityTypeEntitytypeFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateEntityTypeEntitytypeFieldmask(); + } + + public static void syncUpdateEntityTypeEntitytypeFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + EntityType entityType = EntityType.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + EntityType response = featurestoreServiceClient.updateEntityType(entityType, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateEntityType_EntitytypeFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/AsyncUpdateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/AsyncUpdateFeature.java new file mode 100644 index 000000000000..abfcba6d2acf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/AsyncUpdateFeature.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateFeatureRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeature { + + public static void main(String[] args) throws Exception { + asyncUpdateFeature(); + } + + public static void asyncUpdateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeatureRequest request = + UpdateFeatureRequest.newBuilder() + .setFeature(Feature.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateFeatureCallable().futureCall(request); + // Do something. + Feature response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeature.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeature.java new file mode 100644 index 000000000000..913d7efe4337 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeature.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateFeatureRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeature { + + public static void main(String[] args) throws Exception { + syncUpdateFeature(); + } + + public static void syncUpdateFeature() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeatureRequest request = + UpdateFeatureRequest.newBuilder() + .setFeature(Feature.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Feature response = featurestoreServiceClient.updateFeature(request); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java new file mode 100644 index 000000000000..f5e3c30d38a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeature/SyncUpdateFeatureFeatureFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_FeatureFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Feature; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeatureFeatureFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateFeatureFeatureFieldmask(); + } + + public static void syncUpdateFeatureFeatureFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + Feature feature = Feature.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Feature response = featurestoreServiceClient.updateFeature(feature, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeature_FeatureFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java new file mode 100644 index 000000000000..f4799696c1ff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestore.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateFeaturestoreRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeaturestore { + + public static void main(String[] args) throws Exception { + asyncUpdateFeaturestore(); + } + + public static void asyncUpdateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + featurestoreServiceClient.updateFeaturestoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java new file mode 100644 index 000000000000..a5a68cbba010 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/AsyncUpdateFeaturestoreLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateFeaturestoreOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateFeaturestoreRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateFeaturestoreLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateFeaturestoreLRO(); + } + + public static void asyncUpdateFeaturestoreLRO() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + featurestoreServiceClient.updateFeaturestoreOperationCallable().futureCall(request); + // Do something. + Featurestore response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java new file mode 100644 index 000000000000..c2347457666a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateFeaturestoreRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeaturestore { + + public static void main(String[] args) throws Exception { + syncUpdateFeaturestore(); + } + + public static void syncUpdateFeaturestore() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + UpdateFeaturestoreRequest request = + UpdateFeaturestoreRequest.newBuilder() + .setFeaturestore(Featurestore.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Featurestore response = featurestoreServiceClient.updateFeaturestoreAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java new file mode 100644 index 000000000000..f77e621c4722 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservice/updatefeaturestore/SyncUpdateFeaturestoreFeaturestoreFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_FeaturestoreFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Featurestore; +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateFeaturestoreFeaturestoreFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateFeaturestoreFeaturestoreFieldmask(); + } + + public static void syncUpdateFeaturestoreFeaturestoreFieldmask() throws Exception { + // 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 (FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.create()) { + Featurestore featurestore = Featurestore.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Featurestore response = + featurestoreServiceClient.updateFeaturestoreAsync(featurestore, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreService_UpdateFeaturestore_FeaturestoreFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..d2f76a50b378 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/featurestoreservicesettings/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreServiceSettings_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceSettings; +import java.time.Duration; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 + FeaturestoreServiceSettings.Builder featurestoreServiceSettingsBuilder = + FeaturestoreServiceSettings.newBuilder(); + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings( + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreServiceSettings featurestoreServiceSettings = + featurestoreServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreServiceSettings_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..413a222e0b72 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + IndexEndpointServiceSettings indexEndpointServiceSettings = + IndexEndpointServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create(indexEndpointServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..4c290202cdb1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + IndexEndpointServiceSettings indexEndpointServiceSettings = + IndexEndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create(indexEndpointServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java new file mode 100644 index 000000000000..f2338a1dc4e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncCreateIndexEndpoint(); + } + + public static void asyncCreateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.createIndexEndpointCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java new file mode 100644 index 000000000000..ec1845a631cb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/AsyncCreateIndexEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateIndexEndpointOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateIndexEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncCreateIndexEndpointLRO(); + } + + public static void asyncCreateIndexEndpointLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.createIndexEndpointOperationCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java new file mode 100644 index 000000000000..35b6355a5d41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.CreateIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpoint(); + } + + public static void syncCreateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + CreateIndexEndpointRequest request = + CreateIndexEndpointRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.createIndexEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java new file mode 100644 index 000000000000..64f1e54cecae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointLocationnameIndexendpoint.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_LocationnameIndexendpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndexEndpointLocationnameIndexendpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpointLocationnameIndexendpoint(); + } + + public static void syncCreateIndexEndpointLocationnameIndexendpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.createIndexEndpointAsync(parent, indexEndpoint).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_LocationnameIndexendpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java new file mode 100644 index 000000000000..893c2e25ca71 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/createindexendpoint/SyncCreateIndexEndpointStringIndexendpoint.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_StringIndexendpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndexEndpointStringIndexendpoint { + + public static void main(String[] args) throws Exception { + syncCreateIndexEndpointStringIndexendpoint(); + } + + public static void syncCreateIndexEndpointStringIndexendpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.createIndexEndpointAsync(parent, indexEndpoint).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_CreateIndexEndpoint_StringIndexendpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java new file mode 100644 index 000000000000..3e2279ab0201 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexEndpoint(); + } + + public static void asyncDeleteIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + ApiFuture future = + indexEndpointServiceClient.deleteIndexEndpointCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java new file mode 100644 index 000000000000..497a18360807 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/AsyncDeleteIndexEndpointLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteIndexEndpointLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexEndpointLRO(); + } + + public static void asyncDeleteIndexEndpointLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + OperationFuture future = + indexEndpointServiceClient.deleteIndexEndpointOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java new file mode 100644 index 000000000000..922a3073bfc3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpoint(); + } + + public static void syncDeleteIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeleteIndexEndpointRequest request = + DeleteIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + indexEndpointServiceClient.deleteIndexEndpointAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java new file mode 100644 index 000000000000..425d983cb626 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointIndexendpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_Indexendpointname_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpointIndexendpointname { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpointIndexendpointname(); + } + + public static void syncDeleteIndexEndpointIndexendpointname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + indexEndpointServiceClient.deleteIndexEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_Indexendpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java new file mode 100644 index 000000000000..40e0f1e78c0f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deleteindexendpoint/SyncDeleteIndexEndpointString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_String_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexEndpointString { + + public static void main(String[] args) throws Exception { + syncDeleteIndexEndpointString(); + } + + public static void syncDeleteIndexEndpointString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + indexEndpointServiceClient.deleteIndexEndpointAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeleteIndexEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndex.java new file mode 100644 index 000000000000..84b3b12862b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndex.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeployIndex { + + public static void main(String[] args) throws Exception { + asyncDeployIndex(); + } + + public static void asyncDeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.deployIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java new file mode 100644 index 000000000000..8a74f636b733 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/AsyncDeployIndexLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeployIndexOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1beta1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class AsyncDeployIndexLRO { + + public static void main(String[] args) throws Exception { + asyncDeployIndexLRO(); + } + + public static void asyncDeployIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.deployIndexOperationCallable().futureCall(request); + // Do something. + DeployIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndex.java new file mode 100644 index 000000000000..12dafa08523c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndex.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployIndexRequest; +import com.google.cloud.aiplatform.v1beta1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncDeployIndex { + + public static void main(String[] args) throws Exception { + syncDeployIndex(); + } + + public static void syncDeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + DeployIndexRequest request = + DeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + DeployIndexResponse response = indexEndpointServiceClient.deployIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java new file mode 100644 index 000000000000..5074eaafc3d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexIndexendpointnameDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_IndexendpointnameDeployedindex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncDeployIndexIndexendpointnameDeployedindex { + + public static void main(String[] args) throws Exception { + syncDeployIndexIndexendpointnameDeployedindex(); + } + + public static void syncDeployIndexIndexendpointnameDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + DeployIndexResponse response = + indexEndpointServiceClient.deployIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_IndexendpointnameDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java new file mode 100644 index 000000000000..e8979581d364 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/deployindex/SyncDeployIndexStringDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_StringDeployedindex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployIndexResponse; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncDeployIndexStringDeployedindex { + + public static void main(String[] args) throws Exception { + syncDeployIndexStringDeployedindex(); + } + + public static void syncDeployIndexStringDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + DeployIndexResponse response = + indexEndpointServiceClient.deployIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_DeployIndex_StringDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..0035c5ee62b8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..ccde9c07f06f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = indexEndpointServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java new file mode 100644 index 000000000000..9a5121936faa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/AsyncGetIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class AsyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncGetIndexEndpoint(); + } + + public static void asyncGetIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIndexEndpointRequest request = + GetIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + ApiFuture future = + indexEndpointServiceClient.getIndexEndpointCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..b0184ff301f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.GetIndexEndpointRequest; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetIndexEndpointRequest request = + GetIndexEndpointRequest.newBuilder() + .setName( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java new file mode 100644 index 000000000000..e738464d7925 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointIndexendpointname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_Indexendpointname_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpointIndexendpointname { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpointIndexendpointname(); + } + + public static void syncGetIndexEndpointIndexendpointname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(name); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_Indexendpointname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java new file mode 100644 index 000000000000..42be29ed6254 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getindexendpoint/SyncGetIndexEndpointString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_String_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; + +public class SyncGetIndexEndpointString { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpointString(); + } + + public static void syncGetIndexEndpointString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String name = IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + IndexEndpoint response = indexEndpointServiceClient.getIndexEndpoint(name); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetIndexEndpoint_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..35b3659e2ec9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + indexEndpointServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..456f9aace0f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = indexEndpointServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java new file mode 100644 index 000000000000..8686523c7446 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpoints.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexEndpoints { + + public static void main(String[] args) throws Exception { + asyncListIndexEndpoints(); + } + + public static void asyncListIndexEndpoints() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.listIndexEndpointsPagedCallable().futureCall(request); + // Do something. + for (IndexEndpoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java new file mode 100644 index 000000000000..0799b69e4d41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/AsyncListIndexEndpointsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_Paged_async] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.ListIndexEndpointsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexEndpointsPaged { + + public static void main(String[] args) throws Exception { + asyncListIndexEndpointsPaged(); + } + + public static void asyncListIndexEndpointsPaged() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListIndexEndpointsResponse response = + indexEndpointServiceClient.listIndexEndpointsCallable().call(request); + for (IndexEndpoint element : response.getIndexEndpointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java new file mode 100644 index 000000000000..0f80c925b9c7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpoints.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexEndpointsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListIndexEndpoints { + + public static void main(String[] args) throws Exception { + syncListIndexEndpoints(); + } + + public static void syncListIndexEndpoints() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListIndexEndpointsRequest request = + ListIndexEndpointsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java new file mode 100644 index 000000000000..7f94072fcfec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsLocationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListIndexEndpointsLocationname { + + public static void main(String[] args) throws Exception { + syncListIndexEndpointsLocationname(); + } + + public static void syncListIndexEndpointsLocationname() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java new file mode 100644 index 000000000000..757425124341 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listindexendpoints/SyncListIndexEndpointsString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_String_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListIndexEndpointsString { + + public static void main(String[] args) throws Exception { + syncListIndexEndpointsString(); + } + + public static void syncListIndexEndpointsString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (IndexEndpoint element : + indexEndpointServiceClient.listIndexEndpoints(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListIndexEndpoints_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..d1b248251d0c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + indexEndpointServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..f15d71db327a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + indexEndpointServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..1c99701ed151 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/listlocations/SyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : indexEndpointServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java new file mode 100644 index 000000000000..8c74f3fd54a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndex.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexRequest; +import com.google.longrunning.Operation; + +public class AsyncMutateDeployedIndex { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedIndex(); + } + + public static void asyncMutateDeployedIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.mutateDeployedIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java new file mode 100644 index 000000000000..55659595d8b0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/AsyncMutateDeployedIndexLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexRequest; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexResponse; + +public class AsyncMutateDeployedIndexLRO { + + public static void main(String[] args) throws Exception { + asyncMutateDeployedIndexLRO(); + } + + public static void asyncMutateDeployedIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + OperationFuture future = + indexEndpointServiceClient.mutateDeployedIndexOperationCallable().futureCall(request); + // Do something. + MutateDeployedIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java new file mode 100644 index 000000000000..4a07a29d797e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexRequest; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndex(); + } + + public static void syncMutateDeployedIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + MutateDeployedIndexRequest request = + MutateDeployedIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndex(DeployedIndex.newBuilder().build()) + .build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java new file mode 100644 index 000000000000..27f849df172c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexIndexendpointnameDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_IndexendpointnameDeployedindex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndexIndexendpointnameDeployedindex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndexIndexendpointnameDeployedindex(); + } + + public static void syncMutateDeployedIndexIndexendpointnameDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_IndexendpointnameDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java new file mode 100644 index 000000000000..d31e6c7e0bb4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/mutatedeployedindex/SyncMutateDeployedIndexStringDeployedindex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_StringDeployedindex_sync] +import com.google.cloud.aiplatform.v1beta1.DeployedIndex; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.MutateDeployedIndexResponse; + +public class SyncMutateDeployedIndexStringDeployedindex { + + public static void main(String[] args) throws Exception { + syncMutateDeployedIndexStringDeployedindex(); + } + + public static void syncMutateDeployedIndexStringDeployedindex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + DeployedIndex deployedIndex = DeployedIndex.newBuilder().build(); + MutateDeployedIndexResponse response = + indexEndpointServiceClient.mutateDeployedIndexAsync(indexEndpoint, deployedIndex).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_MutateDeployedIndex_StringDeployedindex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..29cdbcceff34 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..64bd3e279bc9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = indexEndpointServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..ae5d4a10e46f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + indexEndpointServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..e5f30a6e0bf7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = indexEndpointServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndex.java new file mode 100644 index 000000000000..e14c627a7341 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndex.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeployIndex { + + public static void main(String[] args) throws Exception { + asyncUndeployIndex(); + } + + public static void asyncUndeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + ApiFuture future = + indexEndpointServiceClient.undeployIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java new file mode 100644 index 000000000000..4c7cd0db1d86 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/AsyncUndeployIndexLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexRequest; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexResponse; + +public class AsyncUndeployIndexLRO { + + public static void main(String[] args) throws Exception { + asyncUndeployIndexLRO(); + } + + public static void asyncUndeployIndexLRO() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + OperationFuture future = + indexEndpointServiceClient.undeployIndexOperationCallable().futureCall(request); + // Do something. + UndeployIndexResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndex.java new file mode 100644 index 000000000000..bcd0cec4822c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexRequest; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexResponse; + +public class SyncUndeployIndex { + + public static void main(String[] args) throws Exception { + syncUndeployIndex(); + } + + public static void syncUndeployIndex() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UndeployIndexRequest request = + UndeployIndexRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .build(); + UndeployIndexResponse response = indexEndpointServiceClient.undeployIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java new file mode 100644 index 000000000000..b117ee378ed9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexIndexendpointnameString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_IndexendpointnameString_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexResponse; + +public class SyncUndeployIndexIndexendpointnameString { + + public static void main(String[] args) throws Exception { + syncUndeployIndexIndexendpointnameString(); + } + + public static void syncUndeployIndexIndexendpointnameString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpointName indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]"); + String deployedIndexId = "deployedIndexId-1101212953"; + UndeployIndexResponse response = + indexEndpointServiceClient.undeployIndexAsync(indexEndpoint, deployedIndexId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_IndexendpointnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java new file mode 100644 index 000000000000..2b5d9ba01182 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/undeployindex/SyncUndeployIndexStringString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_StringString_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UndeployIndexResponse; + +public class SyncUndeployIndexStringString { + + public static void main(String[] args) throws Exception { + syncUndeployIndexStringString(); + } + + public static void syncUndeployIndexStringString() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + String indexEndpoint = + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString(); + String deployedIndexId = "deployedIndexId-1101212953"; + UndeployIndexResponse response = + indexEndpointServiceClient.undeployIndexAsync(indexEndpoint, deployedIndexId).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UndeployIndex_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java new file mode 100644 index 000000000000..0e5bed49c479 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/AsyncUpdateIndexEndpoint.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexEndpointRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndexEndpoint { + + public static void main(String[] args) throws Exception { + asyncUpdateIndexEndpoint(); + } + + public static void asyncUpdateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UpdateIndexEndpointRequest request = + UpdateIndexEndpointRequest.newBuilder() + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + indexEndpointServiceClient.updateIndexEndpointCallable().futureCall(request); + // Do something. + IndexEndpoint response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java new file mode 100644 index 000000000000..98f6abe385d3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpoint.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexEndpointRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncUpdateIndexEndpoint(); + } + + public static void syncUpdateIndexEndpoint() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + UpdateIndexEndpointRequest request = + UpdateIndexEndpointRequest.newBuilder() + .setIndexEndpoint(IndexEndpoint.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + IndexEndpoint response = indexEndpointServiceClient.updateIndexEndpoint(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java new file mode 100644 index 000000000000..4d2b321a5e28 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservice/updateindexendpoint/SyncUpdateIndexEndpointIndexendpointFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_IndexendpointFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpoint; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexEndpointIndexendpointFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIndexEndpointIndexendpointFieldmask(); + } + + public static void syncUpdateIndexEndpointIndexendpointFieldmask() throws Exception { + // 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 (IndexEndpointServiceClient indexEndpointServiceClient = + IndexEndpointServiceClient.create()) { + IndexEndpoint indexEndpoint = IndexEndpoint.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + IndexEndpoint response = + indexEndpointServiceClient.updateIndexEndpoint(indexEndpoint, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointService_UpdateIndexEndpoint_IndexendpointFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..d18a4142e98c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexendpointservicesettings/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointServiceSettings_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceSettings; +import java.time.Duration; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 + IndexEndpointServiceSettings.Builder indexEndpointServiceSettingsBuilder = + IndexEndpointServiceSettings.newBuilder(); + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings( + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexEndpointServiceSettings indexEndpointServiceSettings = + indexEndpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointServiceSettings_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..e6679621a6b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.IndexServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + IndexServiceSettings indexServiceSettings = + IndexServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_IndexService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..04d2f46de6c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.IndexServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + IndexServiceSettings indexServiceSettings = + IndexServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_IndexService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndex.java new file mode 100644 index 000000000000..877d2f28d522 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_CreateIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateIndex { + + public static void main(String[] args) throws Exception { + asyncCreateIndex(); + } + + public static void asyncCreateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.createIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_CreateIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndexLRO.java new file mode 100644 index 000000000000..f70f87ebd2e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/AsyncCreateIndexLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_CreateIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateIndexOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateIndexLRO { + + public static void main(String[] args) throws Exception { + asyncCreateIndexLRO(); + } + + public static void asyncCreateIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + OperationFuture future = + indexServiceClient.createIndexOperationCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_CreateIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndex.java new file mode 100644 index 000000000000..2422fc4951b2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_CreateIndex_sync] +import com.google.cloud.aiplatform.v1beta1.CreateIndexRequest; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndex(); + } + + public static void syncCreateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + CreateIndexRequest request = + CreateIndexRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIndex(Index.newBuilder().build()) + .build(); + Index response = indexServiceClient.createIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_CreateIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java new file mode 100644 index 000000000000..977e15c8f76e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexLocationnameIndex.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_CreateIndex_LocationnameIndex_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndexLocationnameIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndexLocationnameIndex(); + } + + public static void syncCreateIndexLocationnameIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Index index = Index.newBuilder().build(); + Index response = indexServiceClient.createIndexAsync(parent, index).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_CreateIndex_LocationnameIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexStringIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexStringIndex.java new file mode 100644 index 000000000000..b0639fe4eda8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/createindex/SyncCreateIndexStringIndex.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_CreateIndex_StringIndex_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateIndexStringIndex { + + public static void main(String[] args) throws Exception { + syncCreateIndexStringIndex(); + } + + public static void syncCreateIndexStringIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Index index = Index.newBuilder().build(); + Index response = indexServiceClient.createIndexAsync(parent, index).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_CreateIndex_StringIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndex.java new file mode 100644 index 000000000000..dbf5c94c262f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_DeleteIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteIndex { + + public static void main(String[] args) throws Exception { + asyncDeleteIndex(); + } + + public static void asyncDeleteIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + ApiFuture future = indexServiceClient.deleteIndexCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_DeleteIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndexLRO.java new file mode 100644 index 000000000000..c1fcf422dd9c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/AsyncDeleteIndexLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_DeleteIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteIndexLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteIndexLRO(); + } + + public static void asyncDeleteIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + OperationFuture future = + indexServiceClient.deleteIndexOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_DeleteIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndex.java new file mode 100644 index 000000000000..8267f4a6017f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndex.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_DeleteIndex_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteIndexRequest; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndex { + + public static void main(String[] args) throws Exception { + syncDeleteIndex(); + } + + public static void syncDeleteIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + DeleteIndexRequest request = + DeleteIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + indexServiceClient.deleteIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_DeleteIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexIndexname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexIndexname.java new file mode 100644 index 000000000000..38383022a781 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexIndexname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_DeleteIndex_Indexname_sync] +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexIndexname { + + public static void main(String[] args) throws Exception { + syncDeleteIndexIndexname(); + } + + public static void syncDeleteIndexIndexname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]"); + indexServiceClient.deleteIndexAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_DeleteIndex_Indexname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexString.java new file mode 100644 index 000000000000..87ee666ce48b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/deleteindex/SyncDeleteIndexString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_DeleteIndex_String_sync] +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteIndexString { + + public static void main(String[] args) throws Exception { + syncDeleteIndexString(); + } + + public static void syncDeleteIndexString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString(); + indexServiceClient.deleteIndexAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_DeleteIndex_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..5b67c45d437e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..378b0fc22f54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = indexServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/AsyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/AsyncGetIndex.java new file mode 100644 index 000000000000..d1d813dedfa9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/AsyncGetIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetIndexRequest; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; + +public class AsyncGetIndex { + + public static void main(String[] args) throws Exception { + asyncGetIndex(); + } + + public static void asyncGetIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIndexRequest request = + GetIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + ApiFuture future = indexServiceClient.getIndexCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..932164d2e69d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndex.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIndex_sync] +import com.google.cloud.aiplatform.v1beta1.GetIndexRequest; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetIndexRequest request = + GetIndexRequest.newBuilder() + .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .build(); + Index response = indexServiceClient.getIndex(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexIndexname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexIndexname.java new file mode 100644 index 000000000000..883304cd96c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexIndexname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIndex_Indexname_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; + +public class SyncGetIndexIndexname { + + public static void main(String[] args) throws Exception { + syncGetIndexIndexname(); + } + + public static void syncGetIndexIndexname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]"); + Index response = indexServiceClient.getIndex(name); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIndex_Indexname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexString.java new file mode 100644 index 000000000000..ddf2a98f4463 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getindex/SyncGetIndexString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetIndex_String_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; + +public class SyncGetIndexString { + + public static void main(String[] args) throws Exception { + syncGetIndexString(); + } + + public static void syncGetIndexString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString(); + Index response = indexServiceClient.getIndex(name); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetIndex_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..58049ba08bbb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = indexServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..7efd4250cbe0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = indexServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexes.java new file mode 100644 index 000000000000..408ae7a03c6e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexes.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListIndexes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexes { + + public static void main(String[] args) throws Exception { + asyncListIndexes(); + } + + public static void asyncListIndexes() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.listIndexesPagedCallable().futureCall(request); + // Do something. + for (Index element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListIndexes_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexesPaged.java new file mode 100644 index 000000000000..9ee7efce58df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/AsyncListIndexesPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListIndexes_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1beta1.ListIndexesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListIndexesPaged { + + public static void main(String[] args) throws Exception { + asyncListIndexesPaged(); + } + + public static void asyncListIndexesPaged() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListIndexesResponse response = indexServiceClient.listIndexesCallable().call(request); + for (Index element : response.getIndexesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListIndexes_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexes.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexes.java new file mode 100644 index 000000000000..110bc1ca534b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListIndexes_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListIndexesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListIndexes { + + public static void main(String[] args) throws Exception { + syncListIndexes(); + } + + public static void syncListIndexes() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListIndexesRequest request = + ListIndexesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Index element : indexServiceClient.listIndexes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListIndexes_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesLocationname.java new file mode 100644 index 000000000000..bf9cd390bd1d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListIndexes_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListIndexesLocationname { + + public static void main(String[] args) throws Exception { + syncListIndexesLocationname(); + } + + public static void syncListIndexesLocationname() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListIndexes_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesString.java new file mode 100644 index 000000000000..2852ff01425f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listindexes/SyncListIndexesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListIndexes_String_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListIndexesString { + + public static void main(String[] args) throws Exception { + syncListIndexesString(); + } + + public static void syncListIndexesString() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListIndexes_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..9b3401d5609a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + indexServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..5a5360a8e8d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = indexServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..a2f3fec549ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : indexServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/AsyncRemoveDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/AsyncRemoveDatapoints.java new file mode 100644 index 000000000000..9b8443068178 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/AsyncRemoveDatapoints.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_RemoveDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.RemoveDatapointsResponse; +import java.util.ArrayList; + +public class AsyncRemoveDatapoints { + + public static void main(String[] args) throws Exception { + asyncRemoveDatapoints(); + } + + public static void asyncRemoveDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + RemoveDatapointsRequest request = + RemoveDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapointIds(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.removeDatapointsCallable().futureCall(request); + // Do something. + RemoveDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_RemoveDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/SyncRemoveDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/SyncRemoveDatapoints.java new file mode 100644 index 000000000000..e6a841ab9585 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/removedatapoints/SyncRemoveDatapoints.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_RemoveDatapoints_sync] +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.RemoveDatapointsResponse; +import java.util.ArrayList; + +public class SyncRemoveDatapoints { + + public static void main(String[] args) throws Exception { + syncRemoveDatapoints(); + } + + public static void syncRemoveDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + RemoveDatapointsRequest request = + RemoveDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapointIds(new ArrayList()) + .build(); + RemoveDatapointsResponse response = indexServiceClient.removeDatapoints(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_RemoveDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..10dd439d5513 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..3926fc67a502 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = indexServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..8bfaae294dd0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..54a477996c94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = indexServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndex.java new file mode 100644 index 000000000000..1e7979308785 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndex.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpdateIndex_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndex { + + public static void main(String[] args) throws Exception { + asyncUpdateIndex(); + } + + public static void asyncUpdateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = indexServiceClient.updateIndexCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpdateIndex_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndexLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndexLRO.java new file mode 100644 index 000000000000..baca68b3f70f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/AsyncUpdateIndexLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpdateIndex_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIndexLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateIndexLRO(); + } + + public static void asyncUpdateIndexLRO() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + indexServiceClient.updateIndexOperationCallable().futureCall(request); + // Do something. + Index response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpdateIndex_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndex.java new file mode 100644 index 000000000000..adf6ff7da4be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndex.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpdateIndex_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateIndexRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndex { + + public static void main(String[] args) throws Exception { + syncUpdateIndex(); + } + + public static void syncUpdateIndex() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpdateIndexRequest request = + UpdateIndexRequest.newBuilder() + .setIndex(Index.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Index response = indexServiceClient.updateIndexAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpdateIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java new file mode 100644 index 000000000000..df52f6bef7b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/updateindex/SyncUpdateIndexIndexFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpdateIndex_IndexFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Index; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIndexIndexFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIndexIndexFieldmask(); + } + + public static void syncUpdateIndexIndexFieldmask() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + Index index = Index.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Index response = indexServiceClient.updateIndexAsync(index, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpdateIndex_IndexFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java new file mode 100644 index 000000000000..d78e28c7f6a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/AsyncUpsertDatapoints.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpsertDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexDatapoint; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpsertDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.UpsertDatapointsResponse; +import java.util.ArrayList; + +public class AsyncUpsertDatapoints { + + public static void main(String[] args) throws Exception { + asyncUpsertDatapoints(); + } + + public static void asyncUpsertDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpsertDatapointsRequest request = + UpsertDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapoints(new ArrayList()) + .build(); + ApiFuture future = + indexServiceClient.upsertDatapointsCallable().futureCall(request); + // Do something. + UpsertDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpsertDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java new file mode 100644 index 000000000000..26751fb7fba3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservice/upsertdatapoints/SyncUpsertDatapoints.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexService_UpsertDatapoints_sync] +import com.google.cloud.aiplatform.v1beta1.IndexDatapoint; +import com.google.cloud.aiplatform.v1beta1.IndexName; +import com.google.cloud.aiplatform.v1beta1.IndexServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpsertDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.UpsertDatapointsResponse; +import java.util.ArrayList; + +public class SyncUpsertDatapoints { + + public static void main(String[] args) throws Exception { + syncUpsertDatapoints(); + } + + public static void syncUpsertDatapoints() throws Exception { + // 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) { + UpsertDatapointsRequest request = + UpsertDatapointsRequest.newBuilder() + .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) + .addAllDatapoints(new ArrayList()) + .build(); + UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request); + } + } +} +// [END aiplatform_v1beta1_generated_IndexService_UpsertDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservicesettings/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservicesettings/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..1dd25ecb9c37 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/indexservicesettings/getindex/SyncGetIndex.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_IndexServiceSettings_GetIndex_sync] +import com.google.cloud.aiplatform.v1beta1.IndexServiceSettings; +import java.time.Duration; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 + IndexServiceSettings.Builder indexServiceSettingsBuilder = IndexServiceSettings.newBuilder(); + indexServiceSettingsBuilder + .getIndexSettings() + .setRetrySettings( + indexServiceSettingsBuilder + .getIndexSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexServiceSettings indexServiceSettings = indexServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_IndexServiceSettings_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java new file mode 100644 index 000000000000..46f24f81493a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/AsyncCancelBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.CancelBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncCancelBatchPredictionJob(); + } + + public static void asyncCancelBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelBatchPredictionJobRequest request = + CancelBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelBatchPredictionJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java new file mode 100644 index 000000000000..6e2c437d2f3c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.CancelBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJob(); + } + + public static void syncCancelBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelBatchPredictionJobRequest request = + CancelBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + jobServiceClient.cancelBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..c413ae606add --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncCancelBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + jobServiceClient.cancelBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java new file mode 100644 index 000000000000..b8354f7432f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelbatchpredictionjob/SyncCancelBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncCancelBatchPredictionJobString(); + } + + public static void syncCancelBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + jobServiceClient.cancelBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java new file mode 100644 index 000000000000..820994caecdd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/AsyncCancelCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelCustomJob { + + public static void main(String[] args) throws Exception { + asyncCancelCustomJob(); + } + + public static void asyncCancelCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelCustomJobRequest request = + CancelCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.cancelCustomJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJob.java new file mode 100644 index 000000000000..82f1e60abdc8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.CancelCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJob { + + public static void main(String[] args) throws Exception { + syncCancelCustomJob(); + } + + public static void syncCancelCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelCustomJobRequest request = + CancelCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + jobServiceClient.cancelCustomJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java new file mode 100644 index 000000000000..7da4113622f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncCancelCustomJobCustomjobname(); + } + + public static void syncCancelCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + jobServiceClient.cancelCustomJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java new file mode 100644 index 000000000000..a4ca7837eb1c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelcustomjob/SyncCancelCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelCustomJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelCustomJobString { + + public static void main(String[] args) throws Exception { + syncCancelCustomJobString(); + } + + public static void syncCancelCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + jobServiceClient.cancelCustomJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java new file mode 100644 index 000000000000..7fbc130f8591 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/AsyncCancelDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncCancelDataLabelingJob(); + } + + public static void asyncCancelDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelDataLabelingJobRequest request = + CancelDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelDataLabelingJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java new file mode 100644 index 000000000000..a9b124847e03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1beta1.CancelDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJob(); + } + + public static void syncCancelDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelDataLabelingJobRequest request = + CancelDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + jobServiceClient.cancelDataLabelingJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..ec0ef766c7c0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJobDatalabelingjobname(); + } + + public static void syncCancelDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + jobServiceClient.cancelDataLabelingJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java new file mode 100644 index 000000000000..d09f7086a174 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/canceldatalabelingjob/SyncCancelDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncCancelDataLabelingJobString(); + } + + public static void syncCancelDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + jobServiceClient.cancelDataLabelingJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java new file mode 100644 index 000000000000..adc3c0eecfd2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/AsyncCancelHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncCancelHyperparameterTuningJob(); + } + + public static void asyncCancelHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelHyperparameterTuningJobRequest request = + CancelHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.cancelHyperparameterTuningJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java new file mode 100644 index 000000000000..914d96f586ba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1beta1.CancelHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJob(); + } + + public static void syncCancelHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelHyperparameterTuningJobRequest request = + CancelHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + jobServiceClient.cancelHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..582bfc82f40e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncCancelHyperparameterTuningJobHyperparametertuningjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + jobServiceClient.cancelHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java new file mode 100644 index 000000000000..6dbf68264651 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelhyperparametertuningjob/SyncCancelHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncCancelHyperparameterTuningJobString(); + } + + public static void syncCancelHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + jobServiceClient.cancelHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/AsyncCancelNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/AsyncCancelNasJob.java new file mode 100644 index 000000000000..677f3bce5df5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/AsyncCancelNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class AsyncCancelNasJob { + + public static void main(String[] args) throws Exception { + asyncCancelNasJob(); + } + + public static void asyncCancelNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelNasJobRequest request = + CancelNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.cancelNasJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJob.java new file mode 100644 index 000000000000..e14b5c23f5f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelNasJob_sync] +import com.google.cloud.aiplatform.v1beta1.CancelNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJob { + + public static void main(String[] args) throws Exception { + syncCancelNasJob(); + } + + public static void syncCancelNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CancelNasJobRequest request = + CancelNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + jobServiceClient.cancelNasJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java new file mode 100644 index 000000000000..41146e6cfd58 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncCancelNasJobNasjobname(); + } + + public static void syncCancelNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + jobServiceClient.cancelNasJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobString.java new file mode 100644 index 000000000000..59fc6a488959 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/cancelnasjob/SyncCancelNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CancelNasJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncCancelNasJobString { + + public static void main(String[] args) throws Exception { + syncCancelNasJobString(); + } + + public static void syncCancelNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + jobServiceClient.cancelNasJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CancelNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..761cd089512b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.JobServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_JobService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..350ef46040f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.JobServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_JobService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java new file mode 100644 index 000000000000..a580db51272b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/AsyncCreateBatchPredictionJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.CreateBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncCreateBatchPredictionJob(); + } + + public static void asyncCreateBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateBatchPredictionJobRequest request = + CreateBatchPredictionJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setBatchPredictionJob(BatchPredictionJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createBatchPredictionJobCallable().futureCall(request); + // Do something. + BatchPredictionJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java new file mode 100644 index 000000000000..6f3fc84fb54e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.CreateBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJob(); + } + + public static void syncCreateBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateBatchPredictionJobRequest request = + CreateBatchPredictionJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setBatchPredictionJob(BatchPredictionJob.newBuilder().build()) + .build(); + BatchPredictionJob response = jobServiceClient.createBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java new file mode 100644 index 000000000000..c344a82fe3f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobLocationnameBatchpredictionjob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_LocationnameBatchpredictionjob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateBatchPredictionJobLocationnameBatchpredictionjob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJobLocationnameBatchpredictionjob(); + } + + public static void syncCreateBatchPredictionJobLocationnameBatchpredictionjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + BatchPredictionJob batchPredictionJob = BatchPredictionJob.newBuilder().build(); + BatchPredictionJob response = + jobServiceClient.createBatchPredictionJob(parent, batchPredictionJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_LocationnameBatchpredictionjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java new file mode 100644 index 000000000000..0321a946b620 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createbatchpredictionjob/SyncCreateBatchPredictionJobStringBatchpredictionjob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_StringBatchpredictionjob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateBatchPredictionJobStringBatchpredictionjob { + + public static void main(String[] args) throws Exception { + syncCreateBatchPredictionJobStringBatchpredictionjob(); + } + + public static void syncCreateBatchPredictionJobStringBatchpredictionjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + BatchPredictionJob batchPredictionJob = BatchPredictionJob.newBuilder().build(); + BatchPredictionJob response = + jobServiceClient.createBatchPredictionJob(parent, batchPredictionJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateBatchPredictionJob_StringBatchpredictionjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/AsyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/AsyncCreateCustomJob.java new file mode 100644 index 000000000000..abe4b4a85902 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/AsyncCreateCustomJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + asyncCreateCustomJob(); + } + + public static void asyncCreateCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateCustomJobRequest request = + CreateCustomJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCustomJob(CustomJob.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createCustomJobCallable().futureCall(request); + // Do something. + CustomJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..56b38ca3f7b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreateCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateCustomJobRequest request = + CreateCustomJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCustomJob(CustomJob.newBuilder().build()) + .build(); + CustomJob response = jobServiceClient.createCustomJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java new file mode 100644 index 000000000000..4bbab23c7fbc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobLocationnameCustomjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateCustomJob_LocationnameCustomjob_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateCustomJobLocationnameCustomjob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJobLocationnameCustomjob(); + } + + public static void syncCreateCustomJobLocationnameCustomjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomJob customJob = CustomJob.newBuilder().build(); + CustomJob response = jobServiceClient.createCustomJob(parent, customJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateCustomJob_LocationnameCustomjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java new file mode 100644 index 000000000000..f4f937cb2b27 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createcustomjob/SyncCreateCustomJobStringCustomjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateCustomJob_StringCustomjob_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateCustomJobStringCustomjob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJobStringCustomjob(); + } + + public static void syncCreateCustomJobStringCustomjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CustomJob customJob = CustomJob.newBuilder().build(); + CustomJob response = jobServiceClient.createCustomJob(parent, customJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateCustomJob_StringCustomjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java new file mode 100644 index 000000000000..0e1427afe668 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/AsyncCreateDataLabelingJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncCreateDataLabelingJob(); + } + + public static void asyncCreateDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateDataLabelingJobRequest request = + CreateDataLabelingJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataLabelingJob(DataLabelingJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createDataLabelingJobCallable().futureCall(request); + // Do something. + DataLabelingJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java new file mode 100644 index 000000000000..69258d87df3c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreateDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJob(); + } + + public static void syncCreateDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateDataLabelingJobRequest request = + CreateDataLabelingJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDataLabelingJob(DataLabelingJob.newBuilder().build()) + .build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java new file mode 100644 index 000000000000..9d87408fa13c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobLocationnameDatalabelingjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_LocationnameDatalabelingjob_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDataLabelingJobLocationnameDatalabelingjob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJobLocationnameDatalabelingjob(); + } + + public static void syncCreateDataLabelingJobLocationnameDatalabelingjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataLabelingJob dataLabelingJob = DataLabelingJob.newBuilder().build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(parent, dataLabelingJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_LocationnameDatalabelingjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java new file mode 100644 index 000000000000..e73948d29aa1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createdatalabelingjob/SyncCreateDataLabelingJobStringDatalabelingjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_StringDatalabelingjob_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateDataLabelingJobStringDatalabelingjob { + + public static void main(String[] args) throws Exception { + syncCreateDataLabelingJobStringDatalabelingjob(); + } + + public static void syncCreateDataLabelingJobStringDatalabelingjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + DataLabelingJob dataLabelingJob = DataLabelingJob.newBuilder().build(); + DataLabelingJob response = jobServiceClient.createDataLabelingJob(parent, dataLabelingJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateDataLabelingJob_StringDatalabelingjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java new file mode 100644 index 000000000000..83980934b886 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/AsyncCreateHyperparameterTuningJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class AsyncCreateHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncCreateHyperparameterTuningJob(); + } + + public static void asyncCreateHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateHyperparameterTuningJobRequest request = + CreateHyperparameterTuningJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHyperparameterTuningJob(HyperparameterTuningJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createHyperparameterTuningJobCallable().futureCall(request); + // Do something. + HyperparameterTuningJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java new file mode 100644 index 000000000000..56cc5137be52 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreateHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJob(); + } + + public static void syncCreateHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateHyperparameterTuningJobRequest request = + CreateHyperparameterTuningJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHyperparameterTuningJob(HyperparameterTuningJob.newBuilder().build()) + .build(); + HyperparameterTuningJob response = jobServiceClient.createHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java new file mode 100644 index 000000000000..ac3c151c4c10 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_LocationnameHyperparametertuningjob_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob(); + } + + public static void syncCreateHyperparameterTuningJobLocationnameHyperparametertuningjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + HyperparameterTuningJob hyperparameterTuningJob = + HyperparameterTuningJob.newBuilder().build(); + HyperparameterTuningJob response = + jobServiceClient.createHyperparameterTuningJob(parent, hyperparameterTuningJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_LocationnameHyperparametertuningjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java new file mode 100644 index 000000000000..b30dd8383159 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createhyperparametertuningjob/SyncCreateHyperparameterTuningJobStringHyperparametertuningjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_StringHyperparametertuningjob_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncCreateHyperparameterTuningJobStringHyperparametertuningjob { + + public static void main(String[] args) throws Exception { + syncCreateHyperparameterTuningJobStringHyperparametertuningjob(); + } + + public static void syncCreateHyperparameterTuningJobStringHyperparametertuningjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + HyperparameterTuningJob hyperparameterTuningJob = + HyperparameterTuningJob.newBuilder().build(); + HyperparameterTuningJob response = + jobServiceClient.createHyperparameterTuningJob(parent, hyperparameterTuningJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateHyperparameterTuningJob_StringHyperparametertuningjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..2630666da3a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/AsyncCreateModelDeploymentMonitoringJob.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class AsyncCreateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncCreateModelDeploymentMonitoringJob(); + } + + public static void asyncCreateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateModelDeploymentMonitoringJobRequest request = + CreateModelDeploymentMonitoringJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.createModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..f91be95ffd00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreateModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJob(); + } + + public static void syncCreateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateModelDeploymentMonitoringJobRequest request = + CreateModelDeploymentMonitoringJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java new file mode 100644 index 000000000000..261a9b378001 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_LocationnameModeldeploymentmonitoringjob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob(); + } + + public static void + syncCreateModelDeploymentMonitoringJobLocationnameModeldeploymentmonitoringjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(parent, modelDeploymentMonitoringJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_LocationnameModeldeploymentmonitoringjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java new file mode 100644 index 000000000000..60cc6cb953ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createmodeldeploymentmonitoringjob/SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_StringModeldeploymentmonitoringjob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class SyncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob { + + public static void main(String[] args) throws Exception { + syncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob(); + } + + public static void syncCreateModelDeploymentMonitoringJobStringModeldeploymentmonitoringjob() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.createModelDeploymentMonitoringJob(parent, modelDeploymentMonitoringJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateModelDeploymentMonitoringJob_StringModeldeploymentmonitoringjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/AsyncCreateNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/AsyncCreateNasJob.java new file mode 100644 index 000000000000..4eec7d9ab6e2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/AsyncCreateNasJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class AsyncCreateNasJob { + + public static void main(String[] args) throws Exception { + asyncCreateNasJob(); + } + + public static void asyncCreateNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateNasJobRequest request = + CreateNasJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setNasJob(NasJob.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createNasJobCallable().futureCall(request); + // Do something. + NasJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJob.java new file mode 100644 index 000000000000..2ca55bbcbe5f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateNasJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreateNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class SyncCreateNasJob { + + public static void main(String[] args) throws Exception { + syncCreateNasJob(); + } + + public static void syncCreateNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateNasJobRequest request = + CreateNasJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setNasJob(NasJob.newBuilder().build()) + .build(); + NasJob response = jobServiceClient.createNasJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java new file mode 100644 index 000000000000..0fa5ccdba117 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobLocationnameNasjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateNasJob_LocationnameNasjob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class SyncCreateNasJobLocationnameNasjob { + + public static void main(String[] args) throws Exception { + syncCreateNasJobLocationnameNasjob(); + } + + public static void syncCreateNasJobLocationnameNasjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + NasJob nasJob = NasJob.newBuilder().build(); + NasJob response = jobServiceClient.createNasJob(parent, nasJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateNasJob_LocationnameNasjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java new file mode 100644 index 000000000000..4d6be94c27c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/createnasjob/SyncCreateNasJobStringNasjob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_CreateNasJob_StringNasjob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class SyncCreateNasJobStringNasjob { + + public static void main(String[] args) throws Exception { + syncCreateNasJobStringNasjob(); + } + + public static void syncCreateNasJobStringNasjob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + NasJob nasJob = NasJob.newBuilder().build(); + NasJob response = jobServiceClient.createNasJob(parent, nasJob); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_CreateNasJob_StringNasjob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java new file mode 100644 index 000000000000..67ac38ece8ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncDeleteBatchPredictionJob(); + } + + public static void asyncDeleteBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteBatchPredictionJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java new file mode 100644 index 000000000000..a76a00c84237 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/AsyncDeleteBatchPredictionJobLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteBatchPredictionJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteBatchPredictionJobLRO(); + } + + public static void asyncDeleteBatchPredictionJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteBatchPredictionJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java new file mode 100644 index 000000000000..71bff0306f11 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJob(); + } + + public static void syncDeleteBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteBatchPredictionJobRequest request = + DeleteBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + jobServiceClient.deleteBatchPredictionJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..1b7c29a9587f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncDeleteBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + jobServiceClient.deleteBatchPredictionJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java new file mode 100644 index 000000000000..f446a58ad848 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletebatchpredictionjob/SyncDeleteBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncDeleteBatchPredictionJobString(); + } + + public static void syncDeleteBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + jobServiceClient.deleteBatchPredictionJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java new file mode 100644 index 000000000000..0a4bef5c891e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteCustomJob { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomJob(); + } + + public static void asyncDeleteCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteCustomJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java new file mode 100644 index 000000000000..83dd5f883292 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/AsyncDeleteCustomJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteCustomJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteCustomJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomJobLRO(); + } + + public static void asyncDeleteCustomJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteCustomJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteCustomJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJob.java new file mode 100644 index 000000000000..b8baa0813187 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJob { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJob(); + } + + public static void syncDeleteCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteCustomJobRequest request = + DeleteCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + jobServiceClient.deleteCustomJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java new file mode 100644 index 000000000000..56b06a103ab4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJobCustomjobname(); + } + + public static void syncDeleteCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + jobServiceClient.deleteCustomJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java new file mode 100644 index 000000000000..c8333689d6ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletecustomjob/SyncDeleteCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteCustomJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCustomJobString { + + public static void main(String[] args) throws Exception { + syncDeleteCustomJobString(); + } + + public static void syncDeleteCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + jobServiceClient.deleteCustomJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java new file mode 100644 index 000000000000..485624cbeba8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncDeleteDataLabelingJob(); + } + + public static void asyncDeleteDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteDataLabelingJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java new file mode 100644 index 000000000000..908e71a71138 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/AsyncDeleteDataLabelingJobLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteDataLabelingJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDataLabelingJobLRO(); + } + + public static void asyncDeleteDataLabelingJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteDataLabelingJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java new file mode 100644 index 000000000000..64a9eeb0d54a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.DeleteDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJob(); + } + + public static void syncDeleteDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteDataLabelingJobRequest request = + DeleteDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteDataLabelingJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..f9012d12afeb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJobDatalabelingjobname(); + } + + public static void syncDeleteDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + jobServiceClient.deleteDataLabelingJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java new file mode 100644 index 000000000000..0be4a1f1bc00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletedatalabelingjob/SyncDeleteDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncDeleteDataLabelingJobString(); + } + + public static void syncDeleteDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + jobServiceClient.deleteDataLabelingJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java new file mode 100644 index 000000000000..9fb22b417aea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncDeleteHyperparameterTuningJob(); + } + + public static void asyncDeleteHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteHyperparameterTuningJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java new file mode 100644 index 000000000000..fb2014659e67 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/AsyncDeleteHyperparameterTuningJobLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteHyperparameterTuningJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteHyperparameterTuningJobLRO(); + } + + public static void asyncDeleteHyperparameterTuningJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteHyperparameterTuningJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java new file mode 100644 index 000000000000..1b6d10d8b702 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJob(); + } + + public static void syncDeleteHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteHyperparameterTuningJobRequest request = + DeleteHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteHyperparameterTuningJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..0e2615075db8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncDeleteHyperparameterTuningJobHyperparametertuningjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + jobServiceClient.deleteHyperparameterTuningJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java new file mode 100644 index 000000000000..f86bce9f3167 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletehyperparametertuningjob/SyncDeleteHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncDeleteHyperparameterTuningJobString(); + } + + public static void syncDeleteHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + jobServiceClient.deleteHyperparameterTuningJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..62a4e3d36cf2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.longrunning.Operation; + +public class AsyncDeleteModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncDeleteModelDeploymentMonitoringJob(); + } + + public static void asyncDeleteModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.deleteModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java new file mode 100644 index 000000000000..c3a776e6a7e5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/AsyncDeleteModelDeploymentMonitoringJobLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelDeploymentMonitoringJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelDeploymentMonitoringJobLRO(); + } + + public static void asyncDeleteModelDeploymentMonitoringJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + OperationFuture future = + jobServiceClient + .deleteModelDeploymentMonitoringJobOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..21ff0e75a7ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJob(); + } + + public static void syncDeleteModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteModelDeploymentMonitoringJobRequest request = + DeleteModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..28b3ad44f34d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncDeleteModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..5691ebf25609 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletemodeldeploymentmonitoringjob/SyncDeleteModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncDeleteModelDeploymentMonitoringJobString(); + } + + public static void syncDeleteModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.deleteModelDeploymentMonitoringJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJob.java new file mode 100644 index 000000000000..0e5bc369c5db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.longrunning.Operation; + +public class AsyncDeleteNasJob { + + public static void main(String[] args) throws Exception { + asyncDeleteNasJob(); + } + + public static void asyncDeleteNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteNasJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java new file mode 100644 index 000000000000..bad9ae2ca4c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/AsyncDeleteNasJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteNasJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class AsyncDeleteNasJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteNasJobLRO(); + } + + public static void asyncDeleteNasJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + OperationFuture future = + jobServiceClient.deleteNasJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteNasJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJob.java new file mode 100644 index 000000000000..ff2e4b3a3dc0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteNasJob_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJob { + + public static void main(String[] args) throws Exception { + syncDeleteNasJob(); + } + + public static void syncDeleteNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteNasJobRequest request = + DeleteNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + jobServiceClient.deleteNasJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java new file mode 100644 index 000000000000..9910d9c4d115 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncDeleteNasJobNasjobname(); + } + + public static void syncDeleteNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + jobServiceClient.deleteNasJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobString.java new file mode 100644 index 000000000000..c6b2a8f7cdd7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/deletenasjob/SyncDeleteNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_DeleteNasJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.protobuf.Empty; + +public class SyncDeleteNasJobString { + + public static void main(String[] args) throws Exception { + syncDeleteNasJobString(); + } + + public static void syncDeleteNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + jobServiceClient.deleteNasJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_DeleteNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java new file mode 100644 index 000000000000..59dbb8aef222 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/AsyncGetBatchPredictionJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.GetBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class AsyncGetBatchPredictionJob { + + public static void main(String[] args) throws Exception { + asyncGetBatchPredictionJob(); + } + + public static void asyncGetBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetBatchPredictionJobRequest request = + GetBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getBatchPredictionJobCallable().futureCall(request); + // Do something. + BatchPredictionJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java new file mode 100644 index 000000000000..d503761e1885 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.GetBatchPredictionJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetBatchPredictionJob { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJob(); + } + + public static void syncGetBatchPredictionJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetBatchPredictionJobRequest request = + GetBatchPredictionJobRequest.newBuilder() + .setName( + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]") + .toString()) + .build(); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java new file mode 100644 index 000000000000..90e36d2bd807 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobBatchpredictionjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_Batchpredictionjobname_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetBatchPredictionJobBatchpredictionjobname { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJobBatchpredictionjobname(); + } + + public static void syncGetBatchPredictionJobBatchpredictionjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchPredictionJobName name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]"); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_Batchpredictionjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java new file mode 100644 index 000000000000..14e16847d3ca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getbatchpredictionjob/SyncGetBatchPredictionJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetBatchPredictionJobString { + + public static void main(String[] args) throws Exception { + syncGetBatchPredictionJobString(); + } + + public static void syncGetBatchPredictionJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + BatchPredictionJobName.of("[PROJECT]", "[LOCATION]", "[BATCH_PREDICTION_JOB]").toString(); + BatchPredictionJob response = jobServiceClient.getBatchPredictionJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetBatchPredictionJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/AsyncGetCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/AsyncGetCustomJob.java new file mode 100644 index 000000000000..3a19e76efbc8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/AsyncGetCustomJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetCustomJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.GetCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class AsyncGetCustomJob { + + public static void main(String[] args) throws Exception { + asyncGetCustomJob(); + } + + public static void asyncGetCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetCustomJobRequest request = + GetCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getCustomJobCallable().futureCall(request); + // Do something. + CustomJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetCustomJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJob.java new file mode 100644 index 000000000000..6ec42888d280 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.GetCustomJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetCustomJob { + + public static void main(String[] args) throws Exception { + syncGetCustomJob(); + } + + public static void syncGetCustomJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetCustomJobRequest request = + GetCustomJobRequest.newBuilder() + .setName(CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString()) + .build(); + CustomJob response = jobServiceClient.getCustomJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java new file mode 100644 index 000000000000..480b6c256711 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobCustomjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetCustomJob_Customjobname_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetCustomJobCustomjobname { + + public static void main(String[] args) throws Exception { + syncGetCustomJobCustomjobname(); + } + + public static void syncGetCustomJobCustomjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CustomJobName name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]"); + CustomJob response = jobServiceClient.getCustomJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetCustomJob_Customjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobString.java new file mode 100644 index 000000000000..e6a84b74ca2a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getcustomjob/SyncGetCustomJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetCustomJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.CustomJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetCustomJobString { + + public static void main(String[] args) throws Exception { + syncGetCustomJobString(); + } + + public static void syncGetCustomJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = CustomJobName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_JOB]").toString(); + CustomJob response = jobServiceClient.getCustomJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetCustomJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java new file mode 100644 index 000000000000..bcca0933fd23 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/AsyncGetDataLabelingJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.GetDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class AsyncGetDataLabelingJob { + + public static void main(String[] args) throws Exception { + asyncGetDataLabelingJob(); + } + + public static void asyncGetDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetDataLabelingJobRequest request = + GetDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getDataLabelingJobCallable().futureCall(request); + // Do something. + DataLabelingJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java new file mode 100644 index 000000000000..33d59dbb870b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.GetDataLabelingJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetDataLabelingJob { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJob(); + } + + public static void syncGetDataLabelingJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetDataLabelingJobRequest request = + GetDataLabelingJobRequest.newBuilder() + .setName( + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]") + .toString()) + .build(); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java new file mode 100644 index 000000000000..8d7c23f51129 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobDatalabelingjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_Datalabelingjobname_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetDataLabelingJobDatalabelingjobname { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJobDatalabelingjobname(); + } + + public static void syncGetDataLabelingJobDatalabelingjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DataLabelingJobName name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]"); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_Datalabelingjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java new file mode 100644 index 000000000000..749339fc54cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getdatalabelingjob/SyncGetDataLabelingJobString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetDataLabelingJobString { + + public static void main(String[] args) throws Exception { + syncGetDataLabelingJobString(); + } + + public static void syncGetDataLabelingJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + DataLabelingJobName.of("[PROJECT]", "[LOCATION]", "[DATA_LABELING_JOB]").toString(); + DataLabelingJob response = jobServiceClient.getDataLabelingJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetDataLabelingJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java new file mode 100644 index 000000000000..892720db26bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/AsyncGetHyperparameterTuningJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class AsyncGetHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + asyncGetHyperparameterTuningJob(); + } + + public static void asyncGetHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetHyperparameterTuningJobRequest request = + GetHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getHyperparameterTuningJobCallable().futureCall(request); + // Do something. + HyperparameterTuningJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java new file mode 100644 index 000000000000..1e86f44d8d0b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_sync] +import com.google.cloud.aiplatform.v1beta1.GetHyperparameterTuningJobRequest; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetHyperparameterTuningJob { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJob(); + } + + public static void syncGetHyperparameterTuningJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetHyperparameterTuningJobRequest request = + GetHyperparameterTuningJobRequest.newBuilder() + .setName( + HyperparameterTuningJobName.of( + "[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString()) + .build(); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java new file mode 100644 index 000000000000..ea5079efef90 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobHyperparametertuningjobname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_Hyperparametertuningjobname_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetHyperparameterTuningJobHyperparametertuningjobname { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJobHyperparametertuningjobname(); + } + + public static void syncGetHyperparameterTuningJobHyperparametertuningjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + HyperparameterTuningJobName name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]"); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_Hyperparametertuningjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java new file mode 100644 index 000000000000..40babc6c5032 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/gethyperparametertuningjob/SyncGetHyperparameterTuningJobString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJobName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; + +public class SyncGetHyperparameterTuningJobString { + + public static void main(String[] args) throws Exception { + syncGetHyperparameterTuningJobString(); + } + + public static void syncGetHyperparameterTuningJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + HyperparameterTuningJobName.of("[PROJECT]", "[LOCATION]", "[HYPERPARAMETER_TUNING_JOB]") + .toString(); + HyperparameterTuningJob response = jobServiceClient.getHyperparameterTuningJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetHyperparameterTuningJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..cc53fa0f041c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..b03bcb187b02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = jobServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..e8e9b08951fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = jobServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..bfd067dadaa5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = jobServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..077fe0a33df7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/AsyncGetModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; + +public class AsyncGetModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncGetModelDeploymentMonitoringJob(); + } + + public static void asyncGetModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetModelDeploymentMonitoringJobRequest request = + GetModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..764063e62777 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.GetModelDeploymentMonitoringJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJob(); + } + + public static void syncGetModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetModelDeploymentMonitoringJobRequest request = + GetModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..72515434631f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncGetModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..d77b21677ad9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getmodeldeploymentmonitoringjob/SyncGetModelDeploymentMonitoringJobString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; + +public class SyncGetModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncGetModelDeploymentMonitoringJobString(); + } + + public static void syncGetModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + ModelDeploymentMonitoringJob response = + jobServiceClient.getModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/AsyncGetNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/AsyncGetNasJob.java new file mode 100644 index 000000000000..d9a42f5cf3a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/AsyncGetNasJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.cloud.aiplatform.v1beta1.NasJobName; + +public class AsyncGetNasJob { + + public static void main(String[] args) throws Exception { + asyncGetNasJob(); + } + + public static void asyncGetNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasJobRequest request = + GetNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getNasJobCallable().futureCall(request); + // Do something. + NasJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJob.java new file mode 100644 index 000000000000..4243b9516a7b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasJob_sync] +import com.google.cloud.aiplatform.v1beta1.GetNasJobRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.cloud.aiplatform.v1beta1.NasJobName; + +public class SyncGetNasJob { + + public static void main(String[] args) throws Exception { + syncGetNasJob(); + } + + public static void syncGetNasJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasJobRequest request = + GetNasJobRequest.newBuilder() + .setName(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .build(); + NasJob response = jobServiceClient.getNasJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobNasjobname.java new file mode 100644 index 000000000000..92b86b43b3c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobNasjobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasJob_Nasjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.cloud.aiplatform.v1beta1.NasJobName; + +public class SyncGetNasJobNasjobname { + + public static void main(String[] args) throws Exception { + syncGetNasJobNasjobname(); + } + + public static void syncGetNasJobNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + NasJob response = jobServiceClient.getNasJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasJob_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobString.java new file mode 100644 index 000000000000..5372f6c63899 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnasjob/SyncGetNasJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.cloud.aiplatform.v1beta1.NasJobName; + +public class SyncGetNasJobString { + + public static void main(String[] args) throws Exception { + syncGetNasJobString(); + } + + public static void syncGetNasJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + NasJob response = jobServiceClient.getNasJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java new file mode 100644 index 000000000000..e9fbad1b9e18 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/AsyncGetNasTrialDetail.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetNasTrialDetailRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetailName; + +public class AsyncGetNasTrialDetail { + + public static void main(String[] args) throws Exception { + asyncGetNasTrialDetail(); + } + + public static void asyncGetNasTrialDetail() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasTrialDetailRequest request = + GetNasTrialDetailRequest.newBuilder() + .setName( + NasTrialDetailName.of( + "[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.getNasTrialDetailCallable().futureCall(request); + // Do something. + NasTrialDetail response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java new file mode 100644 index 000000000000..cde91d912cbd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetail.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_sync] +import com.google.cloud.aiplatform.v1beta1.GetNasTrialDetailRequest; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetailName; + +public class SyncGetNasTrialDetail { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetail(); + } + + public static void syncGetNasTrialDetail() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetNasTrialDetailRequest request = + GetNasTrialDetailRequest.newBuilder() + .setName( + NasTrialDetailName.of( + "[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString()) + .build(); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java new file mode 100644 index 000000000000..130ad91233b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailNastrialdetailname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_Nastrialdetailname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetailName; + +public class SyncGetNasTrialDetailNastrialdetailname { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetailNastrialdetailname(); + } + + public static void syncGetNasTrialDetailNastrialdetailname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasTrialDetailName name = + NasTrialDetailName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]"); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_Nastrialdetailname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java new file mode 100644 index 000000000000..5c3dbce982e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/getnastrialdetail/SyncGetNasTrialDetailString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetailName; + +public class SyncGetNasTrialDetailString { + + public static void main(String[] args) throws Exception { + syncGetNasTrialDetailString(); + } + + public static void syncGetNasTrialDetailString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + NasTrialDetailName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]", "[NAS_TRIAL_DETAIL]") + .toString(); + NasTrialDetail response = jobServiceClient.getNasTrialDetail(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_GetNasTrialDetail_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java new file mode 100644 index 000000000000..fbae1f3ce421 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListBatchPredictionJobs { + + public static void main(String[] args) throws Exception { + asyncListBatchPredictionJobs(); + } + + public static void asyncListBatchPredictionJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listBatchPredictionJobsPagedCallable().futureCall(request); + // Do something. + for (BatchPredictionJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java new file mode 100644 index 000000000000..1ffafbf2838c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/AsyncListBatchPredictionJobsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListBatchPredictionJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListBatchPredictionJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListBatchPredictionJobsPaged(); + } + + public static void asyncListBatchPredictionJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListBatchPredictionJobsResponse response = + jobServiceClient.listBatchPredictionJobsCallable().call(request); + for (BatchPredictionJob element : response.getBatchPredictionJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java new file mode 100644 index 000000000000..c4c31246af64 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListBatchPredictionJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListBatchPredictionJobs { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobs(); + } + + public static void syncListBatchPredictionJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListBatchPredictionJobsRequest request = + ListBatchPredictionJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java new file mode 100644 index 000000000000..f5e2dc1c5f47 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListBatchPredictionJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobsLocationname(); + } + + public static void syncListBatchPredictionJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java new file mode 100644 index 000000000000..3854ed6ed984 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listbatchpredictionjobs/SyncListBatchPredictionJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchPredictionJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListBatchPredictionJobsString { + + public static void main(String[] args) throws Exception { + syncListBatchPredictionJobsString(); + } + + public static void syncListBatchPredictionJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (BatchPredictionJob element : + jobServiceClient.listBatchPredictionJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListBatchPredictionJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobs.java new file mode 100644 index 000000000000..74958a762d2f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListCustomJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListCustomJobs { + + public static void main(String[] args) throws Exception { + asyncListCustomJobs(); + } + + public static void asyncListCustomJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listCustomJobsPagedCallable().futureCall(request); + // Do something. + for (CustomJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListCustomJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java new file mode 100644 index 000000000000..88ac9ff3d818 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/AsyncListCustomJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListCustomJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListCustomJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListCustomJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListCustomJobsPaged(); + } + + public static void asyncListCustomJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListCustomJobsResponse response = jobServiceClient.listCustomJobsCallable().call(request); + for (CustomJob element : response.getCustomJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListCustomJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobs.java new file mode 100644 index 000000000000..1f99f2f099d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListCustomJobs_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListCustomJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListCustomJobs { + + public static void main(String[] args) throws Exception { + syncListCustomJobs(); + } + + public static void syncListCustomJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListCustomJobsRequest request = + ListCustomJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (CustomJob element : jobServiceClient.listCustomJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListCustomJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java new file mode 100644 index 000000000000..6e7fdb9a08ac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListCustomJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListCustomJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListCustomJobsLocationname(); + } + + public static void syncListCustomJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CustomJob element : jobServiceClient.listCustomJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListCustomJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsString.java new file mode 100644 index 000000000000..17e1849e11ca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listcustomjobs/SyncListCustomJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListCustomJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.CustomJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListCustomJobsString { + + public static void main(String[] args) throws Exception { + syncListCustomJobsString(); + } + + public static void syncListCustomJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CustomJob element : jobServiceClient.listCustomJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListCustomJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java new file mode 100644 index 000000000000..4054b009ae42 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobs.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListDataLabelingJobs { + + public static void main(String[] args) throws Exception { + asyncListDataLabelingJobs(); + } + + public static void asyncListDataLabelingJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + jobServiceClient.listDataLabelingJobsPagedCallable().futureCall(request); + // Do something. + for (DataLabelingJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java new file mode 100644 index 000000000000..382de415a433 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/AsyncListDataLabelingJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListDataLabelingJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListDataLabelingJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListDataLabelingJobsPaged(); + } + + public static void asyncListDataLabelingJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDataLabelingJobsResponse response = + jobServiceClient.listDataLabelingJobsCallable().call(request); + for (DataLabelingJob element : response.getDataLabelingJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java new file mode 100644 index 000000000000..0e139c2b0174 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListDataLabelingJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListDataLabelingJobs { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobs(); + } + + public static void syncListDataLabelingJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListDataLabelingJobsRequest request = + ListDataLabelingJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java new file mode 100644 index 000000000000..cc3407090a90 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListDataLabelingJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobsLocationname(); + } + + public static void syncListDataLabelingJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java new file mode 100644 index 000000000000..b87e0322fd28 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listdatalabelingjobs/SyncListDataLabelingJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.DataLabelingJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListDataLabelingJobsString { + + public static void main(String[] args) throws Exception { + syncListDataLabelingJobsString(); + } + + public static void syncListDataLabelingJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (DataLabelingJob element : jobServiceClient.listDataLabelingJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListDataLabelingJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java new file mode 100644 index 000000000000..892d9d9cf01a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class AsyncListHyperparameterTuningJobs { + + public static void main(String[] args) throws Exception { + asyncListHyperparameterTuningJobs(); + } + + public static void asyncListHyperparameterTuningJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listHyperparameterTuningJobsPagedCallable().futureCall(request); + // Do something. + for (HyperparameterTuningJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java new file mode 100644 index 000000000000..74219614dfb4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/AsyncListHyperparameterTuningJobsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListHyperparameterTuningJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListHyperparameterTuningJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListHyperparameterTuningJobsPaged(); + } + + public static void asyncListHyperparameterTuningJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListHyperparameterTuningJobsResponse response = + jobServiceClient.listHyperparameterTuningJobsCallable().call(request); + for (HyperparameterTuningJob element : response.getHyperparameterTuningJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java new file mode 100644 index 000000000000..8546524087eb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListHyperparameterTuningJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.protobuf.FieldMask; + +public class SyncListHyperparameterTuningJobs { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobs(); + } + + public static void syncListHyperparameterTuningJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListHyperparameterTuningJobsRequest request = + ListHyperparameterTuningJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java new file mode 100644 index 000000000000..ea475c15c6df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListHyperparameterTuningJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobsLocationname(); + } + + public static void syncListHyperparameterTuningJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java new file mode 100644 index 000000000000..64053e38e238 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listhyperparametertuningjobs/SyncListHyperparameterTuningJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; + +public class SyncListHyperparameterTuningJobsString { + + public static void main(String[] args) throws Exception { + syncListHyperparameterTuningJobsString(); + } + + public static void syncListHyperparameterTuningJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (HyperparameterTuningJob element : + jobServiceClient.listHyperparameterTuningJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListHyperparameterTuningJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..2a98d58ae4f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + jobServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..0f74cf2e7be5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = jobServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..5652fe46da24 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : jobServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java new file mode 100644 index 000000000000..f506f4db8898 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobs.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class AsyncListModelDeploymentMonitoringJobs { + + public static void main(String[] args) throws Exception { + asyncListModelDeploymentMonitoringJobs(); + } + + public static void asyncListModelDeploymentMonitoringJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.listModelDeploymentMonitoringJobsPagedCallable().futureCall(request); + // Do something. + for (ModelDeploymentMonitoringJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java new file mode 100644 index 000000000000..d70da71870e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/AsyncListModelDeploymentMonitoringJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListModelDeploymentMonitoringJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelDeploymentMonitoringJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelDeploymentMonitoringJobsPaged(); + } + + public static void asyncListModelDeploymentMonitoringJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelDeploymentMonitoringJobsResponse response = + jobServiceClient.listModelDeploymentMonitoringJobsCallable().call(request); + for (ModelDeploymentMonitoringJob element : + response.getModelDeploymentMonitoringJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java new file mode 100644 index 000000000000..2463c09be3b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListModelDeploymentMonitoringJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class SyncListModelDeploymentMonitoringJobs { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobs(); + } + + public static void syncListModelDeploymentMonitoringJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListModelDeploymentMonitoringJobsRequest request = + ListModelDeploymentMonitoringJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java new file mode 100644 index 000000000000..981e48e0ae20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class SyncListModelDeploymentMonitoringJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobsLocationname(); + } + + public static void syncListModelDeploymentMonitoringJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java new file mode 100644 index 000000000000..f366cbea5d0d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listmodeldeploymentmonitoringjobs/SyncListModelDeploymentMonitoringJobsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; + +public class SyncListModelDeploymentMonitoringJobsString { + + public static void main(String[] args) throws Exception { + syncListModelDeploymentMonitoringJobsString(); + } + + public static void syncListModelDeploymentMonitoringJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (ModelDeploymentMonitoringJob element : + jobServiceClient.listModelDeploymentMonitoringJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListModelDeploymentMonitoringJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobs.java new file mode 100644 index 000000000000..42730bd6722e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobs.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.protobuf.FieldMask; + +public class AsyncListNasJobs { + + public static void main(String[] args) throws Exception { + asyncListNasJobs(); + } + + public static void asyncListNasJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.listNasJobsPagedCallable().futureCall(request); + // Do something. + for (NasJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobsPaged.java new file mode 100644 index 000000000000..9946d5a56692 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/AsyncListNasJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListNasJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListNasJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListNasJobsPaged(); + } + + public static void asyncListNasJobsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListNasJobsResponse response = jobServiceClient.listNasJobsCallable().call(request); + for (NasJob element : response.getNasJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobs.java new file mode 100644 index 000000000000..4a6c6b8195ac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasJobs_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; +import com.google.protobuf.FieldMask; + +public class SyncListNasJobs { + + public static void main(String[] args) throws Exception { + syncListNasJobs(); + } + + public static void syncListNasJobs() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasJobsRequest request = + ListNasJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (NasJob element : jobServiceClient.listNasJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsLocationname.java new file mode 100644 index 000000000000..fb9cb0948d1a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class SyncListNasJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListNasJobsLocationname(); + } + + public static void syncListNasJobsLocationname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (NasJob element : jobServiceClient.listNasJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsString.java new file mode 100644 index 000000000000..bc7f4a7d7552 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnasjobs/SyncListNasJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.NasJob; + +public class SyncListNasJobsString { + + public static void main(String[] args) throws Exception { + syncListNasJobsString(); + } + + public static void syncListNasJobsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (NasJob element : jobServiceClient.listNasJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java new file mode 100644 index 000000000000..93eee468648e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetails.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; + +public class AsyncListNasTrialDetails { + + public static void main(String[] args) throws Exception { + asyncListNasTrialDetails(); + } + + public static void asyncListNasTrialDetails() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + jobServiceClient.listNasTrialDetailsPagedCallable().futureCall(request); + // Do something. + for (NasTrialDetail element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java new file mode 100644 index 000000000000..f5388a1d07b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/AsyncListNasTrialDetailsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_Paged_async] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1beta1.ListNasTrialDetailsResponse; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; +import com.google.common.base.Strings; + +public class AsyncListNasTrialDetailsPaged { + + public static void main(String[] args) throws Exception { + asyncListNasTrialDetailsPaged(); + } + + public static void asyncListNasTrialDetailsPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListNasTrialDetailsResponse response = + jobServiceClient.listNasTrialDetailsCallable().call(request); + for (NasTrialDetail element : response.getNasTrialDetailsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java new file mode 100644 index 000000000000..fea9a987dddf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetails.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ListNasTrialDetailsRequest; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; + +public class SyncListNasTrialDetails { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetails(); + } + + public static void syncListNasTrialDetails() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListNasTrialDetailsRequest request = + ListNasTrialDetailsRequest.newBuilder() + .setParent(NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java new file mode 100644 index 000000000000..da57bffa4857 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsNasjobname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_Nasjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; + +public class SyncListNasTrialDetailsNasjobname { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetailsNasjobname(); + } + + public static void syncListNasTrialDetailsNasjobname() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + NasJobName parent = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]"); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_Nasjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java new file mode 100644 index 000000000000..688e8f4e1b6c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/listnastrialdetails/SyncListNasTrialDetailsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.NasJobName; +import com.google.cloud.aiplatform.v1beta1.NasTrialDetail; + +public class SyncListNasTrialDetailsString { + + public static void main(String[] args) throws Exception { + syncListNasTrialDetailsString(); + } + + public static void syncListNasTrialDetailsString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = NasJobName.of("[PROJECT]", "[LOCATION]", "[NAS_JOB]").toString(); + for (NasTrialDetail element : jobServiceClient.listNasTrialDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ListNasTrialDetails_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..d67ad586989f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/AsyncPauseModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.PauseModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class AsyncPauseModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncPauseModelDeploymentMonitoringJob(); + } + + public static void asyncPauseModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + PauseModelDeploymentMonitoringJobRequest request = + PauseModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.pauseModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..122fd3324de3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.PauseModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJob(); + } + + public static void syncPauseModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + PauseModelDeploymentMonitoringJobRequest request = + PauseModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.pauseModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..7b6de8d55cc0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncPauseModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.pauseModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..043a607e8087 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/pausemodeldeploymentmonitoringjob/SyncPauseModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncPauseModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncPauseModelDeploymentMonitoringJobString(); + } + + public static void syncPauseModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.pauseModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_PauseModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..7f24d83c010b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/AsyncResumeModelDeploymentMonitoringJob.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ResumeModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class AsyncResumeModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncResumeModelDeploymentMonitoringJob(); + } + + public static void asyncResumeModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ResumeModelDeploymentMonitoringJobRequest request = + ResumeModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + ApiFuture future = + jobServiceClient.resumeModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..67b9e7c132b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ResumeModelDeploymentMonitoringJobRequest; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJob(); + } + + public static void syncResumeModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ResumeModelDeploymentMonitoringJobRequest request = + ResumeModelDeploymentMonitoringJobRequest.newBuilder() + .setName( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .build(); + jobServiceClient.resumeModelDeploymentMonitoringJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java new file mode 100644 index 000000000000..800f14f34a57 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname(); + } + + public static void syncResumeModelDeploymentMonitoringJobModeldeploymentmonitoringjobname() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + jobServiceClient.resumeModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_Modeldeploymentmonitoringjobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java new file mode 100644 index 000000000000..73c217521c2e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/resumemodeldeploymentmonitoringjob/SyncResumeModelDeploymentMonitoringJobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.protobuf.Empty; + +public class SyncResumeModelDeploymentMonitoringJobString { + + public static void main(String[] args) throws Exception { + syncResumeModelDeploymentMonitoringJobString(); + } + + public static void syncResumeModelDeploymentMonitoringJobString() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + jobServiceClient.resumeModelDeploymentMonitoringJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_ResumeModelDeploymentMonitoringJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java new file mode 100644 index 000000000000..d35d7626aaf3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomalies.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1beta1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncSearchModelDeploymentMonitoringStatsAnomalies { + + public static void main(String[] args) throws Exception { + asyncSearchModelDeploymentMonitoringStatsAnomalies(); + } + + public static void asyncSearchModelDeploymentMonitoringStatsAnomalies() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomaliesPagedCallable() + .futureCall(request); + // Do something. + for (ModelMonitoringStatsAnomalies element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java new file mode 100644 index 000000000000..e85dea361b7b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_Paged_async] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1beta1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.cloud.aiplatform.v1beta1.SearchModelDeploymentMonitoringStatsAnomaliesResponse; +import com.google.common.base.Strings; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class AsyncSearchModelDeploymentMonitoringStatsAnomaliesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchModelDeploymentMonitoringStatsAnomaliesPaged(); + } + + public static void asyncSearchModelDeploymentMonitoringStatsAnomaliesPaged() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + while (true) { + SearchModelDeploymentMonitoringStatsAnomaliesResponse response = + jobServiceClient.searchModelDeploymentMonitoringStatsAnomaliesCallable().call(request); + for (ModelMonitoringStatsAnomalies element : response.getMonitoringStatsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java new file mode 100644 index 000000000000..a0e547ceeacd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomalies.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ModelMonitoringStatsAnomalies; +import com.google.cloud.aiplatform.v1beta1.SearchModelDeploymentMonitoringStatsAnomaliesRequest; +import com.google.protobuf.Timestamp; +import java.util.ArrayList; + +public class SyncSearchModelDeploymentMonitoringStatsAnomalies { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomalies(); + } + + public static void syncSearchModelDeploymentMonitoringStatsAnomalies() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchModelDeploymentMonitoringStatsAnomaliesRequest request = + SearchModelDeploymentMonitoringStatsAnomaliesRequest.newBuilder() + .setModelDeploymentMonitoringJob( + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString()) + .setDeployedModelId("deployedModelId-1817547906") + .setFeatureDisplayName("featureDisplayName-1741181545") + .addAllObjectives( + new ArrayList< + SearchModelDeploymentMonitoringStatsAnomaliesRequest + .StatsAnomaliesObjective>()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .build(); + for (ModelMonitoringStatsAnomalies element : + jobServiceClient.searchModelDeploymentMonitoringStatsAnomalies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java new file mode 100644 index 000000000000..edf480acbc79 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_ModeldeploymentmonitoringjobnameString_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ModelMonitoringStatsAnomalies; + +public +class SyncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString(); + } + + public static void + syncSearchModelDeploymentMonitoringStatsAnomaliesModeldeploymentmonitoringjobnameString() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJobName modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"); + String deployedModelId = "deployedModelId-1817547906"; + for (ModelMonitoringStatsAnomalies element : + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomalies( + modelDeploymentMonitoringJob, deployedModelId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_ModeldeploymentmonitoringjobnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java new file mode 100644 index 000000000000..10a2454b10e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/searchmodeldeploymentmonitoringstatsanomalies/SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_StringString_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJobName; +import com.google.cloud.aiplatform.v1beta1.ModelMonitoringStatsAnomalies; + +public class SyncSearchModelDeploymentMonitoringStatsAnomaliesStringString { + + public static void main(String[] args) throws Exception { + syncSearchModelDeploymentMonitoringStatsAnomaliesStringString(); + } + + public static void syncSearchModelDeploymentMonitoringStatsAnomaliesStringString() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJobName.of( + "[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]") + .toString(); + String deployedModelId = "deployedModelId-1817547906"; + for (ModelMonitoringStatsAnomalies element : + jobServiceClient + .searchModelDeploymentMonitoringStatsAnomalies( + modelDeploymentMonitoringJob, deployedModelId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SearchModelDeploymentMonitoringStatsAnomalies_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..3275e4b6a572 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..3e4173c657dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = jobServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..9fd91edb9868 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + jobServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..0827e3cc70b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = jobServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..50be8720972c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + asyncUpdateModelDeploymentMonitoringJob(); + } + + public static void asyncUpdateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + jobServiceClient.updateModelDeploymentMonitoringJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java new file mode 100644 index 000000000000..09bcf7d210c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/AsyncUpdateModelDeploymentMonitoringJobLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.UpdateModelDeploymentMonitoringJobOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModelDeploymentMonitoringJobLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateModelDeploymentMonitoringJobLRO(); + } + + public static void asyncUpdateModelDeploymentMonitoringJobLRO() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture< + ModelDeploymentMonitoringJob, UpdateModelDeploymentMonitoringJobOperationMetadata> + future = + jobServiceClient + .updateModelDeploymentMonitoringJobOperationCallable() + .futureCall(request); + // Do something. + ModelDeploymentMonitoringJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java new file mode 100644 index 000000000000..0959bc51acc0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.cloud.aiplatform.v1beta1.UpdateModelDeploymentMonitoringJobRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelDeploymentMonitoringJob { + + public static void main(String[] args) throws Exception { + syncUpdateModelDeploymentMonitoringJob(); + } + + public static void syncUpdateModelDeploymentMonitoringJob() throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateModelDeploymentMonitoringJobRequest request = + UpdateModelDeploymentMonitoringJobRequest.newBuilder() + .setModelDeploymentMonitoringJob(ModelDeploymentMonitoringJob.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ModelDeploymentMonitoringJob response = + jobServiceClient.updateModelDeploymentMonitoringJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java new file mode 100644 index 000000000000..c6937b30abbe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservice/updatemodeldeploymentmonitoringjob/SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_ModeldeploymentmonitoringjobFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask(); + } + + public static void syncUpdateModelDeploymentMonitoringJobModeldeploymentmonitoringjobFieldmask() + throws Exception { + // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ModelDeploymentMonitoringJob modelDeploymentMonitoringJob = + ModelDeploymentMonitoringJob.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + ModelDeploymentMonitoringJob response = + jobServiceClient + .updateModelDeploymentMonitoringJobAsync(modelDeploymentMonitoringJob, updateMask) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_JobService_UpdateModelDeploymentMonitoringJob_ModeldeploymentmonitoringjobFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..740331c3b216 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/jobservicesettings/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_JobServiceSettings_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.JobServiceSettings; +import java.time.Duration; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 + JobServiceSettings.Builder jobServiceSettingsBuilder = JobServiceSettings.newBuilder(); + jobServiceSettingsBuilder + .createCustomJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder + .createCustomJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_JobServiceSettings_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..447e80e8ebe3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.aiplatform.v1beta1.MatchServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MatchServiceSettings matchServiceSettings = + MatchServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MatchServiceClient matchServiceClient = MatchServiceClient.create(matchServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MatchService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..0d9c653139bf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.aiplatform.v1beta1.MatchServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MatchServiceSettings matchServiceSettings = + MatchServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MatchServiceClient matchServiceClient = MatchServiceClient.create(matchServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MatchService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/AsyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/AsyncFindNeighbors.java new file mode 100644 index 000000000000..03a26ccf4553 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/AsyncFindNeighbors.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_FindNeighbors_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.FindNeighborsRequest; +import com.google.cloud.aiplatform.v1beta1.FindNeighborsResponse; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import java.util.ArrayList; + +public class AsyncFindNeighbors { + + public static void main(String[] args) throws Exception { + asyncFindNeighbors(); + } + + public static void asyncFindNeighbors() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + FindNeighborsRequest request = + FindNeighborsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllQueries(new ArrayList()) + .setReturnFullDatapoint(true) + .build(); + ApiFuture future = + matchServiceClient.findNeighborsCallable().futureCall(request); + // Do something. + FindNeighborsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_FindNeighbors_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..7d426c09a97d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1beta1.FindNeighborsRequest; +import com.google.cloud.aiplatform.v1beta1.FindNeighborsResponse; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import java.util.ArrayList; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + FindNeighborsRequest request = + FindNeighborsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllQueries(new ArrayList()) + .setReturnFullDatapoint(true) + .build(); + FindNeighborsResponse response = matchServiceClient.findNeighbors(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..bdd8e876627f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = matchServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..4c7c157a9680 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = matchServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..7460a2c5634e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = matchServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..18b6631f736e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = matchServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..0b5852b63295 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + matchServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..d0c8d5d9f277 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = matchServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..93bdfb451dda --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : matchServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java new file mode 100644 index 000000000000..c433cd70e5df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/AsyncReadIndexDatapoints.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_ReadIndexDatapoints_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadIndexDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.ReadIndexDatapointsResponse; +import java.util.ArrayList; + +public class AsyncReadIndexDatapoints { + + public static void main(String[] args) throws Exception { + asyncReadIndexDatapoints(); + } + + public static void asyncReadIndexDatapoints() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ReadIndexDatapointsRequest request = + ReadIndexDatapointsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllIds(new ArrayList()) + .build(); + ApiFuture future = + matchServiceClient.readIndexDatapointsCallable().futureCall(request); + // Do something. + ReadIndexDatapointsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_ReadIndexDatapoints_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java new file mode 100644 index 000000000000..d1b28f5b35aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/readindexdatapoints/SyncReadIndexDatapoints.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_ReadIndexDatapoints_sync] +import com.google.cloud.aiplatform.v1beta1.IndexEndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.cloud.aiplatform.v1beta1.ReadIndexDatapointsRequest; +import com.google.cloud.aiplatform.v1beta1.ReadIndexDatapointsResponse; +import java.util.ArrayList; + +public class SyncReadIndexDatapoints { + + public static void main(String[] args) throws Exception { + syncReadIndexDatapoints(); + } + + public static void syncReadIndexDatapoints() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + ReadIndexDatapointsRequest request = + ReadIndexDatapointsRequest.newBuilder() + .setIndexEndpoint( + IndexEndpointName.of("[PROJECT]", "[LOCATION]", "[INDEX_ENDPOINT]").toString()) + .setDeployedIndexId("deployedIndexId-1101212953") + .addAllIds(new ArrayList()) + .build(); + ReadIndexDatapointsResponse response = matchServiceClient.readIndexDatapoints(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_ReadIndexDatapoints_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..e7e312787ce8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = matchServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..ee9d5287e8ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = matchServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..85ef1cb1c655 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + matchServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..5c87ab9cf8ac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MatchServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MatchServiceClient matchServiceClient = MatchServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = matchServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_MatchService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservicesettings/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservicesettings/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..8f8e6ed772a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/matchservicesettings/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MatchServiceSettings_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1beta1.MatchServiceSettings; +import java.time.Duration; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 + MatchServiceSettings.Builder matchServiceSettingsBuilder = MatchServiceSettings.newBuilder(); + matchServiceSettingsBuilder + .findNeighborsSettings() + .setRetrySettings( + matchServiceSettingsBuilder + .findNeighborsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MatchServiceSettings matchServiceSettings = matchServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MatchServiceSettings_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java new file mode 100644 index 000000000000..f5e8147a557d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/AsyncAddContextArtifactsAndExecutions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddContextArtifactsAndExecutions { + + public static void main(String[] args) throws Exception { + asyncAddContextArtifactsAndExecutions(); + } + + public static void asyncAddContextArtifactsAndExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextArtifactsAndExecutionsRequest request = + AddContextArtifactsAndExecutionsRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllArtifacts(new ArrayList()) + .addAllExecutions(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addContextArtifactsAndExecutionsCallable().futureCall(request); + // Do something. + AddContextArtifactsAndExecutionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java new file mode 100644 index 000000000000..7a82ff943b30 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddContextArtifactsAndExecutions { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutions(); + } + + public static void syncAddContextArtifactsAndExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextArtifactsAndExecutionsRequest request = + AddContextArtifactsAndExecutionsRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllArtifacts(new ArrayList()) + .addAllExecutions(new ArrayList()) + .build(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java new file mode 100644 index 000000000000..496712ccbd5d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsContextnameListstringListstring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_ContextnameListstringListstring_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextArtifactsAndExecutionsContextnameListstringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutionsContextnameListstringListstring(); + } + + public static void syncAddContextArtifactsAndExecutionsContextnameListstringListstring() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List artifacts = new ArrayList<>(); + List executions = new ArrayList<>(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(context, artifacts, executions); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_ContextnameListstringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java new file mode 100644 index 000000000000..63164d80e73b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextartifactsandexecutions/SyncAddContextArtifactsAndExecutionsStringListstringListstring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_StringListstringListstring_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextArtifactsAndExecutionsResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextArtifactsAndExecutionsStringListstringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextArtifactsAndExecutionsStringListstringListstring(); + } + + public static void syncAddContextArtifactsAndExecutionsStringListstringListstring() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List artifacts = new ArrayList<>(); + List executions = new ArrayList<>(); + AddContextArtifactsAndExecutionsResponse response = + metadataServiceClient.addContextArtifactsAndExecutions(context, artifacts, executions); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextArtifactsAndExecutions_StringListstringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/AsyncAddContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/AsyncAddContextChildren.java new file mode 100644 index 000000000000..342dc5cdee91 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/AsyncAddContextChildren.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextChildren_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenRequest; +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddContextChildren { + + public static void main(String[] args) throws Exception { + asyncAddContextChildren(); + } + + public static void asyncAddContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextChildrenRequest request = + AddContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addContextChildrenCallable().futureCall(request); + // Do something. + AddContextChildrenResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextChildren_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildren.java new file mode 100644 index 000000000000..9112acccfe57 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildren.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextChildren_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenRequest; +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddContextChildren { + + public static void main(String[] args) throws Exception { + syncAddContextChildren(); + } + + public static void syncAddContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddContextChildrenRequest request = + AddContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + AddContextChildrenResponse response = metadataServiceClient.addContextChildren(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextChildren_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java new file mode 100644 index 000000000000..3f03b8ad3c4e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenContextnameListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextChildren_ContextnameListstring_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextChildrenContextnameListstring { + + public static void main(String[] args) throws Exception { + syncAddContextChildrenContextnameListstring(); + } + + public static void syncAddContextChildrenContextnameListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List childContexts = new ArrayList<>(); + AddContextChildrenResponse response = + metadataServiceClient.addContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextChildren_ContextnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java new file mode 100644 index 000000000000..c26f35710204 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addcontextchildren/SyncAddContextChildrenStringListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddContextChildren_StringListstring_sync] +import com.google.cloud.aiplatform.v1beta1.AddContextChildrenResponse; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddContextChildrenStringListstring { + + public static void main(String[] args) throws Exception { + syncAddContextChildrenStringListstring(); + } + + public static void syncAddContextChildrenStringListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List childContexts = new ArrayList<>(); + AddContextChildrenResponse response = + metadataServiceClient.addContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddContextChildren_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java new file mode 100644 index 000000000000..718a77c12c7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/AsyncAddExecutionEvents.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsRequest; +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1beta1.Event; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class AsyncAddExecutionEvents { + + public static void main(String[] args) throws Exception { + asyncAddExecutionEvents(); + } + + public static void asyncAddExecutionEvents() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddExecutionEventsRequest request = + AddExecutionEventsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .addAllEvents(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.addExecutionEventsCallable().futureCall(request); + // Do something. + AddExecutionEventsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java new file mode 100644 index 000000000000..ca701e7571de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEvents.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_sync] +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsRequest; +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1beta1.Event; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; + +public class SyncAddExecutionEvents { + + public static void main(String[] args) throws Exception { + syncAddExecutionEvents(); + } + + public static void syncAddExecutionEvents() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + AddExecutionEventsRequest request = + AddExecutionEventsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .addAllEvents(new ArrayList()) + .build(); + AddExecutionEventsResponse response = metadataServiceClient.addExecutionEvents(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java new file mode 100644 index 000000000000..c437188444aa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsExecutionnameListevent.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_ExecutionnameListevent_sync] +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1beta1.Event; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddExecutionEventsExecutionnameListevent { + + public static void main(String[] args) throws Exception { + syncAddExecutionEventsExecutionnameListevent(); + } + + public static void syncAddExecutionEventsExecutionnameListevent() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + List events = new ArrayList<>(); + AddExecutionEventsResponse response = + metadataServiceClient.addExecutionEvents(execution, events); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_ExecutionnameListevent_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java new file mode 100644 index 000000000000..cd4df037d88a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/addexecutionevents/SyncAddExecutionEventsStringListevent.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_StringListevent_sync] +import com.google.cloud.aiplatform.v1beta1.AddExecutionEventsResponse; +import com.google.cloud.aiplatform.v1beta1.Event; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncAddExecutionEventsStringListevent { + + public static void main(String[] args) throws Exception { + syncAddExecutionEventsStringListevent(); + } + + public static void syncAddExecutionEventsStringListevent() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + List events = new ArrayList<>(); + AddExecutionEventsResponse response = + metadataServiceClient.addExecutionEvents(execution, events); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_AddExecutionEvents_StringListevent_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..752647b1ed8e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MetadataServiceSettings metadataServiceSettings = + MetadataServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MetadataServiceClient metadataServiceClient = + MetadataServiceClient.create(metadataServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MetadataService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..7e7389943354 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MetadataServiceSettings metadataServiceSettings = + MetadataServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MetadataServiceClient metadataServiceClient = + MetadataServiceClient.create(metadataServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MetadataService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/AsyncCreateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/AsyncCreateArtifact.java new file mode 100644 index 000000000000..bdd353a88b7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/AsyncCreateArtifact.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.CreateArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncCreateArtifact { + + public static void main(String[] args) throws Exception { + asyncCreateArtifact(); + } + + public static void asyncCreateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateArtifactRequest request = + CreateArtifactRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setArtifact(Artifact.newBuilder().build()) + .setArtifactId("artifactId240640653") + .build(); + ApiFuture future = + metadataServiceClient.createArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifact.java new file mode 100644 index 000000000000..d1991ab9a764 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifact.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateArtifact_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.CreateArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateArtifact { + + public static void main(String[] args) throws Exception { + syncCreateArtifact(); + } + + public static void syncCreateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateArtifactRequest request = + CreateArtifactRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setArtifact(Artifact.newBuilder().build()) + .setArtifactId("artifactId240640653") + .build(); + Artifact response = metadataServiceClient.createArtifact(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java new file mode 100644 index 000000000000..2b72bc07f845 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactMetadatastorenameArtifactString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateArtifact_MetadatastorenameArtifactString_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateArtifactMetadatastorenameArtifactString { + + public static void main(String[] args) throws Exception { + syncCreateArtifactMetadatastorenameArtifactString(); + } + + public static void syncCreateArtifactMetadatastorenameArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Artifact artifact = Artifact.newBuilder().build(); + String artifactId = "artifactId240640653"; + Artifact response = metadataServiceClient.createArtifact(parent, artifact, artifactId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateArtifact_MetadatastorenameArtifactString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java new file mode 100644 index 000000000000..a6bacaaeb44e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createartifact/SyncCreateArtifactStringArtifactString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateArtifact_StringArtifactString_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateArtifactStringArtifactString { + + public static void main(String[] args) throws Exception { + syncCreateArtifactStringArtifactString(); + } + + public static void syncCreateArtifactStringArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Artifact artifact = Artifact.newBuilder().build(); + String artifactId = "artifactId240640653"; + Artifact response = metadataServiceClient.createArtifact(parent, artifact, artifactId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateArtifact_StringArtifactString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/AsyncCreateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/AsyncCreateContext.java new file mode 100644 index 000000000000..2392aa4b60e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/AsyncCreateContext.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.CreateContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncCreateContext { + + public static void main(String[] args) throws Exception { + asyncCreateContext(); + } + + public static void asyncCreateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateContextRequest request = + CreateContextRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setContext(Context.newBuilder().build()) + .setContextId("contextId-406810838") + .build(); + ApiFuture future = metadataServiceClient.createContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContext.java new file mode 100644 index 000000000000..e24aed2b17ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContext.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateContext_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.CreateContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateContext { + + public static void main(String[] args) throws Exception { + syncCreateContext(); + } + + public static void syncCreateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateContextRequest request = + CreateContextRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setContext(Context.newBuilder().build()) + .setContextId("contextId-406810838") + .build(); + Context response = metadataServiceClient.createContext(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java new file mode 100644 index 000000000000..0bd3761a79ca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextMetadatastorenameContextString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateContext_MetadatastorenameContextString_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateContextMetadatastorenameContextString { + + public static void main(String[] args) throws Exception { + syncCreateContextMetadatastorenameContextString(); + } + + public static void syncCreateContextMetadatastorenameContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Context context = Context.newBuilder().build(); + String contextId = "contextId-406810838"; + Context response = metadataServiceClient.createContext(parent, context, contextId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateContext_MetadatastorenameContextString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextStringContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextStringContextString.java new file mode 100644 index 000000000000..2787e5a5e613 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createcontext/SyncCreateContextStringContextString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateContext_StringContextString_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateContextStringContextString { + + public static void main(String[] args) throws Exception { + syncCreateContextStringContextString(); + } + + public static void syncCreateContextStringContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Context context = Context.newBuilder().build(); + String contextId = "contextId-406810838"; + Context response = metadataServiceClient.createContext(parent, context, contextId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateContext_StringContextString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/AsyncCreateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/AsyncCreateExecution.java new file mode 100644 index 000000000000..310196945c74 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/AsyncCreateExecution.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncCreateExecution { + + public static void main(String[] args) throws Exception { + asyncCreateExecution(); + } + + public static void asyncCreateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateExecutionRequest request = + CreateExecutionRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setExecution(Execution.newBuilder().build()) + .setExecutionId("executionId-454906285") + .build(); + ApiFuture future = + metadataServiceClient.createExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecution.java new file mode 100644 index 000000000000..677ba3c7045f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecution.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateExecution_sync] +import com.google.cloud.aiplatform.v1beta1.CreateExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateExecution { + + public static void main(String[] args) throws Exception { + syncCreateExecution(); + } + + public static void syncCreateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateExecutionRequest request = + CreateExecutionRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setExecution(Execution.newBuilder().build()) + .setExecutionId("executionId-454906285") + .build(); + Execution response = metadataServiceClient.createExecution(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java new file mode 100644 index 000000000000..7c784f2ffbac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionMetadatastorenameExecutionString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateExecution_MetadatastorenameExecutionString_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateExecutionMetadatastorenameExecutionString { + + public static void main(String[] args) throws Exception { + syncCreateExecutionMetadatastorenameExecutionString(); + } + + public static void syncCreateExecutionMetadatastorenameExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + Execution execution = Execution.newBuilder().build(); + String executionId = "executionId-454906285"; + Execution response = metadataServiceClient.createExecution(parent, execution, executionId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateExecution_MetadatastorenameExecutionString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java new file mode 100644 index 000000000000..be4f17da6d70 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createexecution/SyncCreateExecutionStringExecutionString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateExecution_StringExecutionString_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateExecutionStringExecutionString { + + public static void main(String[] args) throws Exception { + syncCreateExecutionStringExecutionString(); + } + + public static void syncCreateExecutionStringExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + Execution execution = Execution.newBuilder().build(); + String executionId = "executionId-454906285"; + Execution response = metadataServiceClient.createExecution(parent, execution, executionId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateExecution_StringExecutionString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java new file mode 100644 index 000000000000..0bc23bb9fa55 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/AsyncCreateMetadataSchema.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncCreateMetadataSchema { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataSchema(); + } + + public static void asyncCreateMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataSchemaRequest request = + CreateMetadataSchemaRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setMetadataSchema(MetadataSchema.newBuilder().build()) + .setMetadataSchemaId("metadataSchemaId1549245163") + .build(); + ApiFuture future = + metadataServiceClient.createMetadataSchemaCallable().futureCall(request); + // Do something. + MetadataSchema response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java new file mode 100644 index 000000000000..7ee91a45db0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchema.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_sync] +import com.google.cloud.aiplatform.v1beta1.CreateMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateMetadataSchema { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchema(); + } + + public static void syncCreateMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataSchemaRequest request = + CreateMetadataSchemaRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setMetadataSchema(MetadataSchema.newBuilder().build()) + .setMetadataSchemaId("metadataSchemaId1549245163") + .build(); + MetadataSchema response = metadataServiceClient.createMetadataSchema(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java new file mode 100644 index 000000000000..f5968c11b755 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_MetadatastorenameMetadataschemaString_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateMetadataSchemaMetadatastorenameMetadataschemaString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchemaMetadatastorenameMetadataschemaString(); + } + + public static void syncCreateMetadataSchemaMetadatastorenameMetadataschemaString() + throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + MetadataSchema metadataSchema = MetadataSchema.newBuilder().build(); + String metadataSchemaId = "metadataSchemaId1549245163"; + MetadataSchema response = + metadataServiceClient.createMetadataSchema(parent, metadataSchema, metadataSchemaId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_MetadatastorenameMetadataschemaString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java new file mode 100644 index 000000000000..bc39db2584be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadataschema/SyncCreateMetadataSchemaStringMetadataschemaString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_StringMetadataschemaString_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncCreateMetadataSchemaStringMetadataschemaString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataSchemaStringMetadataschemaString(); + } + + public static void syncCreateMetadataSchemaStringMetadataschemaString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + MetadataSchema metadataSchema = MetadataSchema.newBuilder().build(); + String metadataSchemaId = "metadataSchemaId1549245163"; + MetadataSchema response = + metadataServiceClient.createMetadataSchema(parent, metadataSchema, metadataSchemaId); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataSchema_StringMetadataschemaString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java new file mode 100644 index 000000000000..ed95b86637fc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStore.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.longrunning.Operation; + +public class AsyncCreateMetadataStore { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataStore(); + } + + public static void asyncCreateMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + ApiFuture future = + metadataServiceClient.createMetadataStoreCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java new file mode 100644 index 000000000000..37d60baf69b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/AsyncCreateMetadataStoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateMetadataStoreOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class AsyncCreateMetadataStoreLRO { + + public static void main(String[] args) throws Exception { + asyncCreateMetadataStoreLRO(); + } + + public static void asyncCreateMetadataStoreLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + OperationFuture future = + metadataServiceClient.createMetadataStoreOperationCallable().futureCall(request); + // Do something. + MetadataStore response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java new file mode 100644 index 000000000000..a651686fee53 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_sync] +import com.google.cloud.aiplatform.v1beta1.CreateMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncCreateMetadataStore { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStore(); + } + + public static void syncCreateMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + CreateMetadataStoreRequest request = + CreateMetadataStoreRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setMetadataStore(MetadataStore.newBuilder().build()) + .setMetadataStoreId("metadataStoreId-1811789907") + .build(); + MetadataStore response = metadataServiceClient.createMetadataStoreAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java new file mode 100644 index 000000000000..d6e7f7606383 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreLocationnameMetadatastoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_LocationnameMetadatastoreString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncCreateMetadataStoreLocationnameMetadatastoreString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStoreLocationnameMetadatastoreString(); + } + + public static void syncCreateMetadataStoreLocationnameMetadatastoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + MetadataStore metadataStore = MetadataStore.newBuilder().build(); + String metadataStoreId = "metadataStoreId-1811789907"; + MetadataStore response = + metadataServiceClient + .createMetadataStoreAsync(parent, metadataStore, metadataStoreId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_LocationnameMetadatastoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java new file mode 100644 index 000000000000..e54ffd13ed16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/createmetadatastore/SyncCreateMetadataStoreStringMetadatastoreString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_StringMetadatastoreString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncCreateMetadataStoreStringMetadatastoreString { + + public static void main(String[] args) throws Exception { + syncCreateMetadataStoreStringMetadatastoreString(); + } + + public static void syncCreateMetadataStoreStringMetadatastoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + MetadataStore metadataStore = MetadataStore.newBuilder().build(); + String metadataStoreId = "metadataStoreId-1811789907"; + MetadataStore response = + metadataServiceClient + .createMetadataStoreAsync(parent, metadataStore, metadataStoreId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_CreateMetadataStore_StringMetadatastoreString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifact.java new file mode 100644 index 000000000000..dc68b1c9538f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifact.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteArtifact { + + public static void main(String[] args) throws Exception { + asyncDeleteArtifact(); + } + + public static void asyncDeleteArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteArtifactCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java new file mode 100644 index 000000000000..82649101ec73 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/AsyncDeleteArtifactLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteArtifactLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteArtifactLRO(); + } + + public static void asyncDeleteArtifactLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteArtifactOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifact.java new file mode 100644 index 000000000000..f5773d472367 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifact.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.DeleteArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifact { + + public static void main(String[] args) throws Exception { + syncDeleteArtifact(); + } + + public static void syncDeleteArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteArtifactRequest request = + DeleteArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteArtifactAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java new file mode 100644 index 000000000000..56788ff09246 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_Artifactname_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifactArtifactname { + + public static void main(String[] args) throws Exception { + syncDeleteArtifactArtifactname(); + } + + public static void syncDeleteArtifactArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + metadataServiceClient.deleteArtifactAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactString.java new file mode 100644 index 000000000000..cb1ff27d4312 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteartifact/SyncDeleteArtifactString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_String_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteArtifactString { + + public static void main(String[] args) throws Exception { + syncDeleteArtifactString(); + } + + public static void syncDeleteArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + metadataServiceClient.deleteArtifactAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteArtifact_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContext.java new file mode 100644 index 000000000000..54e107ccaa77 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContext.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteContext { + + public static void main(String[] args) throws Exception { + asyncDeleteContext(); + } + + public static void asyncDeleteContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteContextCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContextLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContextLRO.java new file mode 100644 index 000000000000..63dfe6d7a7f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/AsyncDeleteContextLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteContext_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteContextLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteContextLRO(); + } + + public static void asyncDeleteContextLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteContextOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteContext_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContext.java new file mode 100644 index 000000000000..1cc827ef0743 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContext.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteContext_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.DeleteContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContext { + + public static void main(String[] args) throws Exception { + syncDeleteContext(); + } + + public static void syncDeleteContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteContextRequest request = + DeleteContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .setForce(true) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteContextAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextContextname.java new file mode 100644 index 000000000000..92d7b9f717ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextContextname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteContext_Contextname_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContextContextname { + + public static void main(String[] args) throws Exception { + syncDeleteContextContextname(); + } + + public static void syncDeleteContextContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName name = ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + metadataServiceClient.deleteContextAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteContext_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextString.java new file mode 100644 index 000000000000..3145336a695a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletecontext/SyncDeleteContextString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteContext_String_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteContextString { + + public static void main(String[] args) throws Exception { + syncDeleteContextString(); + } + + public static void syncDeleteContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + metadataServiceClient.deleteContextAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteContext_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecution.java new file mode 100644 index 000000000000..1a02a81a0d25 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecution.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteExecution { + + public static void main(String[] args) throws Exception { + asyncDeleteExecution(); + } + + public static void asyncDeleteExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + ApiFuture future = + metadataServiceClient.deleteExecutionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java new file mode 100644 index 000000000000..84686b10cd6e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/AsyncDeleteExecutionLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteExecution_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteExecutionLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteExecutionLRO(); + } + + public static void asyncDeleteExecutionLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + OperationFuture future = + metadataServiceClient.deleteExecutionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteExecution_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecution.java new file mode 100644 index 000000000000..83ac2a5d24cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecution.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteExecution_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecution { + + public static void main(String[] args) throws Exception { + syncDeleteExecution(); + } + + public static void syncDeleteExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .setEtag("etag3123477") + .build(); + metadataServiceClient.deleteExecutionAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java new file mode 100644 index 000000000000..95ec3e1817f9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteExecution_Executionname_sync] +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionExecutionname(); + } + + public static void syncDeleteExecutionExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + metadataServiceClient.deleteExecutionAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteExecution_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionString.java new file mode 100644 index 000000000000..83effd6e0309 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deleteexecution/SyncDeleteExecutionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteExecution_String_sync] +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteExecutionString { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionString(); + } + + public static void syncDeleteExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + metadataServiceClient.deleteExecutionAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteExecution_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java new file mode 100644 index 000000000000..1ad2afcf426c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStore.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.longrunning.Operation; + +public class AsyncDeleteMetadataStore { + + public static void main(String[] args) throws Exception { + asyncDeleteMetadataStore(); + } + + public static void asyncDeleteMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.deleteMetadataStoreCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java new file mode 100644 index 000000000000..249f9fecc1f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/AsyncDeleteMetadataStoreLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteMetadataStoreOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class AsyncDeleteMetadataStoreLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteMetadataStoreLRO(); + } + + public static void asyncDeleteMetadataStoreLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.deleteMetadataStoreOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java new file mode 100644 index 000000000000..6edeb90cc086 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStore.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStore { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStore(); + } + + public static void syncDeleteMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + DeleteMetadataStoreRequest request = + DeleteMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setForce(true) + .build(); + metadataServiceClient.deleteMetadataStoreAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java new file mode 100644 index 000000000000..5aaafb4c123f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreMetadatastorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStoreMetadatastorename { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStoreMetadatastorename(); + } + + public static void syncDeleteMetadataStoreMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + metadataServiceClient.deleteMetadataStoreAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java new file mode 100644 index 000000000000..0a83f1ae6197 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/deletemetadatastore/SyncDeleteMetadataStoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.protobuf.Empty; + +public class SyncDeleteMetadataStoreString { + + public static void main(String[] args) throws Exception { + syncDeleteMetadataStoreString(); + } + + public static void syncDeleteMetadataStoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + metadataServiceClient.deleteMetadataStoreAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_DeleteMetadataStore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/AsyncGetArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/AsyncGetArtifact.java new file mode 100644 index 000000000000..01ed02aa8a0e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/AsyncGetArtifact.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.GetArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class AsyncGetArtifact { + + public static void main(String[] args) throws Exception { + asyncGetArtifact(); + } + + public static void asyncGetArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetArtifactRequest request = + GetArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .build(); + ApiFuture future = metadataServiceClient.getArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifact.java new file mode 100644 index 000000000000..28ad2fe8deca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifact.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetArtifact_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.GetArtifactRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetArtifact { + + public static void main(String[] args) throws Exception { + syncGetArtifact(); + } + + public static void syncGetArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetArtifactRequest request = + GetArtifactRequest.newBuilder() + .setName( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .build(); + Artifact response = metadataServiceClient.getArtifact(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactArtifactname.java new file mode 100644 index 000000000000..aa4b7db1e6ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetArtifact_Artifactname_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetArtifactArtifactname { + + public static void main(String[] args) throws Exception { + syncGetArtifactArtifactname(); + } + + public static void syncGetArtifactArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + Artifact response = metadataServiceClient.getArtifact(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetArtifact_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactString.java new file mode 100644 index 000000000000..1aaf9d746da9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getartifact/SyncGetArtifactString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetArtifact_String_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetArtifactString { + + public static void main(String[] args) throws Exception { + syncGetArtifactString(); + } + + public static void syncGetArtifactString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + Artifact response = metadataServiceClient.getArtifact(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetArtifact_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/AsyncGetContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/AsyncGetContext.java new file mode 100644 index 000000000000..499d78b1b2ba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/AsyncGetContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.GetContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class AsyncGetContext { + + public static void main(String[] args) throws Exception { + asyncGetContext(); + } + + public static void asyncGetContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetContextRequest request = + GetContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + ApiFuture future = metadataServiceClient.getContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContext.java new file mode 100644 index 000000000000..2c060b300409 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContext.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetContext_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.GetContextRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetContext { + + public static void main(String[] args) throws Exception { + syncGetContext(); + } + + public static void syncGetContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetContextRequest request = + GetContextRequest.newBuilder() + .setName( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + Context response = metadataServiceClient.getContext(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextContextname.java new file mode 100644 index 000000000000..139c6c53eb5e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextContextname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetContext_Contextname_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetContextContextname { + + public static void main(String[] args) throws Exception { + syncGetContextContextname(); + } + + public static void syncGetContextContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName name = ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + Context response = metadataServiceClient.getContext(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetContext_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextString.java new file mode 100644 index 000000000000..7ea71a31ff75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getcontext/SyncGetContextString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetContext_String_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetContextString { + + public static void main(String[] args) throws Exception { + syncGetContextString(); + } + + public static void syncGetContextString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + Context response = metadataServiceClient.getContext(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetContext_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/AsyncGetExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/AsyncGetExecution.java new file mode 100644 index 000000000000..d4d9a11ceb29 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/AsyncGetExecution.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.GetExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class AsyncGetExecution { + + public static void main(String[] args) throws Exception { + asyncGetExecution(); + } + + public static void asyncGetExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.getExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecution.java new file mode 100644 index 000000000000..dc986e3a890b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecution.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetExecution_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.GetExecutionRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetExecution { + + public static void main(String[] args) throws Exception { + syncGetExecution(); + } + + public static void syncGetExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + Execution response = metadataServiceClient.getExecution(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionExecutionname.java new file mode 100644 index 000000000000..6833f6c264bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetExecution_Executionname_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncGetExecutionExecutionname(); + } + + public static void syncGetExecutionExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + Execution response = metadataServiceClient.getExecution(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetExecution_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionString.java new file mode 100644 index 000000000000..cf23e31083f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getexecution/SyncGetExecutionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetExecution_String_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetExecutionString { + + public static void main(String[] args) throws Exception { + syncGetExecutionString(); + } + + public static void syncGetExecutionString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + Execution response = metadataServiceClient.getExecution(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetExecution_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..bc62102e6233 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = metadataServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..570b3a4cecb5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = metadataServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..9dda35d73628 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = metadataServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..fbc7e0a7c3f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = metadataServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java new file mode 100644 index 000000000000..90d1e4366978 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/AsyncGetMetadataSchema.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class AsyncGetMetadataSchema { + + public static void main(String[] args) throws Exception { + asyncGetMetadataSchema(); + } + + public static void asyncGetMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataSchemaRequest request = + GetMetadataSchemaRequest.newBuilder() + .setName( + MetadataSchemaName.of( + "[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.getMetadataSchemaCallable().futureCall(request); + // Do something. + MetadataSchema response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java new file mode 100644 index 000000000000..80ff884d8337 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchema.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_sync] +import com.google.cloud.aiplatform.v1beta1.GetMetadataSchemaRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetMetadataSchema { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchema(); + } + + public static void syncGetMetadataSchema() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataSchemaRequest request = + GetMetadataSchemaRequest.newBuilder() + .setName( + MetadataSchemaName.of( + "[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString()) + .build(); + MetadataSchema response = metadataServiceClient.getMetadataSchema(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java new file mode 100644 index 000000000000..0bf1364f692e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaMetadataschemaname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_Metadataschemaname_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetMetadataSchemaMetadataschemaname { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchemaMetadataschemaname(); + } + + public static void syncGetMetadataSchemaMetadataschemaname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataSchemaName name = + MetadataSchemaName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]"); + MetadataSchema response = metadataServiceClient.getMetadataSchema(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_Metadataschemaname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java new file mode 100644 index 000000000000..15566809fce0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadataschema/SyncGetMetadataSchemaString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataSchemaName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncGetMetadataSchemaString { + + public static void main(String[] args) throws Exception { + syncGetMetadataSchemaString(); + } + + public static void syncGetMetadataSchemaString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = + MetadataSchemaName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[METADATA_SCHEMA]") + .toString(); + MetadataSchema response = metadataServiceClient.getMetadataSchema(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataSchema_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java new file mode 100644 index 000000000000..7d1250177c62 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/AsyncGetMetadataStore.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + asyncGetMetadataStore(); + } + + public static void asyncGetMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataStoreRequest request = + GetMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .build(); + ApiFuture future = + metadataServiceClient.getMetadataStoreCallable().futureCall(request); + // Do something. + MetadataStore response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..3adfc5af52f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1beta1.GetMetadataStoreRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + GetMetadataStoreRequest request = + GetMetadataStoreRequest.newBuilder() + .setName( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .build(); + MetadataStore response = metadataServiceClient.getMetadataStore(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java new file mode 100644 index 000000000000..689c5d9cfce2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreMetadatastorename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncGetMetadataStoreMetadatastorename { + + public static void main(String[] args) throws Exception { + syncGetMetadataStoreMetadatastorename(); + } + + public static void syncGetMetadataStoreMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + MetadataStore response = metadataServiceClient.getMetadataStore(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java new file mode 100644 index 000000000000..8d59304e4d83 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/getmetadatastore/SyncGetMetadataStoreString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncGetMetadataStoreString { + + public static void main(String[] args) throws Exception { + syncGetMetadataStoreString(); + } + + public static void syncGetMetadataStoreString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String name = MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + MetadataStore response = metadataServiceClient.getMetadataStore(name); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_GetMetadataStore_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifacts.java new file mode 100644 index 000000000000..41670737bd3f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifacts.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListArtifacts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncListArtifacts { + + public static void main(String[] args) throws Exception { + asyncListArtifacts(); + } + + public static void asyncListArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listArtifactsPagedCallable().futureCall(request); + // Do something. + for (Artifact element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListArtifacts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifactsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifactsPaged.java new file mode 100644 index 000000000000..1fd2e7a5c561 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/AsyncListArtifactsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListArtifacts_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1beta1.ListArtifactsResponse; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListArtifactsPaged { + + public static void main(String[] args) throws Exception { + asyncListArtifactsPaged(); + } + + public static void asyncListArtifactsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListArtifactsResponse response = + metadataServiceClient.listArtifactsCallable().call(request); + for (Artifact element : response.getArtifactsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListArtifacts_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifacts.java new file mode 100644 index 000000000000..b914d3ee09da --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifacts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListArtifacts_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.ListArtifactsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListArtifacts { + + public static void main(String[] args) throws Exception { + syncListArtifacts(); + } + + public static void syncListArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListArtifactsRequest request = + ListArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Artifact element : metadataServiceClient.listArtifacts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListArtifacts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java new file mode 100644 index 000000000000..50ecf354cc88 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListArtifacts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListArtifactsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListArtifactsMetadatastorename(); + } + + public static void syncListArtifactsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Artifact element : metadataServiceClient.listArtifacts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListArtifacts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsString.java new file mode 100644 index 000000000000..fa1a767658bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listartifacts/SyncListArtifactsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListArtifacts_String_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListArtifactsString { + + public static void main(String[] args) throws Exception { + syncListArtifactsString(); + } + + public static void syncListArtifactsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Artifact element : metadataServiceClient.listArtifacts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListArtifacts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContexts.java new file mode 100644 index 000000000000..bce5ee80b6fe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContexts.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListContexts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ListContextsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncListContexts { + + public static void main(String[] args) throws Exception { + asyncListContexts(); + } + + public static void asyncListContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listContextsPagedCallable().futureCall(request); + // Do something. + for (Context element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListContexts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContextsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContextsPaged.java new file mode 100644 index 000000000000..6313a391da31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/AsyncListContextsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListContexts_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ListContextsRequest; +import com.google.cloud.aiplatform.v1beta1.ListContextsResponse; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListContextsPaged { + + public static void main(String[] args) throws Exception { + asyncListContextsPaged(); + } + + public static void asyncListContextsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListContextsResponse response = metadataServiceClient.listContextsCallable().call(request); + for (Context element : response.getContextsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListContexts_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContexts.java new file mode 100644 index 000000000000..76db35ae70ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContexts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListContexts_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.ListContextsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListContexts { + + public static void main(String[] args) throws Exception { + syncListContexts(); + } + + public static void syncListContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListContextsRequest request = + ListContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Context element : metadataServiceClient.listContexts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListContexts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java new file mode 100644 index 000000000000..0181daab30f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListContexts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListContextsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListContextsMetadatastorename(); + } + + public static void syncListContextsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Context element : metadataServiceClient.listContexts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListContexts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsString.java new file mode 100644 index 000000000000..0d24c819391c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listcontexts/SyncListContextsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListContexts_String_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListContextsString { + + public static void main(String[] args) throws Exception { + syncListContextsString(); + } + + public static void syncListContextsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Context element : metadataServiceClient.listContexts(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListContexts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutions.java new file mode 100644 index 000000000000..68164bbf3d5f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutions.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncListExecutions { + + public static void main(String[] args) throws Exception { + asyncListExecutions(); + } + + public static void asyncListExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + metadataServiceClient.listExecutionsPagedCallable().futureCall(request); + // Do something. + for (Execution element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutionsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutionsPaged.java new file mode 100644 index 000000000000..2427350814c2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/AsyncListExecutionsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListExecutions_Paged_async] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.ListExecutionsResponse; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListExecutionsPaged { + + public static void main(String[] args) throws Exception { + asyncListExecutionsPaged(); + } + + public static void asyncListExecutionsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListExecutionsResponse response = + metadataServiceClient.listExecutionsCallable().call(request); + for (Execution element : response.getExecutionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListExecutions_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutions.java new file mode 100644 index 000000000000..6dafa06212ae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListExecutions_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.ListExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListExecutions { + + public static void main(String[] args) throws Exception { + syncListExecutions(); + } + + public static void syncListExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Execution element : metadataServiceClient.listExecutions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java new file mode 100644 index 000000000000..0b6e081d0adf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsMetadatastorename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListExecutions_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListExecutionsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListExecutionsMetadatastorename(); + } + + public static void syncListExecutionsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (Execution element : metadataServiceClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListExecutions_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsString.java new file mode 100644 index 000000000000..cb18b6fb5f30 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listexecutions/SyncListExecutionsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListExecutions_String_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListExecutionsString { + + public static void main(String[] args) throws Exception { + syncListExecutionsString(); + } + + public static void syncListExecutionsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (Execution element : metadataServiceClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListExecutions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..a473bdfb038e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + metadataServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..2717162090c2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + metadataServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..37a0c1945c8c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : metadataServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java new file mode 100644 index 000000000000..4f189ac2a654 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemas.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class AsyncListMetadataSchemas { + + public static void main(String[] args) throws Exception { + asyncListMetadataSchemas(); + } + + public static void asyncListMetadataSchemas() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + metadataServiceClient.listMetadataSchemasPagedCallable().futureCall(request); + // Do something. + for (MetadataSchema element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java new file mode 100644 index 000000000000..47d96a3c30ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/AsyncListMetadataSchemasPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1beta1.ListMetadataSchemasResponse; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.common.base.Strings; + +public class AsyncListMetadataSchemasPaged { + + public static void main(String[] args) throws Exception { + asyncListMetadataSchemasPaged(); + } + + public static void asyncListMetadataSchemasPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListMetadataSchemasResponse response = + metadataServiceClient.listMetadataSchemasCallable().call(request); + for (MetadataSchema element : response.getMetadataSchemasList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java new file mode 100644 index 000000000000..adcb872400d4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemas.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_sync] +import com.google.cloud.aiplatform.v1beta1.ListMetadataSchemasRequest; +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListMetadataSchemas { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemas(); + } + + public static void syncListMetadataSchemas() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataSchemasRequest request = + ListMetadataSchemasRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java new file mode 100644 index 000000000000..86d6eb95573e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasMetadatastorename.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListMetadataSchemasMetadatastorename { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemasMetadatastorename(); + } + + public static void syncListMetadataSchemasMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java new file mode 100644 index 000000000000..00ee57bddc09 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadataschemas/SyncListMetadataSchemasString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataSchema; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; + +public class SyncListMetadataSchemasString { + + public static void main(String[] args) throws Exception { + syncListMetadataSchemasString(); + } + + public static void syncListMetadataSchemasString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + for (MetadataSchema element : + metadataServiceClient.listMetadataSchemas(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataSchemas_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStores.java new file mode 100644 index 000000000000..040336f47c42 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStores.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class AsyncListMetadataStores { + + public static void main(String[] args) throws Exception { + asyncListMetadataStores(); + } + + public static void asyncListMetadataStores() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + metadataServiceClient.listMetadataStoresPagedCallable().futureCall(request); + // Do something. + for (MetadataStore element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java new file mode 100644 index 000000000000..a7dd2b1762e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/AsyncListMetadataStoresPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1beta1.ListMetadataStoresResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; +import com.google.common.base.Strings; + +public class AsyncListMetadataStoresPaged { + + public static void main(String[] args) throws Exception { + asyncListMetadataStoresPaged(); + } + + public static void asyncListMetadataStoresPaged() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListMetadataStoresResponse response = + metadataServiceClient.listMetadataStoresCallable().call(request); + for (MetadataStore element : response.getMetadataStoresList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStores.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStores.java new file mode 100644 index 000000000000..505f01f4f529 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStores.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_sync] +import com.google.cloud.aiplatform.v1beta1.ListMetadataStoresRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncListMetadataStores { + + public static void main(String[] args) throws Exception { + syncListMetadataStores(); + } + + public static void syncListMetadataStores() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ListMetadataStoresRequest request = + ListMetadataStoresRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (MetadataStore element : metadataServiceClient.listMetadataStores(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java new file mode 100644 index 000000000000..5bd6fb911fd9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncListMetadataStoresLocationname { + + public static void main(String[] args) throws Exception { + syncListMetadataStoresLocationname(); + } + + public static void syncListMetadataStoresLocationname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (MetadataStore element : metadataServiceClient.listMetadataStores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java new file mode 100644 index 000000000000..dd155aa9151a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/listmetadatastores/SyncListMetadataStoresString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStore; + +public class SyncListMetadataStoresString { + + public static void main(String[] args) throws Exception { + syncListMetadataStoresString(); + } + + public static void syncListMetadataStoresString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (MetadataStore element : metadataServiceClient.listMetadataStores(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_ListMetadataStores_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java new file mode 100644 index 000000000000..2d8914bbc5eb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifacts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeArtifacts { + + public static void main(String[] args) throws Exception { + asyncPurgeArtifacts(); + } + + public static void asyncPurgeArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeArtifactsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java new file mode 100644 index 000000000000..d564a9f8d7b8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/AsyncPurgeArtifactsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsMetadata; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsResponse; + +public class AsyncPurgeArtifactsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeArtifactsLRO(); + } + + public static void asyncPurgeArtifactsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeArtifactsOperationCallable().futureCall(request); + // Do something. + PurgeArtifactsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java new file mode 100644 index 000000000000..5cb392698403 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifacts.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsResponse; + +public class SyncPurgeArtifacts { + + public static void main(String[] args) throws Exception { + syncPurgeArtifacts(); + } + + public static void syncPurgeArtifacts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeArtifactsRequest request = + PurgeArtifactsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java new file mode 100644 index 000000000000..e6609db949b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsResponse; + +public class SyncPurgeArtifactsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeArtifactsMetadatastorename(); + } + + public static void syncPurgeArtifactsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java new file mode 100644 index 000000000000..68f5ad241bb8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeartifacts/SyncPurgeArtifactsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeArtifactsResponse; + +public class SyncPurgeArtifactsString { + + public static void main(String[] args) throws Exception { + syncPurgeArtifactsString(); + } + + public static void syncPurgeArtifactsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeArtifactsResponse response = metadataServiceClient.purgeArtifactsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeArtifacts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContexts.java new file mode 100644 index 000000000000..12d6164727cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContexts.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeContexts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeContexts { + + public static void main(String[] args) throws Exception { + asyncPurgeContexts(); + } + + public static void asyncPurgeContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeContextsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeContexts_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java new file mode 100644 index 000000000000..cc11c7af04e1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/AsyncPurgeContextsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeContexts_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsMetadata; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsResponse; + +public class AsyncPurgeContextsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeContextsLRO(); + } + + public static void asyncPurgeContextsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeContextsOperationCallable().futureCall(request); + // Do something. + PurgeContextsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeContexts_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContexts.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContexts.java new file mode 100644 index 000000000000..d988ef300027 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContexts.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeContexts_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsResponse; + +public class SyncPurgeContexts { + + public static void main(String[] args) throws Exception { + syncPurgeContexts(); + } + + public static void syncPurgeContexts() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeContextsRequest request = + PurgeContextsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeContexts_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java new file mode 100644 index 000000000000..0ef4db56aa0c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeContexts_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsResponse; + +public class SyncPurgeContextsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeContextsMetadatastorename(); + } + + public static void syncPurgeContextsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeContexts_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsString.java new file mode 100644 index 000000000000..324e572eabd3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgecontexts/SyncPurgeContextsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeContexts_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeContextsResponse; + +public class SyncPurgeContextsString { + + public static void main(String[] args) throws Exception { + syncPurgeContextsString(); + } + + public static void syncPurgeContextsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeContextsResponse response = metadataServiceClient.purgeContextsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeContexts_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java new file mode 100644 index 000000000000..d961e6277e94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsRequest; +import com.google.longrunning.Operation; + +public class AsyncPurgeExecutions { + + public static void main(String[] args) throws Exception { + asyncPurgeExecutions(); + } + + public static void asyncPurgeExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + ApiFuture future = + metadataServiceClient.purgeExecutionsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java new file mode 100644 index 000000000000..2f0802ff0e9f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/AsyncPurgeExecutionsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsMetadata; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsResponse; + +public class AsyncPurgeExecutionsLRO { + + public static void main(String[] args) throws Exception { + asyncPurgeExecutionsLRO(); + } + + public static void asyncPurgeExecutionsLRO() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + OperationFuture future = + metadataServiceClient.purgeExecutionsOperationCallable().futureCall(request); + // Do something. + PurgeExecutionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutions.java new file mode 100644 index 000000000000..db29fb3c160a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutions.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsRequest; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsResponse; + +public class SyncPurgeExecutions { + + public static void main(String[] args) throws Exception { + syncPurgeExecutions(); + } + + public static void syncPurgeExecutions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + PurgeExecutionsRequest request = + PurgeExecutionsRequest.newBuilder() + .setParent( + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString()) + .setFilter("filter-1274492040") + .setForce(true) + .build(); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java new file mode 100644 index 000000000000..5194ab7add15 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsMetadatastorename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_Metadatastorename_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsResponse; + +public class SyncPurgeExecutionsMetadatastorename { + + public static void main(String[] args) throws Exception { + syncPurgeExecutionsMetadatastorename(); + } + + public static void syncPurgeExecutionsMetadatastorename() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + MetadataStoreName parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]"); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_Metadatastorename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java new file mode 100644 index 000000000000..0e882bfffeca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/purgeexecutions/SyncPurgeExecutionsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_String_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.MetadataStoreName; +import com.google.cloud.aiplatform.v1beta1.PurgeExecutionsResponse; + +public class SyncPurgeExecutionsString { + + public static void main(String[] args) throws Exception { + syncPurgeExecutionsString(); + } + + public static void syncPurgeExecutionsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String parent = + MetadataStoreName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]").toString(); + PurgeExecutionsResponse response = metadataServiceClient.purgeExecutionsAsync(parent).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_PurgeExecutions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java new file mode 100644 index 000000000000..34cd0270ab72 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/AsyncQueryArtifactLineageSubgraph.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryArtifactLineageSubgraphRequest; + +public class AsyncQueryArtifactLineageSubgraph { + + public static void main(String[] args) throws Exception { + asyncQueryArtifactLineageSubgraph(); + } + + public static void asyncQueryArtifactLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryArtifactLineageSubgraphRequest request = + QueryArtifactLineageSubgraphRequest.newBuilder() + .setArtifact( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setMaxHops(407750469) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + metadataServiceClient.queryArtifactLineageSubgraphCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java new file mode 100644 index 000000000000..ae0fbb0f8d8b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraph.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryArtifactLineageSubgraphRequest; + +public class SyncQueryArtifactLineageSubgraph { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraph(); + } + + public static void syncQueryArtifactLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryArtifactLineageSubgraphRequest request = + QueryArtifactLineageSubgraphRequest.newBuilder() + .setArtifact( + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]") + .toString()) + .setMaxHops(407750469) + .setFilter("filter-1274492040") + .build(); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java new file mode 100644 index 000000000000..ced7f6512f78 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphArtifactname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_Artifactname_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryArtifactLineageSubgraphArtifactname { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraphArtifactname(); + } + + public static void syncQueryArtifactLineageSubgraphArtifactname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ArtifactName artifact = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]"); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(artifact); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_Artifactname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java new file mode 100644 index 000000000000..33267d86a03c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryartifactlineagesubgraph/SyncQueryArtifactLineageSubgraphString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_String_sync] +import com.google.cloud.aiplatform.v1beta1.ArtifactName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryArtifactLineageSubgraphString { + + public static void main(String[] args) throws Exception { + syncQueryArtifactLineageSubgraphString(); + } + + public static void syncQueryArtifactLineageSubgraphString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String artifact = + ArtifactName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[ARTIFACT]").toString(); + LineageSubgraph response = metadataServiceClient.queryArtifactLineageSubgraph(artifact); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryArtifactLineageSubgraph_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java new file mode 100644 index 000000000000..c8cd95f5e46f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/AsyncQueryContextLineageSubgraph.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryContextLineageSubgraphRequest; + +public class AsyncQueryContextLineageSubgraph { + + public static void main(String[] args) throws Exception { + asyncQueryContextLineageSubgraph(); + } + + public static void asyncQueryContextLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryContextLineageSubgraphRequest request = + QueryContextLineageSubgraphRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.queryContextLineageSubgraphCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java new file mode 100644 index 000000000000..93323b35ef31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraph.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryContextLineageSubgraphRequest; + +public class SyncQueryContextLineageSubgraph { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraph(); + } + + public static void syncQueryContextLineageSubgraph() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryContextLineageSubgraphRequest request = + QueryContextLineageSubgraphRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .build(); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java new file mode 100644 index 000000000000..0266d1d162fa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphContextname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_Contextname_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryContextLineageSubgraphContextname { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraphContextname(); + } + + public static void syncQueryContextLineageSubgraphContextname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(context); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_Contextname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java new file mode 100644 index 000000000000..2e59608892fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/querycontextlineagesubgraph/SyncQueryContextLineageSubgraphString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_String_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryContextLineageSubgraphString { + + public static void main(String[] args) throws Exception { + syncQueryContextLineageSubgraphString(); + } + + public static void syncQueryContextLineageSubgraphString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + LineageSubgraph response = metadataServiceClient.queryContextLineageSubgraph(context); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryContextLineageSubgraph_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java new file mode 100644 index 000000000000..00244ac5ab12 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/AsyncQueryExecutionInputsAndOutputs.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryExecutionInputsAndOutputsRequest; + +public class AsyncQueryExecutionInputsAndOutputs { + + public static void main(String[] args) throws Exception { + asyncQueryExecutionInputsAndOutputs(); + } + + public static void asyncQueryExecutionInputsAndOutputs() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryExecutionInputsAndOutputsRequest request = + QueryExecutionInputsAndOutputsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + ApiFuture future = + metadataServiceClient.queryExecutionInputsAndOutputsCallable().futureCall(request); + // Do something. + LineageSubgraph response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java new file mode 100644 index 000000000000..6ef2290b2a3d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputs.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.QueryExecutionInputsAndOutputsRequest; + +public class SyncQueryExecutionInputsAndOutputs { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputs(); + } + + public static void syncQueryExecutionInputsAndOutputs() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + QueryExecutionInputsAndOutputsRequest request = + QueryExecutionInputsAndOutputsRequest.newBuilder() + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]") + .toString()) + .build(); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java new file mode 100644 index 000000000000..b694f9ca48e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsExecutionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_Executionname_sync] +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryExecutionInputsAndOutputsExecutionname { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputsExecutionname(); + } + + public static void syncQueryExecutionInputsAndOutputsExecutionname() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ExecutionName execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]"); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(execution); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_Executionname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java new file mode 100644 index 000000000000..9600921e4a7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/queryexecutioninputsandoutputs/SyncQueryExecutionInputsAndOutputsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_String_sync] +import com.google.cloud.aiplatform.v1beta1.ExecutionName; +import com.google.cloud.aiplatform.v1beta1.LineageSubgraph; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; + +public class SyncQueryExecutionInputsAndOutputsString { + + public static void main(String[] args) throws Exception { + syncQueryExecutionInputsAndOutputsString(); + } + + public static void syncQueryExecutionInputsAndOutputsString() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String execution = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[EXECUTION]").toString(); + LineageSubgraph response = metadataServiceClient.queryExecutionInputsAndOutputs(execution); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_QueryExecutionInputsAndOutputs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java new file mode 100644 index 000000000000..f48672eac2d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/AsyncRemoveContextChildren.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenRequest; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenResponse; +import java.util.ArrayList; + +public class AsyncRemoveContextChildren { + + public static void main(String[] args) throws Exception { + asyncRemoveContextChildren(); + } + + public static void asyncRemoveContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + RemoveContextChildrenRequest request = + RemoveContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.removeContextChildrenCallable().futureCall(request); + // Do something. + RemoveContextChildrenResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java new file mode 100644 index 000000000000..4ac372f33f7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildren.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenRequest; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenResponse; +import java.util.ArrayList; + +public class SyncRemoveContextChildren { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildren(); + } + + public static void syncRemoveContextChildren() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + RemoveContextChildrenRequest request = + RemoveContextChildrenRequest.newBuilder() + .setContext( + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]") + .toString()) + .addAllChildContexts(new ArrayList()) + .build(); + RemoveContextChildrenResponse response = metadataServiceClient.removeContextChildren(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java new file mode 100644 index 000000000000..c496039f885c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenContextnameListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_ContextnameListstring_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncRemoveContextChildrenContextnameListstring { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildrenContextnameListstring(); + } + + public static void syncRemoveContextChildrenContextnameListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + ContextName context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]"); + List childContexts = new ArrayList<>(); + RemoveContextChildrenResponse response = + metadataServiceClient.removeContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_ContextnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java new file mode 100644 index 000000000000..387bd9c5f5bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/removecontextchildren/SyncRemoveContextChildrenStringListstring.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_StringListstring_sync] +import com.google.cloud.aiplatform.v1beta1.ContextName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.RemoveContextChildrenResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncRemoveContextChildrenStringListstring { + + public static void main(String[] args) throws Exception { + syncRemoveContextChildrenStringListstring(); + } + + public static void syncRemoveContextChildrenStringListstring() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + String context = + ContextName.of("[PROJECT]", "[LOCATION]", "[METADATA_STORE]", "[CONTEXT]").toString(); + List childContexts = new ArrayList<>(); + RemoveContextChildrenResponse response = + metadataServiceClient.removeContextChildren(context, childContexts); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_RemoveContextChildren_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..46d12acd96f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = metadataServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..f377b618bb35 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = metadataServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..ba5bcf90847e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + metadataServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..0649e153767c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = metadataServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/AsyncUpdateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/AsyncUpdateArtifact.java new file mode 100644 index 000000000000..a37c0abf1333 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/AsyncUpdateArtifact.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateArtifactRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateArtifact { + + public static void main(String[] args) throws Exception { + asyncUpdateArtifact(); + } + + public static void asyncUpdateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateArtifactRequest request = + UpdateArtifactRequest.newBuilder() + .setArtifact(Artifact.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = + metadataServiceClient.updateArtifactCallable().futureCall(request); + // Do something. + Artifact response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifact.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifact.java new file mode 100644 index 000000000000..72dddcf98af2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifact.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateArtifactRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateArtifact { + + public static void main(String[] args) throws Exception { + syncUpdateArtifact(); + } + + public static void syncUpdateArtifact() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateArtifactRequest request = + UpdateArtifactRequest.newBuilder() + .setArtifact(Artifact.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Artifact response = metadataServiceClient.updateArtifact(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java new file mode 100644 index 000000000000..cdaeaf8fb02e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateartifact/SyncUpdateArtifactArtifactFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_ArtifactFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Artifact; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateArtifactArtifactFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateArtifactArtifactFieldmask(); + } + + public static void syncUpdateArtifactArtifactFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Artifact artifact = Artifact.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Artifact response = metadataServiceClient.updateArtifact(artifact, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateArtifact_ArtifactFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/AsyncUpdateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/AsyncUpdateContext.java new file mode 100644 index 000000000000..3c8ad110968e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/AsyncUpdateContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateContext_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateContextRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateContext { + + public static void main(String[] args) throws Exception { + asyncUpdateContext(); + } + + public static void asyncUpdateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateContextRequest request = + UpdateContextRequest.newBuilder() + .setContext(Context.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = metadataServiceClient.updateContextCallable().futureCall(request); + // Do something. + Context response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateContext_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContext.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContext.java new file mode 100644 index 000000000000..aa676f8ce20f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContext.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateContext_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateContextRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateContext { + + public static void main(String[] args) throws Exception { + syncUpdateContext(); + } + + public static void syncUpdateContext() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateContextRequest request = + UpdateContextRequest.newBuilder() + .setContext(Context.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Context response = metadataServiceClient.updateContext(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateContext_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java new file mode 100644 index 000000000000..d9f471132855 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updatecontext/SyncUpdateContextContextFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateContext_ContextFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Context; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateContextContextFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateContextContextFieldmask(); + } + + public static void syncUpdateContextContextFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Context context = Context.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Context response = metadataServiceClient.updateContext(context, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateContext_ContextFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/AsyncUpdateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/AsyncUpdateExecution.java new file mode 100644 index 000000000000..4ad3b6b71502 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/AsyncUpdateExecution.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExecutionRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateExecution { + + public static void main(String[] args) throws Exception { + asyncUpdateExecution(); + } + + public static void asyncUpdateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateExecutionRequest request = + UpdateExecutionRequest.newBuilder() + .setExecution(Execution.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + ApiFuture future = + metadataServiceClient.updateExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateExecution_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecution.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecution.java new file mode 100644 index 000000000000..5123a1e86978 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecution.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateExecution_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExecutionRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateExecution { + + public static void main(String[] args) throws Exception { + syncUpdateExecution(); + } + + public static void syncUpdateExecution() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + UpdateExecutionRequest request = + UpdateExecutionRequest.newBuilder() + .setExecution(Execution.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setAllowMissing(true) + .build(); + Execution response = metadataServiceClient.updateExecution(request); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateExecution_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java new file mode 100644 index 000000000000..be0113c3724a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservice/updateexecution/SyncUpdateExecutionExecutionFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataService_UpdateExecution_ExecutionFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Execution; +import com.google.cloud.aiplatform.v1beta1.MetadataServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateExecutionExecutionFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateExecutionExecutionFieldmask(); + } + + public static void syncUpdateExecutionExecutionFieldmask() throws Exception { + // 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) { + Execution execution = Execution.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Execution response = metadataServiceClient.updateExecution(execution, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_MetadataService_UpdateExecution_ExecutionFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..232d84cb94c2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/metadataservicesettings/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MetadataServiceSettings_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1beta1.MetadataServiceSettings; +import java.time.Duration; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 + MetadataServiceSettings.Builder metadataServiceSettingsBuilder = + MetadataServiceSettings.newBuilder(); + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings( + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MetadataServiceSettings metadataServiceSettings = metadataServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MetadataServiceSettings_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java new file mode 100644 index 000000000000..c027eb590a06 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResources.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchMigrateResources { + + public static void main(String[] args) throws Exception { + asyncBatchMigrateResources(); + } + + public static void asyncBatchMigrateResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + ApiFuture future = + migrationServiceClient.batchMigrateResourcesCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java new file mode 100644 index 000000000000..1bf25c3432c0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/AsyncBatchMigrateResourcesLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import java.util.ArrayList; + +public class AsyncBatchMigrateResourcesLRO { + + public static void main(String[] args) throws Exception { + asyncBatchMigrateResourcesLRO(); + } + + public static void asyncBatchMigrateResourcesLRO() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + OperationFuture + future = + migrationServiceClient.batchMigrateResourcesOperationCallable().futureCall(request); + // Do something. + BatchMigrateResourcesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java new file mode 100644 index 000000000000..0440200cc20c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResources.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_sync] +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import java.util.ArrayList; + +public class SyncBatchMigrateResources { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResources(); + } + + public static void syncBatchMigrateResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + BatchMigrateResourcesRequest request = + BatchMigrateResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllMigrateResourceRequests(new ArrayList()) + .build(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java new file mode 100644 index 000000000000..941fdc80d482 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_LocationnameListmigrateresourcerequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchMigrateResourcesLocationnameListmigrateresourcerequest { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResourcesLocationnameListmigrateresourcerequest(); + } + + public static void syncBatchMigrateResourcesLocationnameListmigrateresourcerequest() + throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + List migrateResourceRequests = new ArrayList<>(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_LocationnameListmigrateresourcerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java new file mode 100644 index 000000000000..64466938e3b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/batchmigrateresources/SyncBatchMigrateResourcesStringListmigrateresourcerequest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_StringListmigrateresourcerequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchMigrateResourcesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigrateResourceRequest; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchMigrateResourcesStringListmigrateresourcerequest { + + public static void main(String[] args) throws Exception { + syncBatchMigrateResourcesStringListmigrateresourcerequest(); + } + + public static void syncBatchMigrateResourcesStringListmigrateresourcerequest() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + List migrateResourceRequests = new ArrayList<>(); + BatchMigrateResourcesResponse response = + migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_BatchMigrateResources_StringListmigrateresourcerequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..3b397c883062 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + MigrationServiceSettings migrationServiceSettings = + MigrationServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + MigrationServiceClient migrationServiceClient = + MigrationServiceClient.create(migrationServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MigrationService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..18faf35008f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + MigrationServiceSettings migrationServiceSettings = + MigrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + MigrationServiceClient migrationServiceClient = + MigrationServiceClient.create(migrationServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_MigrationService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..068ddaf2a56a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = migrationServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..0b45250035fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = migrationServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..a5af22953ada --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = migrationServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..7c2276a2d86f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = migrationServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..06b35e8dff26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + migrationServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..1dd023a9ea1c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + migrationServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..008d6cd7b992 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : migrationServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java new file mode 100644 index 000000000000..21fb2d81cd19 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResources.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigratableResource; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1beta1.SearchMigratableResourcesRequest; + +public class AsyncSearchMigratableResources { + + public static void main(String[] args) throws Exception { + asyncSearchMigratableResources(); + } + + public static void asyncSearchMigratableResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + migrationServiceClient.searchMigratableResourcesPagedCallable().futureCall(request); + // Do something. + for (MigratableResource element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java new file mode 100644 index 000000000000..1e6b3763b272 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/AsyncSearchMigratableResourcesPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_Paged_async] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigratableResource; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1beta1.SearchMigratableResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.SearchMigratableResourcesResponse; +import com.google.common.base.Strings; + +public class AsyncSearchMigratableResourcesPaged { + + public static void main(String[] args) throws Exception { + asyncSearchMigratableResourcesPaged(); + } + + public static void asyncSearchMigratableResourcesPaged() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + SearchMigratableResourcesResponse response = + migrationServiceClient.searchMigratableResourcesCallable().call(request); + for (MigratableResource element : response.getMigratableResourcesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java new file mode 100644 index 000000000000..d665190d4dcb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResources.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigratableResource; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.cloud.aiplatform.v1beta1.SearchMigratableResourcesRequest; + +public class SyncSearchMigratableResources { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResources(); + } + + public static void syncSearchMigratableResources() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SearchMigratableResourcesRequest request = + SearchMigratableResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java new file mode 100644 index 000000000000..801f21f3e769 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigratableResource; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; + +public class SyncSearchMigratableResourcesLocationname { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResourcesLocationname(); + } + + public static void syncSearchMigratableResourcesLocationname() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java new file mode 100644 index 000000000000..fc62965407c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/searchmigratableresources/SyncSearchMigratableResourcesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.MigratableResource; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; + +public class SyncSearchMigratableResourcesString { + + public static void main(String[] args) throws Exception { + syncSearchMigratableResourcesString(); + } + + public static void syncSearchMigratableResourcesString() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (MigratableResource element : + migrationServiceClient.searchMigratableResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SearchMigratableResources_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..aa36443a9883 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = migrationServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..db05b0a24d3c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = migrationServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..5372ace47153 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + migrationServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..20ade8043d1b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.MigrationServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = migrationServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_MigrationService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservicesettings/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservicesettings/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..b22a67d9ff47 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/migrationservicesettings/getlocation/SyncGetLocation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_MigrationServiceSettings_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.MigrationServiceSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 + MigrationServiceSettings.Builder migrationServiceSettingsBuilder = + MigrationServiceSettings.newBuilder(); + migrationServiceSettingsBuilder + .getLocationSettings() + .setRetrySettings( + migrationServiceSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MigrationServiceSettings migrationServiceSettings = migrationServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MigrationServiceSettings_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..0f81355d8f54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ModelGardenServiceSettings modelGardenServiceSettings = + ModelGardenServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ModelGardenServiceClient modelGardenServiceClient = + ModelGardenServiceClient.create(modelGardenServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..ff71cd08361e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ModelGardenServiceSettings modelGardenServiceSettings = + ModelGardenServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ModelGardenServiceClient modelGardenServiceClient = + ModelGardenServiceClient.create(modelGardenServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..74a58f7a86b8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + modelGardenServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..727038c22aad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = modelGardenServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..2d9b2dc75a39 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + modelGardenServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..977ff0203bdf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = modelGardenServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java new file mode 100644 index 000000000000..ba17438b5123 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/AsyncGetPublisherModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetPublisherModelRequest; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.PublisherModel; +import com.google.cloud.aiplatform.v1beta1.PublisherModelName; +import com.google.cloud.aiplatform.v1beta1.PublisherModelView; + +public class AsyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + asyncGetPublisherModel(); + } + + public static void asyncGetPublisherModel() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetPublisherModelRequest request = + GetPublisherModelRequest.newBuilder() + .setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString()) + .setLanguageCode("languageCode-2092349083") + .setView(PublisherModelView.forNumber(0)) + .build(); + ApiFuture future = + modelGardenServiceClient.getPublisherModelCallable().futureCall(request); + // Do something. + PublisherModel response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..29d8a15b8b51 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1beta1.GetPublisherModelRequest; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.PublisherModel; +import com.google.cloud.aiplatform.v1beta1.PublisherModelName; +import com.google.cloud.aiplatform.v1beta1.PublisherModelView; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + GetPublisherModelRequest request = + GetPublisherModelRequest.newBuilder() + .setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString()) + .setLanguageCode("languageCode-2092349083") + .setView(PublisherModelView.forNumber(0)) + .build(); + PublisherModel response = modelGardenServiceClient.getPublisherModel(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java new file mode 100644 index 000000000000..95917f23b7e9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelPublishermodelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_Publishermodelname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.PublisherModel; +import com.google.cloud.aiplatform.v1beta1.PublisherModelName; + +public class SyncGetPublisherModelPublishermodelname { + + public static void main(String[] args) throws Exception { + syncGetPublisherModelPublishermodelname(); + } + + public static void syncGetPublisherModelPublishermodelname() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]"); + PublisherModel response = modelGardenServiceClient.getPublisherModel(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_Publishermodelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java new file mode 100644 index 000000000000..bfe34141c0e9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/getpublishermodel/SyncGetPublisherModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.aiplatform.v1beta1.PublisherModel; +import com.google.cloud.aiplatform.v1beta1.PublisherModelName; + +public class SyncGetPublisherModelString { + + public static void main(String[] args) throws Exception { + syncGetPublisherModelString(); + } + + public static void syncGetPublisherModelString() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + String name = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString(); + PublisherModel response = modelGardenServiceClient.getPublisherModel(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_GetPublisherModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..608f4bebcea3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + modelGardenServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..65c8dfc592c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + modelGardenServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..11427fd13aa4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : modelGardenServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..63453ab107f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelGardenServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..08b8e4d808a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = modelGardenServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..3a058b213c79 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + modelGardenServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..88d79678b2e7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = modelGardenServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelGardenService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..32ba6b3fa692 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelgardenservicesettings/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenServiceSettings_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1beta1.ModelGardenServiceSettings; +import java.time.Duration; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 + ModelGardenServiceSettings.Builder modelGardenServiceSettingsBuilder = + ModelGardenServiceSettings.newBuilder(); + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .setRetrySettings( + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelGardenServiceSettings modelGardenServiceSettings = + modelGardenServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ModelGardenServiceSettings_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java new file mode 100644 index 000000000000..a247b3a0fa09 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/AsyncBatchImportEvaluatedAnnotations.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsRequest; +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1beta1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncBatchImportEvaluatedAnnotations { + + public static void main(String[] args) throws Exception { + asyncBatchImportEvaluatedAnnotations(); + } + + public static void asyncBatchImportEvaluatedAnnotations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportEvaluatedAnnotationsRequest request = + BatchImportEvaluatedAnnotationsRequest.newBuilder() + .setParent( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .addAllEvaluatedAnnotations(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.batchImportEvaluatedAnnotationsCallable().futureCall(request); + // Do something. + BatchImportEvaluatedAnnotationsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java new file mode 100644 index 000000000000..7b3980919631 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotations.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsRequest; +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1beta1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncBatchImportEvaluatedAnnotations { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotations(); + } + + public static void syncBatchImportEvaluatedAnnotations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportEvaluatedAnnotationsRequest request = + BatchImportEvaluatedAnnotationsRequest.newBuilder() + .setParent( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .addAllEvaluatedAnnotations(new ArrayList()) + .build(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java new file mode 100644 index 000000000000..067031b26568 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_ModelevaluationslicenameListevaluatedannotation_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1beta1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation(); + } + + public static void + syncBatchImportEvaluatedAnnotationsModelevaluationslicenameListevaluatedannotation() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationSliceName parent = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); + List evaluatedAnnotations = new ArrayList<>(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_ModelevaluationslicenameListevaluatedannotation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java new file mode 100644 index 000000000000..ff41e603a62c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportevaluatedannotations/SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_StringListevaluatedannotation_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportEvaluatedAnnotationsResponse; +import com.google.cloud.aiplatform.v1beta1.EvaluatedAnnotation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportEvaluatedAnnotationsStringListevaluatedannotation { + + public static void main(String[] args) throws Exception { + syncBatchImportEvaluatedAnnotationsStringListevaluatedannotation(); + } + + public static void syncBatchImportEvaluatedAnnotationsStringListevaluatedannotation() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString(); + List evaluatedAnnotations = new ArrayList<>(); + BatchImportEvaluatedAnnotationsResponse response = + modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportEvaluatedAnnotations_StringListevaluatedannotation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java new file mode 100644 index 000000000000..f90677fcc2b9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/AsyncBatchImportModelEvaluationSlices.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncBatchImportModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + asyncBatchImportModelEvaluationSlices(); + } + + public static void asyncBatchImportModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportModelEvaluationSlicesRequest request = + BatchImportModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .addAllModelEvaluationSlices(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.batchImportModelEvaluationSlicesCallable().futureCall(request); + // Do something. + BatchImportModelEvaluationSlicesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java new file mode 100644 index 000000000000..87b28b0789ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlices.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncBatchImportModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlices(); + } + + public static void syncBatchImportModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + BatchImportModelEvaluationSlicesRequest request = + BatchImportModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .addAllModelEvaluationSlices(new ArrayList()) + .build(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java new file mode 100644 index 000000000000..d47b4e188a50 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_ModelevaluationnameListmodelevaluationslice_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice(); + } + + public static void + syncBatchImportModelEvaluationSlicesModelevaluationnameListmodelevaluationslice() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + List modelEvaluationSlices = new ArrayList<>(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_ModelevaluationnameListmodelevaluationslice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java new file mode 100644 index 000000000000..0ea8a40dcd94 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/batchimportmodelevaluationslices/SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_StringListmodelevaluationslice_sync] +import com.google.cloud.aiplatform.v1beta1.BatchImportModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchImportModelEvaluationSlicesStringListmodelevaluationslice { + + public static void main(String[] args) throws Exception { + syncBatchImportModelEvaluationSlicesStringListmodelevaluationslice(); + } + + public static void syncBatchImportModelEvaluationSlicesStringListmodelevaluationslice() + throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + List modelEvaluationSlices = new ArrayList<>(); + BatchImportModelEvaluationSlicesResponse response = + modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_BatchImportModelEvaluationSlices_StringListmodelevaluationslice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModel.java new file mode 100644 index 000000000000..3240c74c93ec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModel.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CopyModelRequest; +import com.google.cloud.aiplatform.v1beta1.EncryptionSpec; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCopyModel { + + public static void main(String[] args) throws Exception { + asyncCopyModel(); + } + + public static void asyncCopyModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.copyModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModelLRO.java new file mode 100644 index 000000000000..80ecf653f128 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/AsyncCopyModelLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CopyModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CopyModelRequest; +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.EncryptionSpec; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncCopyModelLRO { + + public static void main(String[] args) throws Exception { + asyncCopyModelLRO(); + } + + public static void asyncCopyModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + OperationFuture future = + modelServiceClient.copyModelOperationCallable().futureCall(request); + // Do something. + CopyModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModel.java new file mode 100644 index 000000000000..f669be402c89 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_sync] +import com.google.cloud.aiplatform.v1beta1.CopyModelRequest; +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.EncryptionSpec; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncCopyModel { + + public static void main(String[] args) throws Exception { + syncCopyModel(); + } + + public static void syncCopyModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + CopyModelRequest request = + CopyModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setEncryptionSpec(EncryptionSpec.newBuilder().build()) + .build(); + CopyModelResponse response = modelServiceClient.copyModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java new file mode 100644 index 000000000000..818b8e50355f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_LocationnameModelname_sync] +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncCopyModelLocationnameModelname { + + public static void main(String[] args) throws Exception { + syncCopyModelLocationnameModelname(); + } + + public static void syncCopyModelLocationnameModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_LocationnameModelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameString.java new file mode 100644 index 000000000000..3ddc69bce460 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelLocationnameString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_LocationnameString_sync] +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncCopyModelLocationnameString { + + public static void main(String[] args) throws Exception { + syncCopyModelLocationnameString(); + } + + public static void syncCopyModelLocationnameString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_LocationnameString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringModelname.java new file mode 100644 index 000000000000..292e4594cb61 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_StringModelname_sync] +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncCopyModelStringModelname { + + public static void main(String[] args) throws Exception { + syncCopyModelStringModelname(); + } + + public static void syncCopyModelStringModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_StringModelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringString.java new file mode 100644 index 000000000000..76d5eab76d4f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/copymodel/SyncCopyModelStringString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_CopyModel_StringString_sync] +import com.google.cloud.aiplatform.v1beta1.CopyModelResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncCopyModelStringString { + + public static void main(String[] args) throws Exception { + syncCopyModelStringString(); + } + + public static void syncCopyModelStringString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_CopyModel_StringString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..3247bb99f899 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ModelServiceSettings modelServiceSettings = + ModelServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ModelService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..90afc3f9c351 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ModelServiceSettings modelServiceSettings = + ModelServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ModelService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModel.java new file mode 100644 index 000000000000..fa5675e41019 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteModel { + + public static void main(String[] args) throws Exception { + asyncDeleteModel(); + } + + public static void asyncDeleteModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = modelServiceClient.deleteModelCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModelLRO.java new file mode 100644 index 000000000000..3df219aae96b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/AsyncDeleteModelLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelLRO(); + } + + public static void asyncDeleteModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + OperationFuture future = + modelServiceClient.deleteModelOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModel.java new file mode 100644 index 000000000000..83b111195411 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModel.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModel_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteModelRequest; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModel { + + public static void main(String[] args) throws Exception { + syncDeleteModel(); + } + + public static void syncDeleteModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelRequest request = + DeleteModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + modelServiceClient.deleteModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelModelname.java new file mode 100644 index 000000000000..c94722af4ca0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModel_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelModelname { + + public static void main(String[] args) throws Exception { + syncDeleteModelModelname(); + } + + public static void syncDeleteModelModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + modelServiceClient.deleteModelAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModel_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelString.java new file mode 100644 index 000000000000..478de4afcb18 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodel/SyncDeleteModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModel_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelString { + + public static void main(String[] args) throws Exception { + syncDeleteModelString(); + } + + public static void syncDeleteModelString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + modelServiceClient.deleteModelAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java new file mode 100644 index 000000000000..f0e3b07c7ae6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersion.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteModelVersion { + + public static void main(String[] args) throws Exception { + asyncDeleteModelVersion(); + } + + public static void asyncDeleteModelVersion() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = + modelServiceClient.deleteModelVersionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java new file mode 100644 index 000000000000..0a38a21a774b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/AsyncDeleteModelVersionLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteModelVersionLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteModelVersionLRO(); + } + + public static void asyncDeleteModelVersionLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + OperationFuture future = + modelServiceClient.deleteModelVersionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersion.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersion.java new file mode 100644 index 000000000000..fd0f5226fc0b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersion.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteModelVersionRequest; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersion { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersion(); + } + + public static void syncDeleteModelVersion() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + DeleteModelVersionRequest request = + DeleteModelVersionRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + modelServiceClient.deleteModelVersionAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java new file mode 100644 index 000000000000..350e26397687 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersionModelname { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersionModelname(); + } + + public static void syncDeleteModelVersionModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + modelServiceClient.deleteModelVersionAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java new file mode 100644 index 000000000000..614442bce135 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/deletemodelversion/SyncDeleteModelVersionString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteModelVersionString { + + public static void main(String[] args) throws Exception { + syncDeleteModelVersionString(); + } + + public static void syncDeleteModelVersionString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + modelServiceClient.deleteModelVersionAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_DeleteModelVersion_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModel.java new file mode 100644 index 000000000000..fdd815a03969 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ExportModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ExportModelRequest; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncExportModel { + + public static void main(String[] args) throws Exception { + asyncExportModel(); + } + + public static void asyncExportModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.exportModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ExportModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModelLRO.java new file mode 100644 index 000000000000..0efc1ed42710 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/AsyncExportModelLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ExportModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.ExportModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.ExportModelRequest; +import com.google.cloud.aiplatform.v1beta1.ExportModelResponse; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncExportModelLRO { + + public static void main(String[] args) throws Exception { + asyncExportModelLRO(); + } + + public static void asyncExportModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + OperationFuture future = + modelServiceClient.exportModelOperationCallable().futureCall(request); + // Do something. + ExportModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ExportModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModel.java new file mode 100644 index 000000000000..f7a758e060ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ExportModel_sync] +import com.google.cloud.aiplatform.v1beta1.ExportModelRequest; +import com.google.cloud.aiplatform.v1beta1.ExportModelResponse; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncExportModel { + + public static void main(String[] args) throws Exception { + syncExportModel(); + } + + public static void syncExportModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ExportModelRequest request = + ExportModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) + .build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ExportModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java new file mode 100644 index 000000000000..7c85408cb306 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelModelnameExportmodelrequestoutputconfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ExportModel_ModelnameExportmodelrequestoutputconfig_sync] +import com.google.cloud.aiplatform.v1beta1.ExportModelRequest; +import com.google.cloud.aiplatform.v1beta1.ExportModelResponse; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncExportModelModelnameExportmodelrequestoutputconfig { + + public static void main(String[] args) throws Exception { + syncExportModelModelnameExportmodelrequestoutputconfig(); + } + + public static void syncExportModelModelnameExportmodelrequestoutputconfig() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + ExportModelRequest.OutputConfig outputConfig = + ExportModelRequest.OutputConfig.newBuilder().build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ExportModel_ModelnameExportmodelrequestoutputconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java new file mode 100644 index 000000000000..5bbb2663de54 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/exportmodel/SyncExportModelStringExportmodelrequestoutputconfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ExportModel_StringExportmodelrequestoutputconfig_sync] +import com.google.cloud.aiplatform.v1beta1.ExportModelRequest; +import com.google.cloud.aiplatform.v1beta1.ExportModelResponse; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncExportModelStringExportmodelrequestoutputconfig { + + public static void main(String[] args) throws Exception { + syncExportModelStringExportmodelrequestoutputconfig(); + } + + public static void syncExportModelStringExportmodelrequestoutputconfig() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + ExportModelRequest.OutputConfig outputConfig = + ExportModelRequest.OutputConfig.newBuilder().build(); + ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ExportModel_StringExportmodelrequestoutputconfig_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..8f9b9671ff7d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..bcce48a3dc15 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = modelServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..d317f2d095a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = modelServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..1ee0696a38c8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = modelServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/AsyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/AsyncGetModel.java new file mode 100644 index 000000000000..a32e0b6659c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/AsyncGetModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetModelRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncGetModel { + + public static void main(String[] args) throws Exception { + asyncGetModel(); + } + + public static void asyncGetModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelRequest request = + GetModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + ApiFuture future = modelServiceClient.getModelCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..32a0f71f5396 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModel.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModel_sync] +import com.google.cloud.aiplatform.v1beta1.GetModelRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelRequest request = + GetModelRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .build(); + Model response = modelServiceClient.getModel(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelModelname.java new file mode 100644 index 000000000000..c921f21a3dea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelModelname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModel_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelModelname { + + public static void main(String[] args) throws Exception { + syncGetModelModelname(); + } + + public static void syncGetModelModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + Model response = modelServiceClient.getModel(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModel_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelString.java new file mode 100644 index 000000000000..5b9cacca55dc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodel/SyncGetModelString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModel_String_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelString { + + public static void main(String[] args) throws Exception { + syncGetModelString(); + } + + public static void syncGetModelString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + Model response = modelServiceClient.getModel(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModel_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java new file mode 100644 index 000000000000..f23038c79818 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/AsyncGetModelEvaluation.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetModelEvaluationRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncGetModelEvaluation { + + public static void main(String[] args) throws Exception { + asyncGetModelEvaluation(); + } + + public static void asyncGetModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationRequest request = + GetModelEvaluationRequest.newBuilder() + .setName( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .build(); + ApiFuture future = + modelServiceClient.getModelEvaluationCallable().futureCall(request); + // Do something. + ModelEvaluation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java new file mode 100644 index 000000000000..fb5572309d2f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluation.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_sync] +import com.google.cloud.aiplatform.v1beta1.GetModelEvaluationRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluation { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluation(); + } + + public static void syncGetModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationRequest request = + GetModelEvaluationRequest.newBuilder() + .setName( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .build(); + ModelEvaluation response = modelServiceClient.getModelEvaluation(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java new file mode 100644 index 000000000000..491636ce24e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationModelevaluationname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_Modelevaluationname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluationModelevaluationname { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationModelevaluationname(); + } + + public static void syncGetModelEvaluationModelevaluationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName name = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + ModelEvaluation response = modelServiceClient.getModelEvaluation(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_Modelevaluationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java new file mode 100644 index 000000000000..e985c36428b3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluation/SyncGetModelEvaluationString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluationString { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationString(); + } + + public static void syncGetModelEvaluationString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + ModelEvaluation response = modelServiceClient.getModelEvaluation(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java new file mode 100644 index 000000000000..8f4595f182ac --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/AsyncGetModelEvaluationSlice.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetModelEvaluationSliceRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncGetModelEvaluationSlice { + + public static void main(String[] args) throws Exception { + asyncGetModelEvaluationSlice(); + } + + public static void asyncGetModelEvaluationSlice() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationSliceRequest request = + GetModelEvaluationSliceRequest.newBuilder() + .setName( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .build(); + ApiFuture future = + modelServiceClient.getModelEvaluationSliceCallable().futureCall(request); + // Do something. + ModelEvaluationSlice response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java new file mode 100644 index 000000000000..10b6d79454de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSlice.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_sync] +import com.google.cloud.aiplatform.v1beta1.GetModelEvaluationSliceRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluationSlice { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSlice(); + } + + public static void syncGetModelEvaluationSlice() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + GetModelEvaluationSliceRequest request = + GetModelEvaluationSliceRequest.newBuilder() + .setName( + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString()) + .build(); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java new file mode 100644 index 000000000000..769a1bc37d84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceModelevaluationslicename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_Modelevaluationslicename_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluationSliceModelevaluationslicename { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSliceModelevaluationslicename(); + } + + public static void syncGetModelEvaluationSliceModelevaluationslicename() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationSliceName name = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_Modelevaluationslicename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java new file mode 100644 index 000000000000..eeb88d70ccb1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/getmodelevaluationslice/SyncGetModelEvaluationSliceString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSliceName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncGetModelEvaluationSliceString { + + public static void main(String[] args) throws Exception { + syncGetModelEvaluationSliceString(); + } + + public static void syncGetModelEvaluationSliceString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = + ModelEvaluationSliceName.of( + "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") + .toString(); + ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_GetModelEvaluationSlice_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java new file mode 100644 index 000000000000..bbb5043f7879 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/AsyncImportModelEvaluation.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class AsyncImportModelEvaluation { + + public static void main(String[] args) throws Exception { + asyncImportModelEvaluation(); + } + + public static void asyncImportModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ImportModelEvaluationRequest request = + ImportModelEvaluationRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setModelEvaluation(ModelEvaluation.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.importModelEvaluationCallable().futureCall(request); + // Do something. + ModelEvaluation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java new file mode 100644 index 000000000000..b780b11b00bd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_sync] +import com.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncImportModelEvaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluation(); + } + + public static void syncImportModelEvaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ImportModelEvaluationRequest request = + ImportModelEvaluationRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setModelEvaluation(ModelEvaluation.newBuilder().build()) + .build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java new file mode 100644 index 000000000000..f78c9e95e5cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationModelnameModelevaluation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_ModelnameModelevaluation_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncImportModelEvaluationModelnameModelevaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluationModelnameModelevaluation(); + } + + public static void syncImportModelEvaluationModelnameModelevaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_ModelnameModelevaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java new file mode 100644 index 000000000000..2ca2e065aa5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/importmodelevaluation/SyncImportModelEvaluationStringModelevaluation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_StringModelevaluation_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncImportModelEvaluationStringModelevaluation { + + public static void main(String[] args) throws Exception { + syncImportModelEvaluationStringModelevaluation(); + } + + public static void syncImportModelEvaluationStringModelevaluation() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); + ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_StringModelevaluation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..c4c3a69f7142 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + modelServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..dfd03660779d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = modelServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..31d568da75db --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : modelServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java new file mode 100644 index 000000000000..050e272bf4ae --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluations.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluations { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluations(); + } + + public static void asyncListModelEvaluations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.listModelEvaluationsPagedCallable().futureCall(request); + // Do something. + for (ModelEvaluation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java new file mode 100644 index 000000000000..d61a75702818 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/AsyncListModelEvaluationsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationsResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationsPaged(); + } + + public static void asyncListModelEvaluationsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelEvaluationsResponse response = + modelServiceClient.listModelEvaluationsCallable().call(request); + for (ModelEvaluation element : response.getModelEvaluationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluations.java new file mode 100644 index 000000000000..1b439ac1e5de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_sync] +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationsRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelEvaluations { + + public static void main(String[] args) throws Exception { + syncListModelEvaluations(); + } + + public static void syncListModelEvaluations() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationsRequest request = + ListModelEvaluationsRequest.newBuilder() + .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelEvaluation element : + modelServiceClient.listModelEvaluations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java new file mode 100644 index 000000000000..03f705569bf4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelEvaluationsModelname { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationsModelname(); + } + + public static void syncListModelEvaluationsModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java new file mode 100644 index 000000000000..229e8c65aa1c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluations/SyncListModelEvaluationsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluation; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelEvaluationsString { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationsString(); + } + + public static void syncListModelEvaluationsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluations_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java new file mode 100644 index 000000000000..1e263adbe41a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlices.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationSlices(); + } + + public static void asyncListModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.listModelEvaluationSlicesPagedCallable().futureCall(request); + // Do something. + for (ModelEvaluationSlice element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java new file mode 100644 index 000000000000..baf0fb654830 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/AsyncListModelEvaluationSlicesPaged.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationSlicesResponse; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelEvaluationSlicesPaged { + + public static void main(String[] args) throws Exception { + asyncListModelEvaluationSlicesPaged(); + } + + public static void asyncListModelEvaluationSlicesPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelEvaluationSlicesResponse response = + modelServiceClient.listModelEvaluationSlicesCallable().call(request); + for (ModelEvaluationSlice element : response.getModelEvaluationSlicesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java new file mode 100644 index 000000000000..285f551fac8c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlices.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_sync] +import com.google.cloud.aiplatform.v1beta1.ListModelEvaluationSlicesRequest; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelEvaluationSlices { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlices(); + } + + public static void syncListModelEvaluationSlices() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelEvaluationSlicesRequest request = + ListModelEvaluationSlicesRequest.newBuilder() + .setParent( + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java new file mode 100644 index 000000000000..ff1e89ad58ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesModelevaluationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_Modelevaluationname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelEvaluationSlicesModelevaluationname { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlicesModelevaluationname(); + } + + public static void syncListModelEvaluationSlicesModelevaluationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelEvaluationName parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_Modelevaluationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java new file mode 100644 index 000000000000..65ba4b9f4f35 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelevaluationslices/SyncListModelEvaluationSlicesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationName; +import com.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelEvaluationSlicesString { + + public static void main(String[] args) throws Exception { + syncListModelEvaluationSlicesString(); + } + + public static void syncListModelEvaluationSlicesString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = + ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); + for (ModelEvaluationSlice element : + modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelEvaluationSlices_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModels.java new file mode 100644 index 000000000000..1d9a5d32b949 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModels.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModels_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListModelsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModels { + + public static void main(String[] args) throws Exception { + asyncListModels(); + } + + public static void asyncListModels() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.listModelsPagedCallable().futureCall(request); + // Do something. + for (Model element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModels_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModelsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModelsPaged.java new file mode 100644 index 000000000000..438d528b1ae3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/AsyncListModelsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModels_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListModelsRequest; +import com.google.cloud.aiplatform.v1beta1.ListModelsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelsPaged(); + } + + public static void asyncListModelsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListModelsResponse response = modelServiceClient.listModelsCallable().call(request); + for (Model element : response.getModelsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModels_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModels.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModels.java new file mode 100644 index 000000000000..4ba59922efa1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModels.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModels_sync] +import com.google.cloud.aiplatform.v1beta1.ListModelsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModels { + + public static void main(String[] args) throws Exception { + syncListModels(); + } + + public static void syncListModels() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelsRequest request = + ListModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Model element : modelServiceClient.listModels(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModels_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsLocationname.java new file mode 100644 index 000000000000..e5907bcc5cca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModels_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelsLocationname { + + public static void main(String[] args) throws Exception { + syncListModelsLocationname(); + } + + public static void syncListModelsLocationname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Model element : modelServiceClient.listModels(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModels_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsString.java new file mode 100644 index 000000000000..78ae84f94ac5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodels/SyncListModelsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModels_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelsString { + + public static void main(String[] args) throws Exception { + syncListModelsString(); + } + + public static void syncListModelsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Model element : modelServiceClient.listModels(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModels_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersions.java new file mode 100644 index 000000000000..a804b774d150 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersions.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelVersions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListModelVersions { + + public static void main(String[] args) throws Exception { + asyncListModelVersions(); + } + + public static void asyncListModelVersions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + modelServiceClient.listModelVersionsPagedCallable().futureCall(request); + // Do something. + for (Model element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelVersions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java new file mode 100644 index 000000000000..8eca0cc8e43c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/AsyncListModelVersionsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelVersions_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1beta1.ListModelVersionsResponse; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListModelVersionsPaged { + + public static void main(String[] args) throws Exception { + asyncListModelVersionsPaged(); + } + + public static void asyncListModelVersionsPaged() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListModelVersionsResponse response = + modelServiceClient.listModelVersionsCallable().call(request); + for (Model element : response.getModelsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelVersions_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersions.java new file mode 100644 index 000000000000..cb2fbb16f0bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersions.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelVersions_sync] +import com.google.cloud.aiplatform.v1beta1.ListModelVersionsRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListModelVersions { + + public static void main(String[] args) throws Exception { + syncListModelVersions(); + } + + public static void syncListModelVersions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ListModelVersionsRequest request = + ListModelVersionsRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setReadMask(FieldMask.newBuilder().build()) + .setOrderBy("orderBy-1207110587") + .build(); + for (Model element : modelServiceClient.listModelVersions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelVersions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsModelname.java new file mode 100644 index 000000000000..45672dc8611d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsModelname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelVersions_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelVersionsModelname { + + public static void main(String[] args) throws Exception { + syncListModelVersionsModelname(); + } + + public static void syncListModelVersionsModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelVersions_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsString.java new file mode 100644 index 000000000000..191bf4f4c736 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/listmodelversions/SyncListModelVersionsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_ListModelVersions_String_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; + +public class SyncListModelVersionsString { + + public static void main(String[] args) throws Exception { + syncListModelVersionsString(); + } + + public static void syncListModelVersionsString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_ListModelVersions_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java new file mode 100644 index 000000000000..eeeb3c287c2e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/AsyncMergeVersionAliases.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.MergeVersionAliasesRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class AsyncMergeVersionAliases { + + public static void main(String[] args) throws Exception { + asyncMergeVersionAliases(); + } + + public static void asyncMergeVersionAliases() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + MergeVersionAliasesRequest request = + MergeVersionAliasesRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .addAllVersionAliases(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.mergeVersionAliasesCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java new file mode 100644 index 000000000000..e500fb43cd16 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliases.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_sync] +import com.google.cloud.aiplatform.v1beta1.MergeVersionAliasesRequest; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; + +public class SyncMergeVersionAliases { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliases(); + } + + public static void syncMergeVersionAliases() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + MergeVersionAliasesRequest request = + MergeVersionAliasesRequest.newBuilder() + .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .addAllVersionAliases(new ArrayList()) + .build(); + Model response = modelServiceClient.mergeVersionAliases(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java new file mode 100644 index 000000000000..860963b00d10 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesModelnameListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_ModelnameListstring_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncMergeVersionAliasesModelnameListstring { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliasesModelnameListstring(); + } + + public static void syncMergeVersionAliasesModelnameListstring() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + List versionAliases = new ArrayList<>(); + Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_ModelnameListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java new file mode 100644 index 000000000000..5f94c6100f73 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/mergeversionaliases/SyncMergeVersionAliasesStringListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_StringListstring_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncMergeVersionAliasesStringListstring { + + public static void main(String[] args) throws Exception { + syncMergeVersionAliasesStringListstring(); + } + + public static void syncMergeVersionAliasesStringListstring() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + List versionAliases = new ArrayList<>(); + Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_MergeVersionAliases_StringListstring_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..cde4ed9df2f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..f848057b3d2c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = modelServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..1f96c0d90274 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + modelServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..23969b77db6f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = modelServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java new file mode 100644 index 000000000000..cd2e5e53d4cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDataset.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Examples; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest; +import com.google.longrunning.Operation; + +public class AsyncUpdateExplanationDataset { + + public static void main(String[] args) throws Exception { + asyncUpdateExplanationDataset(); + } + + public static void asyncUpdateExplanationDataset() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + ApiFuture future = + modelServiceClient.updateExplanationDatasetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java new file mode 100644 index 000000000000..f9a70a922125 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/AsyncUpdateExplanationDatasetLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.Examples; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + +public class AsyncUpdateExplanationDatasetLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateExplanationDatasetLRO(); + } + + public static void asyncUpdateExplanationDatasetLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + OperationFuture + future = + modelServiceClient.updateExplanationDatasetOperationCallable().futureCall(request); + // Do something. + UpdateExplanationDatasetResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java new file mode 100644 index 000000000000..4cbdb329ef8d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_sync] +import com.google.cloud.aiplatform.v1beta1.Examples; +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDataset { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDataset(); + } + + public static void syncUpdateExplanationDataset() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateExplanationDatasetRequest request = + UpdateExplanationDatasetRequest.newBuilder() + .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) + .setExamples(Examples.newBuilder().build()) + .build(); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java new file mode 100644 index 000000000000..823a9c440d88 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetModelname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_Modelname_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDatasetModelname { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDatasetModelname(); + } + + public static void syncUpdateExplanationDatasetModelname() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + ModelName model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(model).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_Modelname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java new file mode 100644 index 000000000000..b8143145d9d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updateexplanationdataset/SyncUpdateExplanationDatasetString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_String_sync] +import com.google.cloud.aiplatform.v1beta1.ModelName; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + +public class SyncUpdateExplanationDatasetString { + + public static void main(String[] args) throws Exception { + syncUpdateExplanationDatasetString(); + } + + public static void syncUpdateExplanationDatasetString() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); + UpdateExplanationDatasetResponse response = + modelServiceClient.updateExplanationDatasetAsync(model).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/AsyncUpdateModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/AsyncUpdateModel.java new file mode 100644 index 000000000000..695c8328766c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/AsyncUpdateModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateModelRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateModel { + + public static void main(String[] args) throws Exception { + asyncUpdateModel(); + } + + public static void asyncUpdateModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateModelRequest request = + UpdateModelRequest.newBuilder() + .setModel(Model.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = modelServiceClient.updateModelCallable().futureCall(request); + // Do something. + Model response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModel.java new file mode 100644 index 000000000000..51872a22a82e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateModel_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateModelRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModel { + + public static void main(String[] args) throws Exception { + syncUpdateModel(); + } + + public static void syncUpdateModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UpdateModelRequest request = + UpdateModelRequest.newBuilder() + .setModel(Model.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Model response = modelServiceClient.updateModel(request); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java new file mode 100644 index 000000000000..257f8b7f5265 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/updatemodel/SyncUpdateModelModelFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UpdateModel_ModelFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateModelModelFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateModelModelFieldmask(); + } + + public static void syncUpdateModelModelFieldmask() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + Model model = Model.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Model response = modelServiceClient.updateModel(model, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UpdateModel_ModelFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModel.java new file mode 100644 index 000000000000..9012e54564f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModel.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UploadModel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UploadModelRequest; +import com.google.longrunning.Operation; + +public class AsyncUploadModel { + + public static void main(String[] args) throws Exception { + asyncUploadModel(); + } + + public static void asyncUploadModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + ApiFuture future = modelServiceClient.uploadModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UploadModel_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModelLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModelLRO.java new file mode 100644 index 000000000000..989fb643be41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/AsyncUploadModelLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UploadModel_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UploadModelOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UploadModelRequest; +import com.google.cloud.aiplatform.v1beta1.UploadModelResponse; + +public class AsyncUploadModelLRO { + + public static void main(String[] args) throws Exception { + asyncUploadModelLRO(); + } + + public static void asyncUploadModelLRO() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + OperationFuture future = + modelServiceClient.uploadModelOperationCallable().futureCall(request); + // Do something. + UploadModelResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UploadModel_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModel.java new file mode 100644 index 000000000000..257b3e61bc6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModel.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UploadModel_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UploadModelRequest; +import com.google.cloud.aiplatform.v1beta1.UploadModelResponse; + +public class SyncUploadModel { + + public static void main(String[] args) throws Exception { + syncUploadModel(); + } + + public static void syncUploadModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + UploadModelRequest request = + UploadModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setParentModel("parentModel998431903") + .setModelId("modelId1226956324") + .setModel(Model.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UploadModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java new file mode 100644 index 000000000000..e79ea0c6a3df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelLocationnameModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UploadModel_LocationnameModel_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UploadModelResponse; + +public class SyncUploadModelLocationnameModel { + + public static void main(String[] args) throws Exception { + syncUploadModelLocationnameModel(); + } + + public static void syncUploadModelLocationnameModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Model model = Model.newBuilder().build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UploadModel_LocationnameModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelStringModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelStringModel.java new file mode 100644 index 000000000000..9beca17a10b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservice/uploadmodel/SyncUploadModelStringModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelService_UploadModel_StringModel_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Model; +import com.google.cloud.aiplatform.v1beta1.ModelServiceClient; +import com.google.cloud.aiplatform.v1beta1.UploadModelResponse; + +public class SyncUploadModelStringModel { + + public static void main(String[] args) throws Exception { + syncUploadModelStringModel(); + } + + public static void syncUploadModelStringModel() throws Exception { + // 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Model model = Model.newBuilder().build(); + UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ModelService_UploadModel_StringModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservicesettings/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservicesettings/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..9a0392a213ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/modelservicesettings/getmodel/SyncGetModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ModelServiceSettings_GetModel_sync] +import com.google.cloud.aiplatform.v1beta1.ModelServiceSettings; +import java.time.Duration; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 + ModelServiceSettings.Builder modelServiceSettingsBuilder = ModelServiceSettings.newBuilder(); + modelServiceSettingsBuilder + .getModelSettings() + .setRetrySettings( + modelServiceSettingsBuilder + .getModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelServiceSettings modelServiceSettings = modelServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ModelServiceSettings_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..83c2b37a0711 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + PersistentResourceServiceSettings persistentResourceServiceSettings = + PersistentResourceServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create(persistentResourceServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..9a66f8a27909 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + PersistentResourceServiceSettings persistentResourceServiceSettings = + PersistentResourceServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create(persistentResourceServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResource.java new file mode 100644 index 000000000000..6cf9e9ff957c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResource.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreatePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreatePersistentResource { + + public static void main(String[] args) throws Exception { + asyncCreatePersistentResource(); + } + + public static void asyncCreatePersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + CreatePersistentResourceRequest request = + CreatePersistentResourceRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPersistentResource(PersistentResource.newBuilder().build()) + .setPersistentResourceId("persistentResourceId-2123080768") + .build(); + ApiFuture future = + persistentResourceServiceClient.createPersistentResourceCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResourceLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResourceLRO.java new file mode 100644 index 000000000000..d8d3d2ebfdd2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/AsyncCreatePersistentResourceLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreatePersistentResourceOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreatePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class AsyncCreatePersistentResourceLRO { + + public static void main(String[] args) throws Exception { + asyncCreatePersistentResourceLRO(); + } + + public static void asyncCreatePersistentResourceLRO() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + CreatePersistentResourceRequest request = + CreatePersistentResourceRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPersistentResource(PersistentResource.newBuilder().build()) + .setPersistentResourceId("persistentResourceId-2123080768") + .build(); + OperationFuture future = + persistentResourceServiceClient + .createPersistentResourceOperationCallable() + .futureCall(request); + // Do something. + PersistentResource response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResource.java new file mode 100644 index 000000000000..04b9498ca836 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResource.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_sync] +import com.google.cloud.aiplatform.v1beta1.CreatePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncCreatePersistentResource { + + public static void main(String[] args) throws Exception { + syncCreatePersistentResource(); + } + + public static void syncCreatePersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + CreatePersistentResourceRequest request = + CreatePersistentResourceRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPersistentResource(PersistentResource.newBuilder().build()) + .setPersistentResourceId("persistentResourceId-2123080768") + .build(); + PersistentResource response = + persistentResourceServiceClient.createPersistentResourceAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceLocationnamePersistentresourceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceLocationnamePersistentresourceString.java new file mode 100644 index 000000000000..7863e61fefb7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceLocationnamePersistentresourceString.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_LocationnamePersistentresourceString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncCreatePersistentResourceLocationnamePersistentresourceString { + + public static void main(String[] args) throws Exception { + syncCreatePersistentResourceLocationnamePersistentresourceString(); + } + + public static void syncCreatePersistentResourceLocationnamePersistentresourceString() + throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PersistentResource persistentResource = PersistentResource.newBuilder().build(); + String persistentResourceId = "persistentResourceId-2123080768"; + PersistentResource response = + persistentResourceServiceClient + .createPersistentResourceAsync(parent, persistentResource, persistentResourceId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_LocationnamePersistentresourceString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceStringPersistentresourceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceStringPersistentresourceString.java new file mode 100644 index 000000000000..f3e855d6cd3c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/createpersistentresource/SyncCreatePersistentResourceStringPersistentresourceString.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_StringPersistentresourceString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncCreatePersistentResourceStringPersistentresourceString { + + public static void main(String[] args) throws Exception { + syncCreatePersistentResourceStringPersistentresourceString(); + } + + public static void syncCreatePersistentResourceStringPersistentresourceString() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PersistentResource persistentResource = PersistentResource.newBuilder().build(); + String persistentResourceId = "persistentResourceId-2123080768"; + PersistentResource response = + persistentResourceServiceClient + .createPersistentResourceAsync(parent, persistentResource, persistentResourceId) + .get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_CreatePersistentResource_StringPersistentresourceString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResource.java new file mode 100644 index 000000000000..fda809acd49d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResource.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeletePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeletePersistentResource { + + public static void main(String[] args) throws Exception { + asyncDeletePersistentResource(); + } + + public static void asyncDeletePersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + DeletePersistentResourceRequest request = + DeletePersistentResourceRequest.newBuilder() + .setName( + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]") + .toString()) + .build(); + ApiFuture future = + persistentResourceServiceClient.deletePersistentResourceCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResourceLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResourceLRO.java new file mode 100644 index 000000000000..124d961e7718 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/AsyncDeletePersistentResourceLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeletePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeletePersistentResourceLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePersistentResourceLRO(); + } + + public static void asyncDeletePersistentResourceLRO() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + DeletePersistentResourceRequest request = + DeletePersistentResourceRequest.newBuilder() + .setName( + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]") + .toString()) + .build(); + OperationFuture future = + persistentResourceServiceClient + .deletePersistentResourceOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResource.java new file mode 100644 index 000000000000..dbef11531263 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResource.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_sync] +import com.google.cloud.aiplatform.v1beta1.DeletePersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePersistentResource { + + public static void main(String[] args) throws Exception { + syncDeletePersistentResource(); + } + + public static void syncDeletePersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + DeletePersistentResourceRequest request = + DeletePersistentResourceRequest.newBuilder() + .setName( + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]") + .toString()) + .build(); + persistentResourceServiceClient.deletePersistentResourceAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourcePersistentresourcename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourcePersistentresourcename.java new file mode 100644 index 000000000000..7d9f52698a20 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourcePersistentresourcename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_Persistentresourcename_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePersistentResourcePersistentresourcename { + + public static void main(String[] args) throws Exception { + syncDeletePersistentResourcePersistentresourcename(); + } + + public static void syncDeletePersistentResourcePersistentresourcename() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + PersistentResourceName name = + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]"); + persistentResourceServiceClient.deletePersistentResourceAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_Persistentresourcename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourceString.java new file mode 100644 index 000000000000..4e101180c219 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/deletepersistentresource/SyncDeletePersistentResourceString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_String_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePersistentResourceString { + + public static void main(String[] args) throws Exception { + syncDeletePersistentResourceString(); + } + + public static void syncDeletePersistentResourceString() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + String name = + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]").toString(); + persistentResourceServiceClient.deletePersistentResourceAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_DeletePersistentResource_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..b690c6df7a61 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + persistentResourceServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..a418b658c8f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = persistentResourceServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..286154664467 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + persistentResourceServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..a00454f28f9c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = persistentResourceServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/AsyncGetPersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/AsyncGetPersistentResource.java new file mode 100644 index 000000000000..63baa4de8554 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/AsyncGetPersistentResource.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetPersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class AsyncGetPersistentResource { + + public static void main(String[] args) throws Exception { + asyncGetPersistentResource(); + } + + public static void asyncGetPersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetPersistentResourceRequest request = + GetPersistentResourceRequest.newBuilder() + .setName( + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]") + .toString()) + .build(); + ApiFuture future = + persistentResourceServiceClient.getPersistentResourceCallable().futureCall(request); + // Do something. + PersistentResource response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResource.java new file mode 100644 index 000000000000..053102406d45 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResource.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_sync] +import com.google.cloud.aiplatform.v1beta1.GetPersistentResourceRequest; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncGetPersistentResource { + + public static void main(String[] args) throws Exception { + syncGetPersistentResource(); + } + + public static void syncGetPersistentResource() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + GetPersistentResourceRequest request = + GetPersistentResourceRequest.newBuilder() + .setName( + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]") + .toString()) + .build(); + PersistentResource response = persistentResourceServiceClient.getPersistentResource(request); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourcePersistentresourcename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourcePersistentresourcename.java new file mode 100644 index 000000000000..ad0f6ffa7c9d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourcePersistentresourcename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_Persistentresourcename_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncGetPersistentResourcePersistentresourcename { + + public static void main(String[] args) throws Exception { + syncGetPersistentResourcePersistentresourcename(); + } + + public static void syncGetPersistentResourcePersistentresourcename() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + PersistentResourceName name = + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]"); + PersistentResource response = persistentResourceServiceClient.getPersistentResource(name); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_Persistentresourcename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourceString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourceString.java new file mode 100644 index 000000000000..6154dd6f5e84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/getpersistentresource/SyncGetPersistentResourceString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_String_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncGetPersistentResourceString { + + public static void main(String[] args) throws Exception { + syncGetPersistentResourceString(); + } + + public static void syncGetPersistentResourceString() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + String name = + PersistentResourceName.of("[PROJECT]", "[LOCATION]", "[PERSISTENT_RESOURCE]").toString(); + PersistentResource response = persistentResourceServiceClient.getPersistentResource(name); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_GetPersistentResource_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..320bb3ffc958 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + persistentResourceServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..77f4c796d408 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + persistentResourceServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..fe3cfe974434 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listlocations/SyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : persistentResourceServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResources.java new file mode 100644 index 000000000000..771f3dff304c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResources.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListPersistentResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class AsyncListPersistentResources { + + public static void main(String[] args) throws Exception { + asyncListPersistentResources(); + } + + public static void asyncListPersistentResources() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListPersistentResourcesRequest request = + ListPersistentResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + persistentResourceServiceClient + .listPersistentResourcesPagedCallable() + .futureCall(request); + // Do something. + for (PersistentResource element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResourcesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResourcesPaged.java new file mode 100644 index 000000000000..4a47aaa6ef91 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/AsyncListPersistentResourcesPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListPersistentResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.ListPersistentResourcesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.common.base.Strings; + +public class AsyncListPersistentResourcesPaged { + + public static void main(String[] args) throws Exception { + asyncListPersistentResourcesPaged(); + } + + public static void asyncListPersistentResourcesPaged() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListPersistentResourcesRequest request = + ListPersistentResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListPersistentResourcesResponse response = + persistentResourceServiceClient.listPersistentResourcesCallable().call(request); + for (PersistentResource element : response.getPersistentResourcesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResources.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResources.java new file mode 100644 index 000000000000..1824815fb2c7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResources.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_sync] +import com.google.cloud.aiplatform.v1beta1.ListPersistentResourcesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncListPersistentResources { + + public static void main(String[] args) throws Exception { + syncListPersistentResources(); + } + + public static void syncListPersistentResources() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + ListPersistentResourcesRequest request = + ListPersistentResourcesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (PersistentResource element : + persistentResourceServiceClient.listPersistentResources(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesLocationname.java new file mode 100644 index 000000000000..9c89317000d1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesLocationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncListPersistentResourcesLocationname { + + public static void main(String[] args) throws Exception { + syncListPersistentResourcesLocationname(); + } + + public static void syncListPersistentResourcesLocationname() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PersistentResource element : + persistentResourceServiceClient.listPersistentResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesString.java new file mode 100644 index 000000000000..ab204f627146 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/listpersistentresources/SyncListPersistentResourcesString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PersistentResource; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; + +public class SyncListPersistentResourcesString { + + public static void main(String[] args) throws Exception { + syncListPersistentResourcesString(); + } + + public static void syncListPersistentResourcesString() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PersistentResource element : + persistentResourceServiceClient.listPersistentResources(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_ListPersistentResources_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..383f4ce3a69e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + persistentResourceServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..3582e92a5b6d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = persistentResourceServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..c67607e5a041 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + persistentResourceServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..b687f0db37cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (PersistentResourceServiceClient persistentResourceServiceClient = + PersistentResourceServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = + persistentResourceServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservicesettings/getpersistentresource/SyncGetPersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservicesettings/getpersistentresource/SyncGetPersistentResource.java new file mode 100644 index 000000000000..8817427b1f3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/persistentresourceservicesettings/getpersistentresource/SyncGetPersistentResource.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceServiceSettings_GetPersistentResource_sync] +import com.google.cloud.aiplatform.v1beta1.PersistentResourceServiceSettings; +import java.time.Duration; + +public class SyncGetPersistentResource { + + public static void main(String[] args) throws Exception { + syncGetPersistentResource(); + } + + public static void syncGetPersistentResource() throws Exception { + // 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 + PersistentResourceServiceSettings.Builder persistentResourceServiceSettingsBuilder = + PersistentResourceServiceSettings.newBuilder(); + persistentResourceServiceSettingsBuilder + .getPersistentResourceSettings() + .setRetrySettings( + persistentResourceServiceSettingsBuilder + .getPersistentResourceSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PersistentResourceServiceSettings persistentResourceServiceSettings = + persistentResourceServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceServiceSettings_GetPersistentResource_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java new file mode 100644 index 000000000000..81da7cb11a0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/AsyncCancelPipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelPipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class AsyncCancelPipelineJob { + + public static void main(String[] args) throws Exception { + asyncCancelPipelineJob(); + } + + public static void asyncCancelPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelPipelineJobRequest request = + CancelPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.cancelPipelineJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java new file mode 100644 index 000000000000..607695c528fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_sync] +import com.google.cloud.aiplatform.v1beta1.CancelPipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJob { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJob(); + } + + public static void syncCancelPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelPipelineJobRequest request = + CancelPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + pipelineServiceClient.cancelPipelineJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java new file mode 100644 index 000000000000..89e4ca4670d7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJobPipelinejobname(); + } + + public static void syncCancelPipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + pipelineServiceClient.cancelPipelineJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java new file mode 100644 index 000000000000..53a4a8cd2c38 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/cancelpipelinejob/SyncCancelPipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncCancelPipelineJobString { + + public static void main(String[] args) throws Exception { + syncCancelPipelineJobString(); + } + + public static void syncCancelPipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + pipelineServiceClient.cancelPipelineJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelPipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java new file mode 100644 index 000000000000..549275a119e0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/AsyncCancelTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CancelTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class AsyncCancelTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncCancelTrainingPipeline(); + } + + public static void asyncCancelTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelTrainingPipelineRequest request = + CancelTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.cancelTrainingPipelineCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java new file mode 100644 index 000000000000..fc7c428b8a7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.CancelTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipeline(); + } + + public static void syncCancelTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CancelTrainingPipelineRequest request = + CancelTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + pipelineServiceClient.cancelTrainingPipeline(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java new file mode 100644 index 000000000000..783580fe2404 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipelineString(); + } + + public static void syncCancelTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + pipelineServiceClient.cancelTrainingPipeline(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..685d72ec662f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/canceltrainingpipeline/SyncCancelTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncCancelTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncCancelTrainingPipelineTrainingpipelinename(); + } + + public static void syncCancelTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + pipelineServiceClient.cancelTrainingPipeline(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CancelTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..b0f99d2792d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + PipelineServiceSettings pipelineServiceSettings = + PipelineServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PipelineServiceClient pipelineServiceClient = + PipelineServiceClient.create(pipelineServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PipelineService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..f5404e9eeba5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + PipelineServiceSettings pipelineServiceSettings = + PipelineServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PipelineServiceClient pipelineServiceClient = + PipelineServiceClient.create(pipelineServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PipelineService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java new file mode 100644 index 000000000000..83dd53dbe0c3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/AsyncCreatePipelineJob.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreatePipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class AsyncCreatePipelineJob { + + public static void main(String[] args) throws Exception { + asyncCreatePipelineJob(); + } + + public static void asyncCreatePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreatePipelineJobRequest request = + CreatePipelineJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPipelineJob(PipelineJob.newBuilder().build()) + .setPipelineJobId("pipelineJobId-1711315914") + .build(); + ApiFuture future = + pipelineServiceClient.createPipelineJobCallable().futureCall(request); + // Do something. + PipelineJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java new file mode 100644 index 000000000000..893bd6f76375 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_sync] +import com.google.cloud.aiplatform.v1beta1.CreatePipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncCreatePipelineJob { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJob(); + } + + public static void syncCreatePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreatePipelineJobRequest request = + CreatePipelineJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPipelineJob(PipelineJob.newBuilder().build()) + .setPipelineJobId("pipelineJobId-1711315914") + .build(); + PipelineJob response = pipelineServiceClient.createPipelineJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java new file mode 100644 index 000000000000..120be47c9d64 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobLocationnamePipelinejobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_LocationnamePipelinejobString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncCreatePipelineJobLocationnamePipelinejobString { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJobLocationnamePipelinejobString(); + } + + public static void syncCreatePipelineJobLocationnamePipelinejobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PipelineJob pipelineJob = PipelineJob.newBuilder().build(); + String pipelineJobId = "pipelineJobId-1711315914"; + PipelineJob response = + pipelineServiceClient.createPipelineJob(parent, pipelineJob, pipelineJobId); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_LocationnamePipelinejobString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java new file mode 100644 index 000000000000..a218889a4383 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createpipelinejob/SyncCreatePipelineJobStringPipelinejobString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_StringPipelinejobString_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncCreatePipelineJobStringPipelinejobString { + + public static void main(String[] args) throws Exception { + syncCreatePipelineJobStringPipelinejobString(); + } + + public static void syncCreatePipelineJobStringPipelinejobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PipelineJob pipelineJob = PipelineJob.newBuilder().build(); + String pipelineJobId = "pipelineJobId-1711315914"; + PipelineJob response = + pipelineServiceClient.createPipelineJob(parent, pipelineJob, pipelineJobId); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreatePipelineJob_StringPipelinejobString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..eb34b176f1b0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/AsyncCreateTrainingPipeline.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class AsyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncCreateTrainingPipeline(); + } + + public static void asyncCreateTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreateTrainingPipelineRequest request = + CreateTrainingPipelineRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTrainingPipeline(TrainingPipeline.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.createTrainingPipelineCallable().futureCall(request); + // Do something. + TrainingPipeline response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..0f5dd3e274d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + CreateTrainingPipelineRequest request = + CreateTrainingPipelineRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTrainingPipeline(TrainingPipeline.newBuilder().build()) + .build(); + TrainingPipeline response = pipelineServiceClient.createTrainingPipeline(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java new file mode 100644 index 000000000000..0926603f26be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineLocationnameTrainingpipeline.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_LocationnameTrainingpipeline_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class SyncCreateTrainingPipelineLocationnameTrainingpipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipelineLocationnameTrainingpipeline(); + } + + public static void syncCreateTrainingPipelineLocationnameTrainingpipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + TrainingPipeline trainingPipeline = TrainingPipeline.newBuilder().build(); + TrainingPipeline response = + pipelineServiceClient.createTrainingPipeline(parent, trainingPipeline); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_LocationnameTrainingpipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java new file mode 100644 index 000000000000..ee3f268e14ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/createtrainingpipeline/SyncCreateTrainingPipelineStringTrainingpipeline.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_StringTrainingpipeline_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class SyncCreateTrainingPipelineStringTrainingpipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipelineStringTrainingpipeline(); + } + + public static void syncCreateTrainingPipelineStringTrainingpipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + TrainingPipeline trainingPipeline = TrainingPipeline.newBuilder().build(); + TrainingPipeline response = + pipelineServiceClient.createTrainingPipeline(parent, trainingPipeline); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_CreateTrainingPipeline_StringTrainingpipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java new file mode 100644 index 000000000000..8390c6059165 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeletePipelineJob { + + public static void main(String[] args) throws Exception { + asyncDeletePipelineJob(); + } + + public static void asyncDeletePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.deletePipelineJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java new file mode 100644 index 000000000000..f9f1265e8eb8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/AsyncDeletePipelineJobLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeletePipelineJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePipelineJobLRO(); + } + + public static void asyncDeletePipelineJobLRO() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + OperationFuture future = + pipelineServiceClient.deletePipelineJobOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java new file mode 100644 index 000000000000..1e8e93dd7760 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_sync] +import com.google.cloud.aiplatform.v1beta1.DeletePipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJob { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJob(); + } + + public static void syncDeletePipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeletePipelineJobRequest request = + DeletePipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + pipelineServiceClient.deletePipelineJobAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java new file mode 100644 index 000000000000..7f55289b973d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJobPipelinejobname(); + } + + public static void syncDeletePipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + pipelineServiceClient.deletePipelineJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java new file mode 100644 index 000000000000..7d94d2d0daa8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletepipelinejob/SyncDeletePipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeletePipelineJobString { + + public static void main(String[] args) throws Exception { + syncDeletePipelineJobString(); + } + + public static void syncDeletePipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + pipelineServiceClient.deletePipelineJobAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeletePipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java new file mode 100644 index 000000000000..753771005468 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.longrunning.Operation; + +public class AsyncDeleteTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncDeleteTrainingPipeline(); + } + + public static void asyncDeleteTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.deleteTrainingPipelineCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java new file mode 100644 index 000000000000..9334e61477e4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/AsyncDeleteTrainingPipelineLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTrainingPipelineLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTrainingPipelineLRO(); + } + + public static void asyncDeleteTrainingPipelineLRO() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + OperationFuture future = + pipelineServiceClient.deleteTrainingPipelineOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java new file mode 100644 index 000000000000..3db779a5f5be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipeline(); + } + + public static void syncDeleteTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + DeleteTrainingPipelineRequest request = + DeleteTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + pipelineServiceClient.deleteTrainingPipelineAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java new file mode 100644 index 000000000000..d9450c1ab9fa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipelineString(); + } + + public static void syncDeleteTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + pipelineServiceClient.deleteTrainingPipelineAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..d1d5284b3b63 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/deletetrainingpipeline/SyncDeleteTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; +import com.google.protobuf.Empty; + +public class SyncDeleteTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncDeleteTrainingPipelineTrainingpipelinename(); + } + + public static void syncDeleteTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + pipelineServiceClient.deleteTrainingPipelineAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_DeleteTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..187b6b18b294 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = pipelineServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..aaa373591e66 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = pipelineServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..054fbcc3c73f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = pipelineServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..63ed528c77a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = pipelineServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java new file mode 100644 index 000000000000..da121b165a68 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/AsyncGetPipelineJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetPipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class AsyncGetPipelineJob { + + public static void main(String[] args) throws Exception { + asyncGetPipelineJob(); + } + + public static void asyncGetPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetPipelineJobRequest request = + GetPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + ApiFuture future = + pipelineServiceClient.getPipelineJobCallable().futureCall(request); + // Do something. + PipelineJob response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java new file mode 100644 index 000000000000..b17731306f61 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_sync] +import com.google.cloud.aiplatform.v1beta1.GetPipelineJobRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncGetPipelineJob { + + public static void main(String[] args) throws Exception { + syncGetPipelineJob(); + } + + public static void syncGetPipelineJob() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetPipelineJobRequest request = + GetPipelineJobRequest.newBuilder() + .setName(PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString()) + .build(); + PipelineJob response = pipelineServiceClient.getPipelineJob(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java new file mode 100644 index 000000000000..1293d42e1429 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobPipelinejobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_Pipelinejobname_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncGetPipelineJobPipelinejobname { + + public static void main(String[] args) throws Exception { + syncGetPipelineJobPipelinejobname(); + } + + public static void syncGetPipelineJobPipelinejobname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + PipelineJobName name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]"); + PipelineJob response = pipelineServiceClient.getPipelineJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_Pipelinejobname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java new file mode 100644 index 000000000000..c1b350e9ecb9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/getpipelinejob/SyncGetPipelineJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineJobName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncGetPipelineJobString { + + public static void main(String[] args) throws Exception { + syncGetPipelineJobString(); + } + + public static void syncGetPipelineJobString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = PipelineJobName.of("[PROJECT]", "[LOCATION]", "[PIPELINE_JOB]").toString(); + PipelineJob response = pipelineServiceClient.getPipelineJob(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetPipelineJob_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java new file mode 100644 index 000000000000..81e49d082ce8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/AsyncGetTrainingPipeline.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; + +public class AsyncGetTrainingPipeline { + + public static void main(String[] args) throws Exception { + asyncGetTrainingPipeline(); + } + + public static void asyncGetTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetTrainingPipelineRequest request = + GetTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + ApiFuture future = + pipelineServiceClient.getTrainingPipelineCallable().futureCall(request); + // Do something. + TrainingPipeline response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java new file mode 100644 index 000000000000..e4f3958578fa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipeline.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.GetTrainingPipelineRequest; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; + +public class SyncGetTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipeline(); + } + + public static void syncGetTrainingPipeline() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + GetTrainingPipelineRequest request = + GetTrainingPipelineRequest.newBuilder() + .setName( + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]") + .toString()) + .build(); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java new file mode 100644 index 000000000000..8397b848b87f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_String_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; + +public class SyncGetTrainingPipelineString { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipelineString(); + } + + public static void syncGetTrainingPipelineString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]").toString(); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java new file mode 100644 index 000000000000..fb48931fa2bf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/gettrainingpipeline/SyncGetTrainingPipelineTrainingpipelinename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_Trainingpipelinename_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.cloud.aiplatform.v1beta1.TrainingPipelineName; + +public class SyncGetTrainingPipelineTrainingpipelinename { + + public static void main(String[] args) throws Exception { + syncGetTrainingPipelineTrainingpipelinename(); + } + + public static void syncGetTrainingPipelineTrainingpipelinename() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TrainingPipelineName name = + TrainingPipelineName.of("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); + TrainingPipeline response = pipelineServiceClient.getTrainingPipeline(name); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_GetTrainingPipeline_Trainingpipelinename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..b20549317426 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + pipelineServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..03684e7d2c15 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + pipelineServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..c1bb7eb5fccc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : pipelineServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java new file mode 100644 index 000000000000..4923f78bcc91 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobs.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListPipelineJobs { + + public static void main(String[] args) throws Exception { + asyncListPipelineJobs(); + } + + public static void asyncListPipelineJobs() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.listPipelineJobsPagedCallable().futureCall(request); + // Do something. + for (PipelineJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java new file mode 100644 index 000000000000..d1a2dd74fc3a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/AsyncListPipelineJobsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1beta1.ListPipelineJobsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListPipelineJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListPipelineJobsPaged(); + } + + public static void asyncListPipelineJobsPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListPipelineJobsResponse response = + pipelineServiceClient.listPipelineJobsCallable().call(request); + for (PipelineJob element : response.getPipelineJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java new file mode 100644 index 000000000000..c42cbc7a03ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_sync] +import com.google.cloud.aiplatform.v1beta1.ListPipelineJobsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListPipelineJobs { + + public static void main(String[] args) throws Exception { + syncListPipelineJobs(); + } + + public static void syncListPipelineJobs() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListPipelineJobsRequest request = + ListPipelineJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java new file mode 100644 index 000000000000..415a477981c6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncListPipelineJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListPipelineJobsLocationname(); + } + + public static void syncListPipelineJobsLocationname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java new file mode 100644 index 000000000000..4c985308c167 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listpipelinejobs/SyncListPipelineJobsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineJob; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; + +public class SyncListPipelineJobsString { + + public static void main(String[] args) throws Exception { + syncListPipelineJobsString(); + } + + public static void syncListPipelineJobsString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PipelineJob element : pipelineServiceClient.listPipelineJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListPipelineJobs_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java new file mode 100644 index 000000000000..940706649067 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelines.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.protobuf.FieldMask; + +public class AsyncListTrainingPipelines { + + public static void main(String[] args) throws Exception { + asyncListTrainingPipelines(); + } + + public static void asyncListTrainingPipelines() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + pipelineServiceClient.listTrainingPipelinesPagedCallable().futureCall(request); + // Do something. + for (TrainingPipeline element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java new file mode 100644 index 000000000000..650c057fcc64 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/AsyncListTrainingPipelinesPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1beta1.ListTrainingPipelinesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTrainingPipelinesPaged { + + public static void main(String[] args) throws Exception { + asyncListTrainingPipelinesPaged(); + } + + public static void asyncListTrainingPipelinesPaged() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTrainingPipelinesResponse response = + pipelineServiceClient.listTrainingPipelinesCallable().call(request); + for (TrainingPipeline element : response.getTrainingPipelinesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java new file mode 100644 index 000000000000..015281bdce66 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelines.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_sync] +import com.google.cloud.aiplatform.v1beta1.ListTrainingPipelinesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; +import com.google.protobuf.FieldMask; + +public class SyncListTrainingPipelines { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelines(); + } + + public static void syncListTrainingPipelines() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + ListTrainingPipelinesRequest request = + ListTrainingPipelinesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java new file mode 100644 index 000000000000..6bf4d4a5a224 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class SyncListTrainingPipelinesLocationname { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelinesLocationname(); + } + + public static void syncListTrainingPipelinesLocationname() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java new file mode 100644 index 000000000000..37aff9bebb98 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/listtrainingpipelines/SyncListTrainingPipelinesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.cloud.aiplatform.v1beta1.TrainingPipeline; + +public class SyncListTrainingPipelinesString { + + public static void main(String[] args) throws Exception { + syncListTrainingPipelinesString(); + } + + public static void syncListTrainingPipelinesString() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (TrainingPipeline element : + pipelineServiceClient.listTrainingPipelines(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_ListTrainingPipelines_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..fcff7cc0f4d8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = pipelineServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..076ac694f4ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = pipelineServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..789a395e0e75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + pipelineServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..1bfccbaad348 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PipelineServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (PipelineServiceClient pipelineServiceClient = PipelineServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = pipelineServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_PipelineService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..d7ed4ae468dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/pipelineservicesettings/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PipelineServiceSettings_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.PipelineServiceSettings; +import java.time.Duration; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 + PipelineServiceSettings.Builder pipelineServiceSettingsBuilder = + PipelineServiceSettings.newBuilder(); + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings( + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PipelineServiceSettings pipelineServiceSettings = pipelineServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PipelineServiceSettings_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..9bf3d7a0a7a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + PredictionServiceSettings predictionServiceSettings = + PredictionServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PredictionServiceClient predictionServiceClient = + PredictionServiceClient.create(predictionServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..ba577d5a08a5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + PredictionServiceSettings predictionServiceSettings = + PredictionServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PredictionServiceClient predictionServiceClient = + PredictionServiceClient.create(predictionServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/AsyncExplain.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/AsyncExplain.java new file mode 100644 index 000000000000..69694b93ddd1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/AsyncExplain.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Explain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ExplainRequest; +import com.google.cloud.aiplatform.v1beta1.ExplainResponse; +import com.google.cloud.aiplatform.v1beta1.ExplanationSpecOverride; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class AsyncExplain { + + public static void main(String[] args) throws Exception { + asyncExplain(); + } + + public static void asyncExplain() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ExplainRequest request = + ExplainRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .setExplanationSpecOverride(ExplanationSpecOverride.newBuilder().build()) + .setDeployedModelId("deployedModelId-1817547906") + .build(); + ApiFuture future = + predictionServiceClient.explainCallable().futureCall(request); + // Do something. + ExplainResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Explain_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplain.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplain.java new file mode 100644 index 000000000000..c336b6661f41 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Explain_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ExplainRequest; +import com.google.cloud.aiplatform.v1beta1.ExplainResponse; +import com.google.cloud.aiplatform.v1beta1.ExplanationSpecOverride; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class SyncExplain { + + public static void main(String[] args) throws Exception { + syncExplain(); + } + + public static void syncExplain() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ExplainRequest request = + ExplainRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .setExplanationSpecOverride(ExplanationSpecOverride.newBuilder().build()) + .setDeployedModelId("deployedModelId-1817547906") + .build(); + ExplainResponse response = predictionServiceClient.explain(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Explain_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java new file mode 100644 index 000000000000..6707c9820fba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainEndpointnameListvalueValueString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Explain_EndpointnameListvalueValueString_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ExplainResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncExplainEndpointnameListvalueValueString { + + public static void main(String[] args) throws Exception { + syncExplainEndpointnameListvalueValueString(); + } + + public static void syncExplainEndpointnameListvalueValueString() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + String deployedModelId = "deployedModelId-1817547906"; + ExplainResponse response = + predictionServiceClient.explain(endpoint, instances, parameters, deployedModelId); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Explain_EndpointnameListvalueValueString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainStringListvalueValueString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainStringListvalueValueString.java new file mode 100644 index 000000000000..e7169dc88edd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/explain/SyncExplainStringListvalueValueString.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Explain_StringListvalueValueString_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ExplainResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncExplainStringListvalueValueString { + + public static void main(String[] args) throws Exception { + syncExplainStringListvalueValueString(); + } + + public static void syncExplainStringListvalueValueString() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + String deployedModelId = "deployedModelId-1817547906"; + ExplainResponse response = + predictionServiceClient.explain(endpoint, instances, parameters, deployedModelId); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Explain_StringListvalueValueString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..e6696d192cd8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..94ef0cccd86d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = predictionServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..447bee9ee92c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + predictionServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..969159cde331 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = predictionServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..b0e504806278 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + predictionServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..f4fb239ad28d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + predictionServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..456fe7409b13 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : predictionServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/AsyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/AsyncPredict.java new file mode 100644 index 000000000000..554f11856b4b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/AsyncPredict.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Predict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictRequest; +import com.google.cloud.aiplatform.v1beta1.PredictResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class AsyncPredict { + + public static void main(String[] args) throws Exception { + asyncPredict(); + } + + public static void asyncPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + PredictRequest request = + PredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .build(); + ApiFuture future = + predictionServiceClient.predictCallable().futureCall(request); + // Do something. + PredictResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Predict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredict.java new file mode 100644 index 000000000000..76e1edebe6a5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredict.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Predict_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictRequest; +import com.google.cloud.aiplatform.v1beta1.PredictResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + PredictRequest request = + PredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInstances(new ArrayList()) + .setParameters(Value.newBuilder().setBoolValue(true).build()) + .build(); + PredictResponse response = predictionServiceClient.predict(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java new file mode 100644 index 000000000000..b17a9ca1b8a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictEndpointnameListvalueValue.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Predict_EndpointnameListvalueValue_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncPredictEndpointnameListvalueValue { + + public static void main(String[] args) throws Exception { + syncPredictEndpointnameListvalueValue(); + } + + public static void syncPredictEndpointnameListvalueValue() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + PredictResponse response = predictionServiceClient.predict(endpoint, instances, parameters); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Predict_EndpointnameListvalueValue_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictStringListvalueValue.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictStringListvalueValue.java new file mode 100644 index 000000000000..cf0f6a8120eb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/predict/SyncPredictStringListvalueValue.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_Predict_StringListvalueValue_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictResponse; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.Value; +import java.util.ArrayList; +import java.util.List; + +public class SyncPredictStringListvalueValue { + + public static void main(String[] args) throws Exception { + syncPredictStringListvalueValue(); + } + + public static void syncPredictStringListvalueValue() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + List instances = new ArrayList<>(); + Value parameters = Value.newBuilder().setBoolValue(true).build(); + PredictResponse response = predictionServiceClient.predict(endpoint, instances, parameters); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_Predict_StringListvalueValue_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/AsyncRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/AsyncRawPredict.java new file mode 100644 index 000000000000..140cc3da3fc2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/AsyncRawPredict.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_RawPredict_async] +import com.google.api.HttpBody; +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; + +public class AsyncRawPredict { + + public static void main(String[] args) throws Exception { + asyncRawPredict(); + } + + public static void asyncRawPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + RawPredictRequest request = + RawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setHttpBody(HttpBody.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.rawPredictCallable().futureCall(request); + // Do something. + HttpBody response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_RawPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredict.java new file mode 100644 index 000000000000..bb6e5749da5f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredict.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_RawPredict_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; + +public class SyncRawPredict { + + public static void main(String[] args) throws Exception { + syncRawPredict(); + } + + public static void syncRawPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + RawPredictRequest request = + RawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setHttpBody(HttpBody.newBuilder().build()) + .build(); + HttpBody response = predictionServiceClient.rawPredict(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_RawPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java new file mode 100644 index 000000000000..3dc52aadbb1f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictEndpointnameHttpbody.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_RawPredict_EndpointnameHttpbody_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; + +public class SyncRawPredictEndpointnameHttpbody { + + public static void main(String[] args) throws Exception { + syncRawPredictEndpointnameHttpbody(); + } + + public static void syncRawPredictEndpointnameHttpbody() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + EndpointName endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); + HttpBody httpBody = HttpBody.newBuilder().build(); + HttpBody response = predictionServiceClient.rawPredict(endpoint, httpBody); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_RawPredict_EndpointnameHttpbody_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java new file mode 100644 index 000000000000..1764bd8735c1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/rawpredict/SyncRawPredictStringHttpbody.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_RawPredict_StringHttpbody_sync] +import com.google.api.HttpBody; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; + +public class SyncRawPredictStringHttpbody { + + public static void main(String[] args) throws Exception { + syncRawPredictStringHttpbody(); + } + + public static void syncRawPredictStringHttpbody() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + String endpoint = + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString(); + HttpBody httpBody = HttpBody.newBuilder().build(); + HttpBody response = predictionServiceClient.rawPredict(endpoint, httpBody); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_RawPredict_StringHttpbody_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java new file mode 100644 index 000000000000..b46c33223673 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/serverstreamingpredict/AsyncServerStreamingPredict.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_ServerStreamingPredict_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1beta1.Tensor; +import java.util.ArrayList; + +public class AsyncServerStreamingPredict { + + public static void main(String[] args) throws Exception { + asyncServerStreamingPredict(); + } + + public static void asyncServerStreamingPredict() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + ServerStream stream = + predictionServiceClient.serverStreamingPredictCallable().call(request); + for (StreamingPredictResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_ServerStreamingPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..2ee2d904b725 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = predictionServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..0c3c61bbc2bb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = predictionServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..a5e22cebe1a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + predictionServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..2298cc58a1f2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = predictionServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservicesettings/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservicesettings/predict/SyncPredict.java new file mode 100644 index 000000000000..e763385a10b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservicesettings/predict/SyncPredict.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionServiceSettings_Predict_sync] +import com.google.cloud.aiplatform.v1beta1.PredictionServiceSettings; +import java.time.Duration; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 + PredictionServiceSettings.Builder predictionServiceSettingsBuilder = + PredictionServiceSettings.newBuilder(); + predictionServiceSettingsBuilder + .predictSettings() + .setRetrySettings( + predictionServiceSettingsBuilder + .predictSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PredictionServiceSettings predictionServiceSettings = predictionServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PredictionServiceSettings_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..ee5edd871847 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + ScheduleServiceSettings scheduleServiceSettings = + ScheduleServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ScheduleServiceClient scheduleServiceClient = + ScheduleServiceClient.create(scheduleServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..d588bd95fde6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + ScheduleServiceSettings scheduleServiceSettings = + ScheduleServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ScheduleServiceClient scheduleServiceClient = + ScheduleServiceClient.create(scheduleServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/AsyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/AsyncCreateSchedule.java new file mode 100644 index 000000000000..419bfd97a9fb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/AsyncCreateSchedule.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class AsyncCreateSchedule { + + public static void main(String[] args) throws Exception { + asyncCreateSchedule(); + } + + public static void asyncCreateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSchedule(Schedule.newBuilder().build()) + .build(); + ApiFuture future = + scheduleServiceClient.createScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..3c45dad0da1d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.CreateScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + CreateScheduleRequest request = + CreateScheduleRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSchedule(Schedule.newBuilder().build()) + .build(); + Schedule response = scheduleServiceClient.createSchedule(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java new file mode 100644 index 000000000000..1e7c32cce80a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleLocationnameSchedule.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_LocationnameSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncCreateScheduleLocationnameSchedule { + + public static void main(String[] args) throws Exception { + syncCreateScheduleLocationnameSchedule(); + } + + public static void syncCreateScheduleLocationnameSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Schedule schedule = Schedule.newBuilder().build(); + Schedule response = scheduleServiceClient.createSchedule(parent, schedule); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_LocationnameSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java new file mode 100644 index 000000000000..2f57510bdb26 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/createschedule/SyncCreateScheduleStringSchedule.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_StringSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncCreateScheduleStringSchedule { + + public static void main(String[] args) throws Exception { + syncCreateScheduleStringSchedule(); + } + + public static void syncCreateScheduleStringSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Schedule schedule = Schedule.newBuilder().build(); + Schedule response = scheduleServiceClient.createSchedule(parent, schedule); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_CreateSchedule_StringSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java new file mode 100644 index 000000000000..a21473cc6922 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteSchedule.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteSchedule { + + public static void main(String[] args) throws Exception { + asyncDeleteSchedule(); + } + + public static void asyncDeleteSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = + scheduleServiceClient.deleteScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java new file mode 100644 index 000000000000..093b08045ff0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/AsyncDeleteScheduleLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteScheduleLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteScheduleLRO(); + } + + public static void asyncDeleteScheduleLRO() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + OperationFuture future = + scheduleServiceClient.deleteScheduleOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteSchedule.java new file mode 100644 index 000000000000..426ae13a472b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSchedule { + + public static void main(String[] args) throws Exception { + syncDeleteSchedule(); + } + + public static void syncDeleteSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + DeleteScheduleRequest request = + DeleteScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + scheduleServiceClient.deleteScheduleAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java new file mode 100644 index 000000000000..11a69065a7d1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncDeleteScheduleSchedulename(); + } + + public static void syncDeleteScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.deleteScheduleAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java new file mode 100644 index 000000000000..03478b303688 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/deleteschedule/SyncDeleteScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_String_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteScheduleString { + + public static void main(String[] args) throws Exception { + syncDeleteScheduleString(); + } + + public static void syncDeleteScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.deleteScheduleAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_DeleteSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..fe686d4248ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = scheduleServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..0c3339df467f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = scheduleServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..1e2a675ac468 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = scheduleServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..c86e3fe76972 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = scheduleServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/AsyncGetSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/AsyncGetSchedule.java new file mode 100644 index 000000000000..a208b413a2af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/AsyncGetSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class AsyncGetSchedule { + + public static void main(String[] args) throws Exception { + asyncGetSchedule(); + } + + public static void asyncGetSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetScheduleRequest request = + GetScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = scheduleServiceClient.getScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetSchedule.java new file mode 100644 index 000000000000..7cbb5fcf52fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.GetScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncGetSchedule { + + public static void main(String[] args) throws Exception { + syncGetSchedule(); + } + + public static void syncGetSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + GetScheduleRequest request = + GetScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + Schedule response = scheduleServiceClient.getSchedule(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java new file mode 100644 index 000000000000..911dc3350444 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncGetScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncGetScheduleSchedulename(); + } + + public static void syncGetScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + Schedule response = scheduleServiceClient.getSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleString.java new file mode 100644 index 000000000000..70ce2faa8057 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/getschedule/SyncGetScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_GetSchedule_String_sync] +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncGetScheduleString { + + public static void main(String[] args) throws Exception { + syncGetScheduleString(); + } + + public static void syncGetScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + Schedule response = scheduleServiceClient.getSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_GetSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..d69c94f0d525 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + scheduleServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..3f483034e01b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + scheduleServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..ae0fa7e375a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : scheduleServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedules.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedules.java new file mode 100644 index 000000000000..ab2ccfcc8281 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedules.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListSchedules_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class AsyncListSchedules { + + public static void main(String[] args) throws Exception { + asyncListSchedules(); + } + + public static void asyncListSchedules() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + scheduleServiceClient.listSchedulesPagedCallable().futureCall(request); + // Do something. + for (Schedule element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListSchedules_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedulesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedulesPaged.java new file mode 100644 index 000000000000..2452f34c0f4b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/AsyncListSchedulesPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListSchedules_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1beta1.ListSchedulesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.common.base.Strings; + +public class AsyncListSchedulesPaged { + + public static void main(String[] args) throws Exception { + asyncListSchedulesPaged(); + } + + public static void asyncListSchedulesPaged() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSchedulesResponse response = + scheduleServiceClient.listSchedulesCallable().call(request); + for (Schedule element : response.getSchedulesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListSchedules_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedules.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedules.java new file mode 100644 index 000000000000..36a59de72bab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedules.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListSchedules_sync] +import com.google.cloud.aiplatform.v1beta1.ListSchedulesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncListSchedules { + + public static void main(String[] args) throws Exception { + syncListSchedules(); + } + + public static void syncListSchedules() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ListSchedulesRequest request = + ListSchedulesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + for (Schedule element : scheduleServiceClient.listSchedules(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListSchedules_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesLocationname.java new file mode 100644 index 000000000000..07ad95948eaa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListSchedules_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncListSchedulesLocationname { + + public static void main(String[] args) throws Exception { + syncListSchedulesLocationname(); + } + + public static void syncListSchedulesLocationname() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListSchedules_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesString.java new file mode 100644 index 000000000000..0918f690d188 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/listschedules/SyncListSchedulesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ListSchedules_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; + +public class SyncListSchedulesString { + + public static void main(String[] args) throws Exception { + syncListSchedulesString(); + } + + public static void syncListSchedulesString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Schedule element : scheduleServiceClient.listSchedules(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ListSchedules_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/AsyncPauseSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/AsyncPauseSchedule.java new file mode 100644 index 000000000000..adc7c2942d67 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/AsyncPauseSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncPauseSchedule { + + public static void main(String[] args) throws Exception { + asyncPauseSchedule(); + } + + public static void asyncPauseSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + PauseScheduleRequest request = + PauseScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + ApiFuture future = scheduleServiceClient.pauseScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseSchedule.java new file mode 100644 index 000000000000..947cb5dafbfc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseSchedule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.PauseScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseSchedule { + + public static void main(String[] args) throws Exception { + syncPauseSchedule(); + } + + public static void syncPauseSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + PauseScheduleRequest request = + PauseScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .build(); + scheduleServiceClient.pauseSchedule(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java new file mode 100644 index 000000000000..721f3364d689 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncPauseScheduleSchedulename(); + } + + public static void syncPauseScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.pauseSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleString.java new file mode 100644 index 000000000000..d2b41edc25d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/pauseschedule/SyncPauseScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_String_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncPauseScheduleString { + + public static void main(String[] args) throws Exception { + syncPauseScheduleString(); + } + + public static void syncPauseScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.pauseSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_PauseSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/AsyncResumeSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/AsyncResumeSchedule.java new file mode 100644 index 000000000000..e0a58b837ef2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/AsyncResumeSchedule.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class AsyncResumeSchedule { + + public static void main(String[] args) throws Exception { + asyncResumeSchedule(); + } + + public static void asyncResumeSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setCatchUp(true) + .build(); + ApiFuture future = scheduleServiceClient.resumeScheduleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeSchedule.java new file mode 100644 index 000000000000..2de3db8d4be9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.ResumeScheduleRequest; +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeSchedule { + + public static void main(String[] args) throws Exception { + syncResumeSchedule(); + } + + public static void syncResumeSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ResumeScheduleRequest request = + ResumeScheduleRequest.newBuilder() + .setName(ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString()) + .setCatchUp(true) + .build(); + scheduleServiceClient.resumeSchedule(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java new file mode 100644 index 000000000000..92c621453c63 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_Schedulename_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleSchedulename { + + public static void main(String[] args) throws Exception { + syncResumeScheduleSchedulename(); + } + + public static void syncResumeScheduleSchedulename() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + scheduleServiceClient.resumeSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_Schedulename_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java new file mode 100644 index 000000000000..dae1b1cd475b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleSchedulenameBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_SchedulenameBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleSchedulenameBoolean { + + public static void main(String[] args) throws Exception { + syncResumeScheduleSchedulenameBoolean(); + } + + public static void syncResumeScheduleSchedulenameBoolean() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + ScheduleName name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]"); + boolean catchUp = true; + scheduleServiceClient.resumeSchedule(name, catchUp); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_SchedulenameBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleString.java new file mode 100644 index 000000000000..735f8eecb06d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_String_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleString { + + public static void main(String[] args) throws Exception { + syncResumeScheduleString(); + } + + public static void syncResumeScheduleString() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + scheduleServiceClient.resumeSchedule(name); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java new file mode 100644 index 000000000000..422a1f3151e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/resumeschedule/SyncResumeScheduleStringBoolean.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_StringBoolean_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.Empty; + +public class SyncResumeScheduleStringBoolean { + + public static void main(String[] args) throws Exception { + syncResumeScheduleStringBoolean(); + } + + public static void syncResumeScheduleStringBoolean() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + String name = ScheduleName.of("[PROJECT]", "[LOCATION]", "[SCHEDULE]").toString(); + boolean catchUp = true; + scheduleServiceClient.resumeSchedule(name, catchUp); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_ResumeSchedule_StringBoolean_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..7f5293b8dfa9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = scheduleServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..9f160575d077 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = scheduleServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..a9b22c95270e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + scheduleServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..877963bc10f3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = scheduleServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/AsyncUpdateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/AsyncUpdateSchedule.java new file mode 100644 index 000000000000..c402ac730939 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/AsyncUpdateSchedule.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateScheduleRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSchedule { + + public static void main(String[] args) throws Exception { + asyncUpdateSchedule(); + } + + public static void asyncUpdateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + UpdateScheduleRequest request = + UpdateScheduleRequest.newBuilder() + .setSchedule(Schedule.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + scheduleServiceClient.updateScheduleCallable().futureCall(request); + // Do something. + Schedule response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateSchedule.java new file mode 100644 index 000000000000..1079451e9bbe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateSchedule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateScheduleRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSchedule { + + public static void main(String[] args) throws Exception { + syncUpdateSchedule(); + } + + public static void syncUpdateSchedule() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + UpdateScheduleRequest request = + UpdateScheduleRequest.newBuilder() + .setSchedule(Schedule.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Schedule response = scheduleServiceClient.updateSchedule(request); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java new file mode 100644 index 000000000000..c5eeae8ecb0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservice/updateschedule/SyncUpdateScheduleScheduleFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_ScheduleFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Schedule; +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateScheduleScheduleFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateScheduleScheduleFieldmask(); + } + + public static void syncUpdateScheduleScheduleFieldmask() throws Exception { + // 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 (ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.create()) { + Schedule schedule = Schedule.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Schedule response = scheduleServiceClient.updateSchedule(schedule, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_ScheduleService_UpdateSchedule_ScheduleFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservicesettings/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservicesettings/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..c777cf258810 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/scheduleservicesettings/createschedule/SyncCreateSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_ScheduleServiceSettings_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.ScheduleServiceSettings; +import java.time.Duration; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 + ScheduleServiceSettings.Builder scheduleServiceSettingsBuilder = + ScheduleServiceSettings.newBuilder(); + scheduleServiceSettingsBuilder + .createScheduleSettings() + .setRetrySettings( + scheduleServiceSettingsBuilder + .createScheduleSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ScheduleServiceSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ScheduleServiceSettings_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..52cee2841ef3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + SpecialistPoolServiceSettings specialistPoolServiceSettings = + SpecialistPoolServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create(specialistPoolServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..b7cb4c7af5cd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + SpecialistPoolServiceSettings specialistPoolServiceSettings = + SpecialistPoolServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create(specialistPoolServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java new file mode 100644 index 000000000000..77295d05afc9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncCreateSpecialistPool(); + } + + public static void asyncCreateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.createSpecialistPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java new file mode 100644 index 000000000000..381d27cfb30a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/AsyncCreateSpecialistPoolLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class AsyncCreateSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateSpecialistPoolLRO(); + } + + public static void asyncCreateSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + OperationFuture future = + specialistPoolServiceClient.createSpecialistPoolOperationCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java new file mode 100644 index 000000000000..33771571983b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPool(); + } + + public static void syncCreateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + CreateSpecialistPoolRequest request = + CreateSpecialistPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java new file mode 100644 index 000000000000..5dff5eab9db3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolLocationnameSpecialistpool.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_LocationnameSpecialistpool_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPoolLocationnameSpecialistpool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPoolLocationnameSpecialistpool(); + } + + public static void syncCreateSpecialistPoolLocationnameSpecialistpool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(parent, specialistPool).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_LocationnameSpecialistpool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java new file mode 100644 index 000000000000..18a3aa8aa34a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/createspecialistpool/SyncCreateSpecialistPoolStringSpecialistpool.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_StringSpecialistpool_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncCreateSpecialistPoolStringSpecialistpool { + + public static void main(String[] args) throws Exception { + syncCreateSpecialistPoolStringSpecialistpool(); + } + + public static void syncCreateSpecialistPoolStringSpecialistpool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.createSpecialistPoolAsync(parent, specialistPool).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_CreateSpecialistPool_StringSpecialistpool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java new file mode 100644 index 000000000000..106ff023429d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncDeleteSpecialistPool(); + } + + public static void asyncDeleteSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + ApiFuture future = + specialistPoolServiceClient.deleteSpecialistPoolCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java new file mode 100644 index 000000000000..7e8b78686ea0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/AsyncDeleteSpecialistPoolLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSpecialistPoolLRO(); + } + + public static void asyncDeleteSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + OperationFuture future = + specialistPoolServiceClient.deleteSpecialistPoolOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java new file mode 100644 index 000000000000..451a94df6217 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPool { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPool(); + } + + public static void syncDeleteSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + DeleteSpecialistPoolRequest request = + DeleteSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .setForce(true) + .build(); + specialistPoolServiceClient.deleteSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java new file mode 100644 index 000000000000..f23d8376a907 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolSpecialistpoolname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_Specialistpoolname_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPoolSpecialistpoolname { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPoolSpecialistpoolname(); + } + + public static void syncDeleteSpecialistPoolSpecialistpoolname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPoolName name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"); + specialistPoolServiceClient.deleteSpecialistPoolAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_Specialistpoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java new file mode 100644 index 000000000000..1140094b7f6a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/deletespecialistpool/SyncDeleteSpecialistPoolString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_String_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSpecialistPoolString { + + public static void main(String[] args) throws Exception { + syncDeleteSpecialistPoolString(); + } + + public static void syncDeleteSpecialistPoolString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString(); + specialistPoolServiceClient.deleteSpecialistPoolAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_DeleteSpecialistPool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..5003ecf55574 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..7a091bfa36da --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = specialistPoolServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..71b40132277f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + specialistPoolServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..28b4a0c7240c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getlocation/SyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = specialistPoolServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java new file mode 100644 index 000000000000..8bc7306130f8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/AsyncGetSpecialistPool.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class AsyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncGetSpecialistPool(); + } + + public static void asyncGetSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetSpecialistPoolRequest request = + GetSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .build(); + ApiFuture future = + specialistPoolServiceClient.getSpecialistPoolCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..603ef9507c18 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.GetSpecialistPoolRequest; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + GetSpecialistPoolRequest request = + GetSpecialistPoolRequest.newBuilder() + .setName( + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString()) + .build(); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(request); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java new file mode 100644 index 000000000000..db7e531c6d6b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolSpecialistpoolname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_Specialistpoolname_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPoolSpecialistpoolname { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPoolSpecialistpoolname(); + } + + public static void syncGetSpecialistPoolSpecialistpoolname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPoolName name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(name); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_Specialistpoolname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java new file mode 100644 index 000000000000..b1c3696079cb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/getspecialistpool/SyncGetSpecialistPoolString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_String_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncGetSpecialistPoolString { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPoolString(); + } + + public static void syncGetSpecialistPoolString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String name = + SpecialistPoolName.of("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]").toString(); + SpecialistPool response = specialistPoolServiceClient.getSpecialistPool(name); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_GetSpecialistPool_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..49943df358ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + specialistPoolServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..882e715de760 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + specialistPoolServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..c05a988f4e4b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listlocations/SyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : specialistPoolServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java new file mode 100644 index 000000000000..b59ae42bc34c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPools.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListSpecialistPools { + + public static void main(String[] args) throws Exception { + asyncListSpecialistPools(); + } + + public static void asyncListSpecialistPools() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.listSpecialistPoolsPagedCallable().futureCall(request); + // Do something. + for (SpecialistPool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java new file mode 100644 index 000000000000..1546786d59a8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/AsyncListSpecialistPoolsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListSpecialistPoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListSpecialistPoolsPaged(); + } + + public static void asyncListSpecialistPoolsPaged() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListSpecialistPoolsResponse response = + specialistPoolServiceClient.listSpecialistPoolsCallable().call(request); + for (SpecialistPool element : response.getSpecialistPoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java new file mode 100644 index 000000000000..9c1b3dc09bd7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPools.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_sync] +import com.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListSpecialistPools { + + public static void main(String[] args) throws Exception { + syncListSpecialistPools(); + } + + public static void syncListSpecialistPools() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + ListSpecialistPoolsRequest request = + ListSpecialistPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java new file mode 100644 index 000000000000..510bad18e7dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsLocationname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncListSpecialistPoolsLocationname { + + public static void main(String[] args) throws Exception { + syncListSpecialistPoolsLocationname(); + } + + public static void syncListSpecialistPoolsLocationname() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java new file mode 100644 index 000000000000..a2435fe70d1b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/listspecialistpools/SyncListSpecialistPoolsString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; + +public class SyncListSpecialistPoolsString { + + public static void main(String[] args) throws Exception { + syncListSpecialistPoolsString(); + } + + public static void syncListSpecialistPoolsString() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (SpecialistPool element : + specialistPoolServiceClient.listSpecialistPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_ListSpecialistPools_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..d9a2890d4374 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..6a19543163c9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = specialistPoolServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..69a58e5c05dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + specialistPoolServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..be60409c3df9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = specialistPoolServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java new file mode 100644 index 000000000000..6e29f78f48c0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpecialistPool { + + public static void main(String[] args) throws Exception { + asyncUpdateSpecialistPool(); + } + + public static void asyncUpdateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + specialistPoolServiceClient.updateSpecialistPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java new file mode 100644 index 000000000000..0af9498515fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/AsyncUpdateSpecialistPoolLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpecialistPoolLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateSpecialistPoolLRO(); + } + + public static void asyncUpdateSpecialistPoolLRO() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + specialistPoolServiceClient.updateSpecialistPoolOperationCallable().futureCall(request); + // Do something. + SpecialistPool response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java new file mode 100644 index 000000000000..4e5bb92ea303 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPool.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpecialistPool { + + public static void main(String[] args) throws Exception { + syncUpdateSpecialistPool(); + } + + public static void syncUpdateSpecialistPool() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + UpdateSpecialistPoolRequest request = + UpdateSpecialistPoolRequest.newBuilder() + .setSpecialistPool(SpecialistPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + SpecialistPool response = + specialistPoolServiceClient.updateSpecialistPoolAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java new file mode 100644 index 000000000000..604cfb2ec798 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservice/updatespecialistpool/SyncUpdateSpecialistPoolSpecialistpoolFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_SpecialistpoolFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPool; +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpecialistPoolSpecialistpoolFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSpecialistPoolSpecialistpoolFieldmask(); + } + + public static void syncUpdateSpecialistPoolSpecialistpoolFieldmask() throws Exception { + // 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 (SpecialistPoolServiceClient specialistPoolServiceClient = + SpecialistPoolServiceClient.create()) { + SpecialistPool specialistPool = SpecialistPool.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + SpecialistPool response = + specialistPoolServiceClient.updateSpecialistPoolAsync(specialistPool, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolService_UpdateSpecialistPool_SpecialistpoolFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..5cb27d172cc4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/specialistpoolservicesettings/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolServiceSettings_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceSettings; +import java.time.Duration; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 + SpecialistPoolServiceSettings.Builder specialistPoolServiceSettingsBuilder = + SpecialistPoolServiceSettings.newBuilder(); + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings( + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpecialistPoolServiceSettings specialistPoolServiceSettings = + specialistPoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolServiceSettings_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java new file mode 100644 index 000000000000..9a5227fe57f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/datasetservicestubsettings/getdataset/SyncGetDataset.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_DatasetServiceStubSettings_GetDataset_sync] +import com.google.cloud.aiplatform.v1beta1.stub.DatasetServiceStubSettings; +import java.time.Duration; + +public class SyncGetDataset { + + public static void main(String[] args) throws Exception { + syncGetDataset(); + } + + public static void syncGetDataset() throws Exception { + // 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 + DatasetServiceStubSettings.Builder datasetServiceSettingsBuilder = + DatasetServiceStubSettings.newBuilder(); + datasetServiceSettingsBuilder + .getDatasetSettings() + .setRetrySettings( + datasetServiceSettingsBuilder + .getDatasetSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatasetServiceStubSettings datasetServiceSettings = datasetServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_DatasetServiceStubSettings_GetDataset_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/deploymentresourcepoolservicestubsettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/deploymentresourcepoolservicestubsettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java new file mode 100644 index 000000000000..54462b84ad82 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/deploymentresourcepoolservicestubsettings/getdeploymentresourcepool/SyncGetDeploymentResourcePool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_DeploymentResourcePoolServiceStubSettings_GetDeploymentResourcePool_sync] +import com.google.cloud.aiplatform.v1beta1.stub.DeploymentResourcePoolServiceStubSettings; +import java.time.Duration; + +public class SyncGetDeploymentResourcePool { + + public static void main(String[] args) throws Exception { + syncGetDeploymentResourcePool(); + } + + public static void syncGetDeploymentResourcePool() throws Exception { + // 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 + DeploymentResourcePoolServiceStubSettings.Builder deploymentResourcePoolServiceSettingsBuilder = + DeploymentResourcePoolServiceStubSettings.newBuilder(); + deploymentResourcePoolServiceSettingsBuilder + .getDeploymentResourcePoolSettings() + .setRetrySettings( + deploymentResourcePoolServiceSettingsBuilder + .getDeploymentResourcePoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DeploymentResourcePoolServiceStubSettings deploymentResourcePoolServiceSettings = + deploymentResourcePoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_DeploymentResourcePoolServiceStubSettings_GetDeploymentResourcePool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java new file mode 100644 index 000000000000..d7740e3c55f6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/endpointservicestubsettings/getendpoint/SyncGetEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_EndpointServiceStubSettings_GetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.stub.EndpointServiceStubSettings; +import java.time.Duration; + +public class SyncGetEndpoint { + + public static void main(String[] args) throws Exception { + syncGetEndpoint(); + } + + public static void syncGetEndpoint() throws Exception { + // 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 + EndpointServiceStubSettings.Builder endpointServiceSettingsBuilder = + EndpointServiceStubSettings.newBuilder(); + endpointServiceSettingsBuilder + .getEndpointSettings() + .setRetrySettings( + endpointServiceSettingsBuilder + .getEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EndpointServiceStubSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_EndpointServiceStubSettings_GetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java new file mode 100644 index 000000000000..14134afcd190 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreonlineservingservicestubsettings/readfeaturevalues/SyncReadFeatureValues.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreOnlineServingServiceStubSettings_ReadFeatureValues_sync] +import com.google.cloud.aiplatform.v1beta1.stub.FeaturestoreOnlineServingServiceStubSettings; +import java.time.Duration; + +public class SyncReadFeatureValues { + + public static void main(String[] args) throws Exception { + syncReadFeatureValues(); + } + + public static void syncReadFeatureValues() throws Exception { + // 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 + FeaturestoreOnlineServingServiceStubSettings.Builder + featurestoreOnlineServingServiceSettingsBuilder = + FeaturestoreOnlineServingServiceStubSettings.newBuilder(); + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings( + featurestoreOnlineServingServiceSettingsBuilder + .readFeatureValuesSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreOnlineServingServiceStubSettings featurestoreOnlineServingServiceSettings = + featurestoreOnlineServingServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreOnlineServingServiceStubSettings_ReadFeatureValues_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java new file mode 100644 index 000000000000..1067d756b1d1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/featurestoreservicestubsettings/getfeaturestore/SyncGetFeaturestore.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_FeaturestoreServiceStubSettings_GetFeaturestore_sync] +import com.google.cloud.aiplatform.v1beta1.stub.FeaturestoreServiceStubSettings; +import java.time.Duration; + +public class SyncGetFeaturestore { + + public static void main(String[] args) throws Exception { + syncGetFeaturestore(); + } + + public static void syncGetFeaturestore() throws Exception { + // 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 + FeaturestoreServiceStubSettings.Builder featurestoreServiceSettingsBuilder = + FeaturestoreServiceStubSettings.newBuilder(); + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings( + featurestoreServiceSettingsBuilder + .getFeaturestoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + FeaturestoreServiceStubSettings featurestoreServiceSettings = + featurestoreServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_FeaturestoreServiceStubSettings_GetFeaturestore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java new file mode 100644 index 000000000000..ec0dd8a1d7ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexendpointservicestubsettings/getindexendpoint/SyncGetIndexEndpoint.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_IndexEndpointServiceStubSettings_GetIndexEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.stub.IndexEndpointServiceStubSettings; +import java.time.Duration; + +public class SyncGetIndexEndpoint { + + public static void main(String[] args) throws Exception { + syncGetIndexEndpoint(); + } + + public static void syncGetIndexEndpoint() throws Exception { + // 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 + IndexEndpointServiceStubSettings.Builder indexEndpointServiceSettingsBuilder = + IndexEndpointServiceStubSettings.newBuilder(); + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings( + indexEndpointServiceSettingsBuilder + .getIndexEndpointSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexEndpointServiceStubSettings indexEndpointServiceSettings = + indexEndpointServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_IndexEndpointServiceStubSettings_GetIndexEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexservicestubsettings/getindex/SyncGetIndex.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexservicestubsettings/getindex/SyncGetIndex.java new file mode 100644 index 000000000000..90def3314ca9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/indexservicestubsettings/getindex/SyncGetIndex.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_IndexServiceStubSettings_GetIndex_sync] +import com.google.cloud.aiplatform.v1beta1.stub.IndexServiceStubSettings; +import java.time.Duration; + +public class SyncGetIndex { + + public static void main(String[] args) throws Exception { + syncGetIndex(); + } + + public static void syncGetIndex() throws Exception { + // 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 + IndexServiceStubSettings.Builder indexServiceSettingsBuilder = + IndexServiceStubSettings.newBuilder(); + indexServiceSettingsBuilder + .getIndexSettings() + .setRetrySettings( + indexServiceSettingsBuilder + .getIndexSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + IndexServiceStubSettings indexServiceSettings = indexServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_IndexServiceStubSettings_GetIndex_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java new file mode 100644 index 000000000000..ea54e3abd11f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/jobservicestubsettings/createcustomjob/SyncCreateCustomJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_JobServiceStubSettings_CreateCustomJob_sync] +import com.google.cloud.aiplatform.v1beta1.stub.JobServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCustomJob { + + public static void main(String[] args) throws Exception { + syncCreateCustomJob(); + } + + public static void syncCreateCustomJob() throws Exception { + // 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 + JobServiceStubSettings.Builder jobServiceSettingsBuilder = JobServiceStubSettings.newBuilder(); + jobServiceSettingsBuilder + .createCustomJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder + .createCustomJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceStubSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_JobServiceStubSettings_CreateCustomJob_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java new file mode 100644 index 000000000000..536726b449f4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/matchservicestubsettings/findneighbors/SyncFindNeighbors.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_MatchServiceStubSettings_FindNeighbors_sync] +import com.google.cloud.aiplatform.v1beta1.stub.MatchServiceStubSettings; +import java.time.Duration; + +public class SyncFindNeighbors { + + public static void main(String[] args) throws Exception { + syncFindNeighbors(); + } + + public static void syncFindNeighbors() throws Exception { + // 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 + MatchServiceStubSettings.Builder matchServiceSettingsBuilder = + MatchServiceStubSettings.newBuilder(); + matchServiceSettingsBuilder + .findNeighborsSettings() + .setRetrySettings( + matchServiceSettingsBuilder + .findNeighborsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MatchServiceStubSettings matchServiceSettings = matchServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MatchServiceStubSettings_FindNeighbors_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java new file mode 100644 index 000000000000..9f066cff225a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/metadataservicestubsettings/getmetadatastore/SyncGetMetadataStore.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_MetadataServiceStubSettings_GetMetadataStore_sync] +import com.google.cloud.aiplatform.v1beta1.stub.MetadataServiceStubSettings; +import java.time.Duration; + +public class SyncGetMetadataStore { + + public static void main(String[] args) throws Exception { + syncGetMetadataStore(); + } + + public static void syncGetMetadataStore() throws Exception { + // 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 + MetadataServiceStubSettings.Builder metadataServiceSettingsBuilder = + MetadataServiceStubSettings.newBuilder(); + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings( + metadataServiceSettingsBuilder + .getMetadataStoreSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MetadataServiceStubSettings metadataServiceSettings = metadataServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MetadataServiceStubSettings_GetMetadataStore_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..fc9c0a366609 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/migrationservicestubsettings/getlocation/SyncGetLocation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_MigrationServiceStubSettings_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.stub.MigrationServiceStubSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 + MigrationServiceStubSettings.Builder migrationServiceSettingsBuilder = + MigrationServiceStubSettings.newBuilder(); + migrationServiceSettingsBuilder + .getLocationSettings() + .setRetrySettings( + migrationServiceSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + MigrationServiceStubSettings migrationServiceSettings = migrationServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_MigrationServiceStubSettings_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java new file mode 100644 index 000000000000..cdda75e47614 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelgardenservicestubsettings/getpublishermodel/SyncGetPublisherModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_ModelGardenServiceStubSettings_GetPublisherModel_sync] +import com.google.cloud.aiplatform.v1beta1.stub.ModelGardenServiceStubSettings; +import java.time.Duration; + +public class SyncGetPublisherModel { + + public static void main(String[] args) throws Exception { + syncGetPublisherModel(); + } + + public static void syncGetPublisherModel() throws Exception { + // 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 + ModelGardenServiceStubSettings.Builder modelGardenServiceSettingsBuilder = + ModelGardenServiceStubSettings.newBuilder(); + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .setRetrySettings( + modelGardenServiceSettingsBuilder + .getPublisherModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelGardenServiceStubSettings modelGardenServiceSettings = + modelGardenServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ModelGardenServiceStubSettings_GetPublisherModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelservicestubsettings/getmodel/SyncGetModel.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelservicestubsettings/getmodel/SyncGetModel.java new file mode 100644 index 000000000000..133e883ee45b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/modelservicestubsettings/getmodel/SyncGetModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_ModelServiceStubSettings_GetModel_sync] +import com.google.cloud.aiplatform.v1beta1.stub.ModelServiceStubSettings; +import java.time.Duration; + +public class SyncGetModel { + + public static void main(String[] args) throws Exception { + syncGetModel(); + } + + public static void syncGetModel() throws Exception { + // 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 + ModelServiceStubSettings.Builder modelServiceSettingsBuilder = + ModelServiceStubSettings.newBuilder(); + modelServiceSettingsBuilder + .getModelSettings() + .setRetrySettings( + modelServiceSettingsBuilder + .getModelSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ModelServiceStubSettings modelServiceSettings = modelServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ModelServiceStubSettings_GetModel_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/persistentresourceservicestubsettings/getpersistentresource/SyncGetPersistentResource.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/persistentresourceservicestubsettings/getpersistentresource/SyncGetPersistentResource.java new file mode 100644 index 000000000000..739dbb47e70e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/persistentresourceservicestubsettings/getpersistentresource/SyncGetPersistentResource.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_PersistentResourceServiceStubSettings_GetPersistentResource_sync] +import com.google.cloud.aiplatform.v1beta1.stub.PersistentResourceServiceStubSettings; +import java.time.Duration; + +public class SyncGetPersistentResource { + + public static void main(String[] args) throws Exception { + syncGetPersistentResource(); + } + + public static void syncGetPersistentResource() throws Exception { + // 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 + PersistentResourceServiceStubSettings.Builder persistentResourceServiceSettingsBuilder = + PersistentResourceServiceStubSettings.newBuilder(); + persistentResourceServiceSettingsBuilder + .getPersistentResourceSettings() + .setRetrySettings( + persistentResourceServiceSettingsBuilder + .getPersistentResourceSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PersistentResourceServiceStubSettings persistentResourceServiceSettings = + persistentResourceServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PersistentResourceServiceStubSettings_GetPersistentResource_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java new file mode 100644 index 000000000000..4017c682f8fd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/pipelineservicestubsettings/createtrainingpipeline/SyncCreateTrainingPipeline.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_PipelineServiceStubSettings_CreateTrainingPipeline_sync] +import com.google.cloud.aiplatform.v1beta1.stub.PipelineServiceStubSettings; +import java.time.Duration; + +public class SyncCreateTrainingPipeline { + + public static void main(String[] args) throws Exception { + syncCreateTrainingPipeline(); + } + + public static void syncCreateTrainingPipeline() throws Exception { + // 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 + PipelineServiceStubSettings.Builder pipelineServiceSettingsBuilder = + PipelineServiceStubSettings.newBuilder(); + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings( + pipelineServiceSettingsBuilder + .createTrainingPipelineSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PipelineServiceStubSettings pipelineServiceSettings = pipelineServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PipelineServiceStubSettings_CreateTrainingPipeline_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/predictionservicestubsettings/predict/SyncPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/predictionservicestubsettings/predict/SyncPredict.java new file mode 100644 index 000000000000..6b2481853991 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/predictionservicestubsettings/predict/SyncPredict.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_PredictionServiceStubSettings_Predict_sync] +import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStubSettings; +import java.time.Duration; + +public class SyncPredict { + + public static void main(String[] args) throws Exception { + syncPredict(); + } + + public static void syncPredict() throws Exception { + // 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 + PredictionServiceStubSettings.Builder predictionServiceSettingsBuilder = + PredictionServiceStubSettings.newBuilder(); + predictionServiceSettingsBuilder + .predictSettings() + .setRetrySettings( + predictionServiceSettingsBuilder + .predictSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PredictionServiceStubSettings predictionServiceSettings = + predictionServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_PredictionServiceStubSettings_Predict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java new file mode 100644 index 000000000000..73bb9dcd7ccc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/scheduleservicestubsettings/createschedule/SyncCreateSchedule.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_ScheduleServiceStubSettings_CreateSchedule_sync] +import com.google.cloud.aiplatform.v1beta1.stub.ScheduleServiceStubSettings; +import java.time.Duration; + +public class SyncCreateSchedule { + + public static void main(String[] args) throws Exception { + syncCreateSchedule(); + } + + public static void syncCreateSchedule() throws Exception { + // 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 + ScheduleServiceStubSettings.Builder scheduleServiceSettingsBuilder = + ScheduleServiceStubSettings.newBuilder(); + scheduleServiceSettingsBuilder + .createScheduleSettings() + .setRetrySettings( + scheduleServiceSettingsBuilder + .createScheduleSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ScheduleServiceStubSettings scheduleServiceSettings = scheduleServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_ScheduleServiceStubSettings_CreateSchedule_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java new file mode 100644 index 000000000000..66bde92c91c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/specialistpoolservicestubsettings/getspecialistpool/SyncGetSpecialistPool.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_SpecialistPoolServiceStubSettings_GetSpecialistPool_sync] +import com.google.cloud.aiplatform.v1beta1.stub.SpecialistPoolServiceStubSettings; +import java.time.Duration; + +public class SyncGetSpecialistPool { + + public static void main(String[] args) throws Exception { + syncGetSpecialistPool(); + } + + public static void syncGetSpecialistPool() throws Exception { + // 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 + SpecialistPoolServiceStubSettings.Builder specialistPoolServiceSettingsBuilder = + SpecialistPoolServiceStubSettings.newBuilder(); + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings( + specialistPoolServiceSettingsBuilder + .getSpecialistPoolSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpecialistPoolServiceStubSettings specialistPoolServiceSettings = + specialistPoolServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_SpecialistPoolServiceStubSettings_GetSpecialistPool_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..6d5353ba2fee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/tensorboardservicestubsettings/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_TensorboardServiceStubSettings_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.stub.TensorboardServiceStubSettings; +import java.time.Duration; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 + TensorboardServiceStubSettings.Builder tensorboardServiceSettingsBuilder = + TensorboardServiceStubSettings.newBuilder(); + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .setRetrySettings( + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TensorboardServiceStubSettings tensorboardServiceSettings = + tensorboardServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_TensorboardServiceStubSettings_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..7c664218a75e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/stub/vizierservicestubsettings/createstudy/SyncCreateStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.stub.samples; + +// [START aiplatform_v1beta1_generated_VizierServiceStubSettings_CreateStudy_sync] +import com.google.cloud.aiplatform.v1beta1.stub.VizierServiceStubSettings; +import java.time.Duration; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 + VizierServiceStubSettings.Builder vizierServiceSettingsBuilder = + VizierServiceStubSettings.newBuilder(); + vizierServiceSettingsBuilder + .createStudySettings() + .setRetrySettings( + vizierServiceSettingsBuilder + .createStudySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + VizierServiceStubSettings vizierServiceSettings = vizierServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_VizierServiceStubSettings_CreateStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java new file mode 100644 index 000000000000..6c6debc1ee05 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/AsyncBatchCreateTensorboardRuns.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateTensorboardRuns { + + public static void main(String[] args) throws Exception { + asyncBatchCreateTensorboardRuns(); + } + + public static void asyncBatchCreateTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardRunsRequest request = + BatchCreateTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchCreateTensorboardRunsCallable().futureCall(request); + // Do something. + BatchCreateTensorboardRunsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java new file mode 100644 index 000000000000..0c043d73fde6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRuns.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateTensorboardRuns { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRuns(); + } + + public static void syncBatchCreateTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardRunsRequest request = + BatchCreateTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java new file mode 100644 index 000000000000..c12a5ec86137 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_StringListcreatetensorboardrunrequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest(); + } + + public static void syncBatchCreateTensorboardRunsStringListcreatetensorboardrunrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(parent, requests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_StringListcreatetensorboardrunrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java new file mode 100644 index 000000000000..45a29cabe97e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardruns/SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_TensorboardexperimentnameListcreatetensorboardrunrequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public +class SyncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest(); + } + + public static void + syncBatchCreateTensorboardRunsTensorboardexperimentnameListcreatetensorboardrunrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List requests = new ArrayList<>(); + BatchCreateTensorboardRunsResponse response = + tensorboardServiceClient.batchCreateTensorboardRuns(parent, requests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardRuns_TensorboardexperimentnameListcreatetensorboardrunrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..bd70c3aa6efc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/AsyncBatchCreateTensorboardTimeSeries.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncBatchCreateTensorboardTimeSeries(); + } + + public static void asyncBatchCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardTimeSeriesRequest request = + BatchCreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchCreateTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + BatchCreateTensorboardTimeSeriesResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..f167b319c9ef --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeries.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeries(); + } + + public static void syncBatchCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchCreateTensorboardTimeSeriesRequest request = + BatchCreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllRequests(new ArrayList()) + .build(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java new file mode 100644 index 000000000000..388d728434b7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_StringListcreatetensorboardtimeseriesrequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest(); + } + + public static void + syncBatchCreateTensorboardTimeSeriesStringListcreatetensorboardtimeseriesrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List requests = new ArrayList<>(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(parent, requests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_StringListcreatetensorboardtimeseriesrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java new file mode 100644 index 000000000000..bc143dbb4329 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchcreatetensorboardtimeseries/SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_TensorboardexperimentnameListcreatetensorboardtimeseriesrequest_sync] +import com.google.cloud.aiplatform.v1beta1.BatchCreateTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; +import java.util.List; + +public +class SyncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest { + + public static void main(String[] args) throws Exception { + syncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest(); + } + + public static void + syncBatchCreateTensorboardTimeSeriesTensorboardexperimentnameListcreatetensorboardtimeseriesrequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List requests = new ArrayList<>(); + BatchCreateTensorboardTimeSeriesResponse response = + tensorboardServiceClient.batchCreateTensorboardTimeSeries(parent, requests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchCreateTensorboardTimeSeries_TensorboardexperimentnameListcreatetensorboardtimeseriesrequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..9b1aa899b0ff --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/AsyncBatchReadTensorboardTimeSeriesData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class AsyncBatchReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncBatchReadTensorboardTimeSeriesData(); + } + + public static void asyncBatchReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchReadTensorboardTimeSeriesDataRequest request = + BatchReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .addAllTimeSeries(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.batchReadTensorboardTimeSeriesDataCallable().futureCall(request); + // Do something. + BatchReadTensorboardTimeSeriesDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..0502ea7ad8e9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesData.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import java.util.ArrayList; + +public class SyncBatchReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesData(); + } + + public static void syncBatchReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + BatchReadTensorboardTimeSeriesDataRequest request = + BatchReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .addAllTimeSeries(new ArrayList()) + .build(); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..2ac969560d9f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncBatchReadTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesDataString(); + } + + public static void syncBatchReadTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboard = + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java new file mode 100644 index 000000000000..5c07c1550f7e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/batchreadtensorboardtimeseriesdata/SyncBatchReadTensorboardTimeSeriesDataTensorboardname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.BatchReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncBatchReadTensorboardTimeSeriesDataTensorboardname { + + public static void main(String[] args) throws Exception { + syncBatchReadTensorboardTimeSeriesDataTensorboardname(); + } + + public static void syncBatchReadTensorboardTimeSeriesDataTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName tensorboard = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + BatchReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.batchReadTensorboardTimeSeriesData(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_BatchReadTensorboardTimeSeriesData_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..7dd509cad59c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + TensorboardServiceSettings tensorboardServiceSettings = + TensorboardServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TensorboardServiceClient tensorboardServiceClient = + TensorboardServiceClient.create(tensorboardServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..c4d468e6eec2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + TensorboardServiceSettings tensorboardServiceSettings = + TensorboardServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + TensorboardServiceClient tensorboardServiceClient = + TensorboardServiceClient.create(tensorboardServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java new file mode 100644 index 000000000000..b712f6c39fa0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboard.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateTensorboard { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboard(); + } + + public static void asyncCreateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java new file mode 100644 index 000000000000..8b6f3de69390 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/AsyncCreateTensorboardLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncCreateTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardLRO(); + } + + public static void asyncCreateTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + OperationFuture future = + tensorboardServiceClient.createTensorboardOperationCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java new file mode 100644 index 000000000000..831f71f78baf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboard.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboard(); + } + + public static void syncCreateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRequest request = + CreateTensorboardRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + Tensorboard response = tensorboardServiceClient.createTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java new file mode 100644 index 000000000000..fc049c42cfaf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardStringTensorboard.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_StringTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardStringTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardStringTensorboard(); + } + + public static void syncCreateTensorboardStringTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.createTensorboardAsync(parent, tensorboard).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_StringTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java new file mode 100644 index 000000000000..6a8d8720053a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboard/SyncCreateTensorboardTensorboardnameTensorboard.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_TensorboardnameTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardTensorboardnameTensorboard { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTensorboardnameTensorboard(); + } + + public static void syncCreateTensorboardTensorboardnameTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.createTensorboardAsync(parent, tensorboard).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboard_TensorboardnameTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java new file mode 100644 index 000000000000..c40f6a7558b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/AsyncCreateTensorboardExperiment.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncCreateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardExperiment(); + } + + public static void asyncCreateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardExperimentRequest request = + CreateTensorboardExperimentRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .setTensorboardExperimentId("tensorboardExperimentId1267328197") + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java new file mode 100644 index 000000000000..ccf9e77d0b0a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperiment.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperiment(); + } + + public static void syncCreateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardExperimentRequest request = + CreateTensorboardExperimentRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .setTensorboardExperimentId("tensorboardExperimentId1267328197") + .build(); + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java new file mode 100644 index 000000000000..3579032a5bcf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentStringTensorboardexperimentString.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_StringTensorboardexperimentString_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperimentStringTensorboardexperimentString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperimentStringTensorboardexperimentString(); + } + + public static void syncCreateTensorboardExperimentStringTensorboardexperimentString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + String tensorboardExperimentId = "tensorboardExperimentId1267328197"; + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment( + parent, tensorboardExperiment, tensorboardExperimentId); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_StringTensorboardexperimentString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java new file mode 100644 index 000000000000..e627181dd21e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardexperiment/SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_TensorboardexperimentnameTensorboardexperimentString_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString(); + } + + public static void + syncCreateTensorboardExperimentTensorboardexperimentnameTensorboardexperimentString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + String tensorboardExperimentId = "tensorboardExperimentId1267328197"; + TensorboardExperiment response = + tensorboardServiceClient.createTensorboardExperiment( + parent, tensorboardExperiment, tensorboardExperimentId); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardExperiment_TensorboardexperimentnameTensorboardexperimentString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java new file mode 100644 index 000000000000..2792bafc5234 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/AsyncCreateTensorboardRun.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncCreateTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardRun(); + } + + public static void asyncCreateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRunRequest request = + CreateTensorboardRunRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .setTensorboardRunId("tensorboardRunId-407822631") + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java new file mode 100644 index 000000000000..d259f20ef724 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRun.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardRun { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRun(); + } + + public static void syncCreateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardRunRequest request = + CreateTensorboardRunRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .setTensorboardRunId("tensorboardRunId-407822631") + .build(); + TensorboardRun response = tensorboardServiceClient.createTensorboardRun(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java new file mode 100644 index 000000000000..59346623e812 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunStringTensorboardrunString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_StringTensorboardrunString_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardRunStringTensorboardrunString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRunStringTensorboardrunString(); + } + + public static void syncCreateTensorboardRunStringTensorboardrunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + String tensorboardRunId = "tensorboardRunId-407822631"; + TensorboardRun response = + tensorboardServiceClient.createTensorboardRun(parent, tensorboardRun, tensorboardRunId); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_StringTensorboardrunString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java new file mode 100644 index 000000000000..e1d0f62eb11b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardrun/SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_TensorboardrunnameTensorboardrunString_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncCreateTensorboardRunTensorboardrunnameTensorboardrunString { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardRunTensorboardrunnameTensorboardrunString(); + } + + public static void syncCreateTensorboardRunTensorboardrunnameTensorboardrunString() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName parent = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + String tensorboardRunId = "tensorboardRunId-407822631"; + TensorboardRun response = + tensorboardServiceClient.createTensorboardRun(parent, tensorboardRun, tensorboardRunId); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardRun_TensorboardrunnameTensorboardrunString_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..3d22ba587c59 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/AsyncCreateTensorboardTimeSeries.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class AsyncCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncCreateTensorboardTimeSeries(); + } + + public static void asyncCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardTimeSeriesRequest request = + CreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setTensorboardTimeSeriesId("tensorboardTimeSeriesId-913380692") + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.createTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java new file mode 100644 index 000000000000..d35ffaba23ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeries.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeries(); + } + + public static void syncCreateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + CreateTensorboardTimeSeriesRequest request = + CreateTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setTensorboardTimeSeriesId("tensorboardTimeSeriesId-913380692") + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java new file mode 100644 index 000000000000..3deb4e28f2de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_StringTensorboardtimeseries_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeriesStringTensorboardtimeseries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeriesStringTensorboardtimeseries(); + } + + public static void syncCreateTensorboardTimeSeriesStringTensorboardtimeseries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(parent, tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_StringTensorboardtimeseries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java new file mode 100644 index 000000000000..e11483ac33cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/createtensorboardtimeseries/SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_TensorboardtimeseriesnameTensorboardtimeseries_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries { + + public static void main(String[] args) throws Exception { + syncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries(); + } + + public static void syncCreateTensorboardTimeSeriesTensorboardtimeseriesnameTensorboardtimeseries() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName parent = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.createTensorboardTimeSeries(parent, tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_CreateTensorboardTimeSeries_TensorboardtimeseriesnameTensorboardtimeseries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java new file mode 100644 index 000000000000..903f09566922 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboard { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboard(); + } + + public static void asyncDeleteTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java new file mode 100644 index 000000000000..a85b009ebf8e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/AsyncDeleteTensorboardLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardLRO(); + } + + public static void asyncDeleteTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + OperationFuture future = + tensorboardServiceClient.deleteTensorboardOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java new file mode 100644 index 000000000000..3ce5237b449d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboard.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboard { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboard(); + } + + public static void syncDeleteTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRequest request = + DeleteTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + tensorboardServiceClient.deleteTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java new file mode 100644 index 000000000000..57f404405ee6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardString(); + } + + public static void syncDeleteTensorboardString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + tensorboardServiceClient.deleteTensorboardAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java new file mode 100644 index 000000000000..1685b6348e5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboard/SyncDeleteTensorboardTensorboardname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTensorboardname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTensorboardname(); + } + + public static void syncDeleteTensorboardTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + tensorboardServiceClient.deleteTensorboardAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboard_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java new file mode 100644 index 000000000000..bb0d6908e3d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperiment.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardExperiment(); + } + + public static void asyncDeleteTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardExperimentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java new file mode 100644 index 000000000000..cd55ca4cea4f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/AsyncDeleteTensorboardExperimentLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardExperimentLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardExperimentLRO(); + } + + public static void asyncDeleteTensorboardExperimentLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient + .deleteTensorboardExperimentOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java new file mode 100644 index 000000000000..6db636261dec --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperiment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperiment(); + } + + public static void syncDeleteTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardExperimentRequest request = + DeleteTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardExperimentAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java new file mode 100644 index 000000000000..98cdeb164559 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperimentString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperimentString(); + } + + public static void syncDeleteTensorboardExperimentString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + tensorboardServiceClient.deleteTensorboardExperimentAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java new file mode 100644 index 000000000000..c7f56674fc0c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardexperiment/SyncDeleteTensorboardExperimentTensorboardexperimentname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardExperimentTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardExperimentTensorboardexperimentname(); + } + + public static void syncDeleteTensorboardExperimentTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + tensorboardServiceClient.deleteTensorboardExperimentAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardExperiment_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java new file mode 100644 index 000000000000..55a4932a8453 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRun.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardRun(); + } + + public static void asyncDeleteTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardRunCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java new file mode 100644 index 000000000000..8f448c013874 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/AsyncDeleteTensorboardRunLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardRunLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardRunLRO(); + } + + public static void asyncDeleteTensorboardRunLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient.deleteTensorboardRunOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java new file mode 100644 index 000000000000..8e66f4d5a076 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRun.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRun { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRun(); + } + + public static void syncDeleteTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardRunRequest request = + DeleteTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardRunAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java new file mode 100644 index 000000000000..8b4bf6d87f5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRunString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRunString(); + } + + public static void syncDeleteTensorboardRunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + tensorboardServiceClient.deleteTensorboardRunAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java new file mode 100644 index 000000000000..a2218ac3fcbe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardrun/SyncDeleteTensorboardRunTensorboardrunname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardRunTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardRunTensorboardrunname(); + } + + public static void syncDeleteTensorboardRunTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName name = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + tensorboardServiceClient.deleteTensorboardRunAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardRun_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java new file mode 100644 index 000000000000..4b22c7bcd2a3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.longrunning.Operation; + +public class AsyncDeleteTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardTimeSeries(); + } + + public static void asyncDeleteTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.deleteTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java new file mode 100644 index 000000000000..e8d9f7c6df7c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/AsyncDeleteTensorboardTimeSeriesLRO.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTensorboardTimeSeriesLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteTensorboardTimeSeriesLRO(); + } + + public static void asyncDeleteTensorboardTimeSeriesLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + OperationFuture future = + tensorboardServiceClient + .deleteTensorboardTimeSeriesOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java new file mode 100644 index 000000000000..9fb98c482eba --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeries(); + } + + public static void syncDeleteTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + DeleteTensorboardTimeSeriesRequest request = + DeleteTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..3f979fa93c04 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeriesString(); + } + + public static void syncDeleteTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java new file mode 100644 index 000000000000..70e964548e00 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/deletetensorboardtimeseries/SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.protobuf.Empty; + +public class SyncDeleteTensorboardTimeSeriesTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncDeleteTensorboardTimeSeriesTensorboardtimeseriesname(); + } + + public static void syncDeleteTensorboardTimeSeriesTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName name = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + tensorboardServiceClient.deleteTensorboardTimeSeriesAsync(name).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_DeleteTensorboardTimeSeries_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..6815f874003b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesData.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesDataPoint; + +public class AsyncExportTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncExportTensorboardTimeSeriesData(); + } + + public static void asyncExportTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tensorboardServiceClient + .exportTensorboardTimeSeriesDataPagedCallable() + .futureCall(request); + // Do something. + for (TimeSeriesDataPoint element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java new file mode 100644 index 000000000000..62b636d83d38 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/AsyncExportTensorboardTimeSeriesDataPaged.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.ExportTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesDataPoint; +import com.google.common.base.Strings; + +public class AsyncExportTensorboardTimeSeriesDataPaged { + + public static void main(String[] args) throws Exception { + asyncExportTensorboardTimeSeriesDataPaged(); + } + + public static void asyncExportTensorboardTimeSeriesDataPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ExportTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.exportTensorboardTimeSeriesDataCallable().call(request); + for (TimeSeriesDataPoint element : response.getTimeSeriesDataPointsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..75f75873cae5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesData.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1beta1.ExportTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesData(); + } + + public static void syncExportTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ExportTensorboardTimeSeriesDataRequest request = + ExportTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .build(); + for (TimeSeriesDataPoint element : + tensorboardServiceClient.exportTensorboardTimeSeriesData(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..5f32221f151d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataString.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesDataString(); + } + + public static void syncExportTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + for (TimeSeriesDataPoint element : + tensorboardServiceClient + .exportTensorboardTimeSeriesData(tensorboardTimeSeries) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java new file mode 100644 index 000000000000..aca2f0aab35a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/exporttensorboardtimeseriesdata/SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesDataPoint; + +public class SyncExportTensorboardTimeSeriesDataTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncExportTensorboardTimeSeriesDataTensorboardtimeseriesname(); + } + + public static void syncExportTensorboardTimeSeriesDataTensorboardtimeseriesname() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + for (TimeSeriesDataPoint element : + tensorboardServiceClient + .exportTensorboardTimeSeriesData(tensorboardTimeSeries) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ExportTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..e1d5f1f9d118 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..d49da48e34b1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = tensorboardServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..38d7a9cd6bb1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + tensorboardServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..1b2fef4bb7da --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = tensorboardServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java new file mode 100644 index 000000000000..4e918cf378a6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/AsyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncGetTensorboard { + + public static void main(String[] args) throws Exception { + asyncGetTensorboard(); + } + + public static void asyncGetTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRequest request = + GetTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..ab5b7ba06feb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.GetTensorboardRequest; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRequest request = + GetTensorboardRequest.newBuilder() + .setName(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + Tensorboard response = tensorboardServiceClient.getTensorboard(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java new file mode 100644 index 000000000000..4434e3294f8d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_String_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardString(); + } + + public static void syncGetTensorboardString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + Tensorboard response = tensorboardServiceClient.getTensorboard(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java new file mode 100644 index 000000000000..402d91ff4aa0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboard/SyncGetTensorboardTensorboardname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardTensorboardname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTensorboardname(); + } + + public static void syncGetTensorboardTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName name = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + Tensorboard response = tensorboardServiceClient.getTensorboard(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboard_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java new file mode 100644 index 000000000000..870b746de823 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/AsyncGetTensorboardExperiment.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncGetTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardExperiment(); + } + + public static void asyncGetTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardExperimentRequest request = + GetTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java new file mode 100644 index 000000000000..d43f46ac2b08 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperiment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1beta1.GetTensorboardExperimentRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperiment(); + } + + public static void syncGetTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardExperimentRequest request = + GetTensorboardExperimentRequest.newBuilder() + .setName( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .build(); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java new file mode 100644 index 000000000000..a76883b5633c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardExperimentString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperimentString(); + } + + public static void syncGetTensorboardExperimentString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java new file mode 100644 index 000000000000..aeeb25bccfca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardexperiment/SyncGetTensorboardExperimentTensorboardexperimentname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardExperimentTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardExperimentTensorboardexperimentname(); + } + + public static void syncGetTensorboardExperimentTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName name = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + TensorboardExperiment response = tensorboardServiceClient.getTensorboardExperiment(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardExperiment_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java new file mode 100644 index 000000000000..78ef82418dca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/AsyncGetTensorboardRun.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncGetTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardRun(); + } + + public static void asyncGetTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRunRequest request = + GetTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java new file mode 100644 index 000000000000..eeb18d602d88 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRun.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_sync] +import com.google.cloud.aiplatform.v1beta1.GetTensorboardRunRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardRun { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRun(); + } + + public static void syncGetTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardRunRequest request = + GetTensorboardRunRequest.newBuilder() + .setName( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .build(); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java new file mode 100644 index 000000000000..12f1e7ccb660 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardRunString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRunString(); + } + + public static void syncGetTensorboardRunString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java new file mode 100644 index 000000000000..412e0f2bea2e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardrun/SyncGetTensorboardRunTensorboardrunname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncGetTensorboardRunTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardRunTensorboardrunname(); + } + + public static void syncGetTensorboardRunTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName name = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + TensorboardRun response = tensorboardServiceClient.getTensorboardRun(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardRun_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java new file mode 100644 index 000000000000..3aa112e1597b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/AsyncGetTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class AsyncGetTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncGetTensorboardTimeSeries(); + } + + public static void asyncGetTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardTimeSeriesRequest request = + GetTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.getTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java new file mode 100644 index 000000000000..6b9abe94fa84 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeries.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.GetTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeries(); + } + + public static void syncGetTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + GetTensorboardTimeSeriesRequest request = + GetTensorboardTimeSeriesRequest.newBuilder() + .setName( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .build(); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..2ff6a8be97cc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesString.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeriesString(); + } + + public static void syncGetTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String name = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java new file mode 100644 index 000000000000..18531495abd8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/gettensorboardtimeseries/SyncGetTensorboardTimeSeriesTensorboardtimeseriesname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncGetTensorboardTimeSeriesTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncGetTensorboardTimeSeriesTensorboardtimeseriesname(); + } + + public static void syncGetTensorboardTimeSeriesTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName name = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + TensorboardTimeSeries response = tensorboardServiceClient.getTensorboardTimeSeries(name); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_GetTensorboardTimeSeries_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..380ccbed0157 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + tensorboardServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..adbb6512e552 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + tensorboardServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..36b42b1f3edf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : tensorboardServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java new file mode 100644 index 000000000000..472e98ca806e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperiments.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardExperiments { + + public static void main(String[] args) throws Exception { + asyncListTensorboardExperiments(); + } + + public static void asyncListTensorboardExperiments() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardExperimentsPagedCallable().futureCall(request); + // Do something. + for (TensorboardExperiment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java new file mode 100644 index 000000000000..fa24ccc7e9ea --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/AsyncListTensorboardExperimentsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardExperimentsResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardExperimentsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardExperimentsPaged(); + } + + public static void asyncListTensorboardExperimentsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardExperimentsResponse response = + tensorboardServiceClient.listTensorboardExperimentsCallable().call(request); + for (TensorboardExperiment element : response.getTensorboardExperimentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java new file mode 100644 index 000000000000..e97afe4fc5d4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperiments.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_sync] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardExperimentsRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardExperiments { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperiments(); + } + + public static void syncListTensorboardExperiments() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardExperimentsRequest request = + ListTensorboardExperimentsRequest.newBuilder() + .setParent(TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java new file mode 100644 index 000000000000..990d2cb14602 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardExperimentsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperimentsString(); + } + + public static void syncListTensorboardExperimentsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java new file mode 100644 index 000000000000..a9b89280439a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardexperiments/SyncListTensorboardExperimentsTensorboardname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardExperimentsTensorboardname { + + public static void main(String[] args) throws Exception { + syncListTensorboardExperimentsTensorboardname(); + } + + public static void syncListTensorboardExperimentsTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName parent = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + for (TensorboardExperiment element : + tensorboardServiceClient.listTensorboardExperiments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardExperiments_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java new file mode 100644 index 000000000000..a7cf0ba62bd7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRuns.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardRuns { + + public static void main(String[] args) throws Exception { + asyncListTensorboardRuns(); + } + + public static void asyncListTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardRunsPagedCallable().futureCall(request); + // Do something. + for (TensorboardRun element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java new file mode 100644 index 000000000000..06197c54f796 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/AsyncListTensorboardRunsPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardRunsResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardRunsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardRunsPaged(); + } + + public static void asyncListTensorboardRunsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardRunsResponse response = + tensorboardServiceClient.listTensorboardRunsCallable().call(request); + for (TensorboardRun element : response.getTensorboardRunsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java new file mode 100644 index 000000000000..6469b6dc54c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRuns.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_sync] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardRunsRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardRuns { + + public static void main(String[] args) throws Exception { + syncListTensorboardRuns(); + } + + public static void syncListTensorboardRuns() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardRunsRequest request = + ListTensorboardRunsRequest.newBuilder() + .setParent( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java new file mode 100644 index 000000000000..8ccf1094e337 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardRunsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardRunsString(); + } + + public static void syncListTensorboardRunsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java new file mode 100644 index 000000000000..6e6928aa08d5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardruns/SyncListTensorboardRunsTensorboardexperimentname.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_Tensorboardexperimentname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardRunsTensorboardexperimentname { + + public static void main(String[] args) throws Exception { + syncListTensorboardRunsTensorboardexperimentname(); + } + + public static void syncListTensorboardRunsTensorboardexperimentname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName parent = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + for (TensorboardRun element : + tensorboardServiceClient.listTensorboardRuns(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardRuns_Tensorboardexperimentname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboards.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboards.java new file mode 100644 index 000000000000..468ea29fcee1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboards.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboards { + + public static void main(String[] args) throws Exception { + asyncListTensorboards(); + } + + public static void asyncListTensorboards() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardsPagedCallable().futureCall(request); + // Do something. + for (Tensorboard element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java new file mode 100644 index 000000000000..28e9e04ea095 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/AsyncListTensorboardsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardsResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardsPaged(); + } + + public static void asyncListTensorboardsPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardsResponse response = + tensorboardServiceClient.listTensorboardsCallable().call(request); + for (Tensorboard element : response.getTensorboardsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboards.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboards.java new file mode 100644 index 000000000000..c6b0e182cbfd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboards.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_sync] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardsRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboards { + + public static void main(String[] args) throws Exception { + syncListTensorboards(); + } + + public static void syncListTensorboards() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardsRequest request = + ListTensorboardsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java new file mode 100644 index 000000000000..622beb5985ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardsLocationname { + + public static void main(String[] args) throws Exception { + syncListTensorboardsLocationname(); + } + + public static void syncListTensorboardsLocationname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java new file mode 100644 index 000000000000..5f1b8f426eb8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboards/SyncListTensorboardsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncListTensorboardsString { + + public static void main(String[] args) throws Exception { + syncListTensorboardsString(); + } + + public static void syncListTensorboardsString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Tensorboard element : tensorboardServiceClient.listTensorboards(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboards_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java new file mode 100644 index 000000000000..77b228f1e0a7 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeries.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncListTensorboardTimeSeries(); + } + + public static void asyncListTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.listTensorboardTimeSeriesPagedCallable().futureCall(request); + // Do something. + for (TensorboardTimeSeries element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java new file mode 100644 index 000000000000..407bac2691e3 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/AsyncListTensorboardTimeSeriesPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.ListTensorboardTimeSeriesResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListTensorboardTimeSeriesPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorboardTimeSeriesPaged(); + } + + public static void asyncListTensorboardTimeSeriesPaged() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListTensorboardTimeSeriesResponse response = + tensorboardServiceClient.listTensorboardTimeSeriesCallable().call(request); + for (TensorboardTimeSeries element : response.getTensorboardTimeSeriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java new file mode 100644 index 000000000000..41bc2332d0ab --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeries.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.ListTensorboardTimeSeriesRequest; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class SyncListTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeries(); + } + + public static void syncListTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ListTensorboardTimeSeriesRequest request = + ListTensorboardTimeSeriesRequest.newBuilder() + .setParent( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java new file mode 100644 index 000000000000..08744c173e1b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_String_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; + +public class SyncListTensorboardTimeSeriesString { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeriesString(); + } + + public static void syncListTensorboardTimeSeriesString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String parent = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java new file mode 100644 index 000000000000..7a6ed906d4ad --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/listtensorboardtimeseries/SyncListTensorboardTimeSeriesTensorboardrunname.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_Tensorboardrunname_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; + +public class SyncListTensorboardTimeSeriesTensorboardrunname { + + public static void main(String[] args) throws Exception { + syncListTensorboardTimeSeriesTensorboardrunname(); + } + + public static void syncListTensorboardTimeSeriesTensorboardrunname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName parent = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + for (TensorboardTimeSeries element : + tensorboardServiceClient.listTensorboardTimeSeries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ListTensorboardTimeSeries_Tensorboardrunname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java new file mode 100644 index 000000000000..5c5a949fcc31 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardblobdata/AsyncReadTensorboardBlobData.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardBlobData_async] +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardBlobDataRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardBlobDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; +import java.util.ArrayList; + +public class AsyncReadTensorboardBlobData { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardBlobData(); + } + + public static void asyncReadTensorboardBlobData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardBlobDataRequest request = + ReadTensorboardBlobDataRequest.newBuilder() + .setTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .addAllBlobIds(new ArrayList()) + .build(); + ServerStream stream = + tensorboardServiceClient.readTensorboardBlobDataCallable().call(request); + for (ReadTensorboardBlobDataResponse response : stream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardBlobData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/AsyncReadTensorboardSize.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/AsyncReadTensorboardSize.java new file mode 100644 index 000000000000..93f29565f282 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/AsyncReadTensorboardSize.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncReadTensorboardSize { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardSize(); + } + + public static void asyncReadTensorboardSize() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardSizeRequest request = + ReadTensorboardSizeRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.readTensorboardSizeCallable().futureCall(request); + // Do something. + ReadTensorboardSizeResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSize.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSize.java new file mode 100644 index 000000000000..a98c063f4507 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSize.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardSize { + + public static void main(String[] args) throws Exception { + syncReadTensorboardSize(); + } + + public static void syncReadTensorboardSize() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardSizeRequest request = + ReadTensorboardSizeRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ReadTensorboardSizeResponse response = tensorboardServiceClient.readTensorboardSize(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeString.java new file mode 100644 index 000000000000..88607e194dc5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_String_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardSizeString { + + public static void main(String[] args) throws Exception { + syncReadTensorboardSizeString(); + } + + public static void syncReadTensorboardSizeString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboard = + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + ReadTensorboardSizeResponse response = + tensorboardServiceClient.readTensorboardSize(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeTensorboardname.java new file mode 100644 index 000000000000..b877b13667df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardsize/SyncReadTensorboardSizeTensorboardname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardSizeResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardSizeTensorboardname { + + public static void main(String[] args) throws Exception { + syncReadTensorboardSizeTensorboardname(); + } + + public static void syncReadTensorboardSizeTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName tensorboard = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + ReadTensorboardSizeResponse response = + tensorboardServiceClient.readTensorboardSize(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardSize_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..1172315818d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/AsyncReadTensorboardTimeSeriesData.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class AsyncReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardTimeSeriesData(); + } + + public static void asyncReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardTimeSeriesDataRequest request = + ReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setMaxDataPoints(724001981) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + tensorboardServiceClient.readTensorboardTimeSeriesDataCallable().futureCall(request); + // Do something. + ReadTensorboardTimeSeriesDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java new file mode 100644 index 000000000000..6e666015b5ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesData.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesData { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesData(); + } + + public static void syncReadTensorboardTimeSeriesData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardTimeSeriesDataRequest request = + ReadTensorboardTimeSeriesDataRequest.newBuilder() + .setTensorboardTimeSeries( + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString()) + .setMaxDataPoints(724001981) + .setFilter("filter-1274492040") + .build(); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java new file mode 100644 index 000000000000..a07589e75513 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataString.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_String_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesDataString { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesDataString(); + } + + public static void syncReadTensorboardTimeSeriesDataString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", + "[LOCATION]", + "[TENSORBOARD]", + "[EXPERIMENT]", + "[RUN]", + "[TIME_SERIES]") + .toString(); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java new file mode 100644 index 000000000000..8e9365774caa --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardtimeseriesdata/SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardTimeSeriesDataResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeriesName; + +public class SyncReadTensorboardTimeSeriesDataTensorboardtimeseriesname { + + public static void main(String[] args) throws Exception { + syncReadTensorboardTimeSeriesDataTensorboardtimeseriesname(); + } + + public static void syncReadTensorboardTimeSeriesDataTensorboardtimeseriesname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeriesName tensorboardTimeSeries = + TensorboardTimeSeriesName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]", "[TIME_SERIES]"); + ReadTensorboardTimeSeriesDataResponse response = + tensorboardServiceClient.readTensorboardTimeSeriesData(tensorboardTimeSeries); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardTimeSeriesData_Tensorboardtimeseriesname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java new file mode 100644 index 000000000000..940c8bebff17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/AsyncReadTensorboardUsage.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class AsyncReadTensorboardUsage { + + public static void main(String[] args) throws Exception { + asyncReadTensorboardUsage(); + } + + public static void asyncReadTensorboardUsage() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardUsageRequest request = + ReadTensorboardUsageRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ApiFuture future = + tensorboardServiceClient.readTensorboardUsageCallable().futureCall(request); + // Do something. + ReadTensorboardUsageResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java new file mode 100644 index 000000000000..b1637a09b017 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsage.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageRequest; +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardUsage { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsage(); + } + + public static void syncReadTensorboardUsage() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + ReadTensorboardUsageRequest request = + ReadTensorboardUsageRequest.newBuilder() + .setTensorboard( + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString()) + .build(); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java new file mode 100644 index 000000000000..292407a2fbbc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_String_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardUsageString { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsageString(); + } + + public static void syncReadTensorboardUsageString() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboard = + TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]").toString(); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java new file mode 100644 index 000000000000..e4e826a82aa2 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/readtensorboardusage/SyncReadTensorboardUsageTensorboardname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_Tensorboardname_sync] +import com.google.cloud.aiplatform.v1beta1.ReadTensorboardUsageResponse; +import com.google.cloud.aiplatform.v1beta1.TensorboardName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; + +public class SyncReadTensorboardUsageTensorboardname { + + public static void main(String[] args) throws Exception { + syncReadTensorboardUsageTensorboardname(); + } + + public static void syncReadTensorboardUsageTensorboardname() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardName tensorboard = TensorboardName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]"); + ReadTensorboardUsageResponse response = + tensorboardServiceClient.readTensorboardUsage(tensorboard); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_ReadTensorboardUsage_Tensorboardname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..9633f85c0e5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..aa8ee7474482 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = tensorboardServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..6c087012c339 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..9955436f8ecb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = tensorboardServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java new file mode 100644 index 000000000000..3241ec418a5c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboard.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboard { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboard(); + } + + public static void asyncUpdateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java new file mode 100644 index 000000000000..2264f78bb31d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/AsyncUpdateTensorboardLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardOperationMetadata; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardLRO(); + } + + public static void asyncUpdateTensorboardLRO() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + OperationFuture future = + tensorboardServiceClient.updateTensorboardOperationCallable().futureCall(request); + // Do something. + Tensorboard response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java new file mode 100644 index 000000000000..5b76a6385c75 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboard.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboard { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboard(); + } + + public static void syncUpdateTensorboard() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRequest request = + UpdateTensorboardRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboard(Tensorboard.newBuilder().build()) + .build(); + Tensorboard response = tensorboardServiceClient.updateTensorboardAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java new file mode 100644 index 000000000000..437f78047505 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboard/SyncUpdateTensorboardTensorboardFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_TensorboardFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.Tensorboard; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTensorboardFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTensorboardFieldmask(); + } + + public static void syncUpdateTensorboardTensorboardFieldmask() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + Tensorboard tensorboard = Tensorboard.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Tensorboard response = + tensorboardServiceClient.updateTensorboardAsync(tensorboard, updateMask).get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboard_TensorboardFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java new file mode 100644 index 000000000000..9610161e5a64 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/AsyncUpdateTensorboardExperiment.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardExperimentRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardExperiment(); + } + + public static void asyncUpdateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardExperimentRequest request = + UpdateTensorboardExperimentRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardExperimentCallable().futureCall(request); + // Do something. + TensorboardExperiment response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java new file mode 100644 index 000000000000..39aff8bac6dd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperiment.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardExperimentRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardExperiment { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardExperiment(); + } + + public static void syncUpdateTensorboardExperiment() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardExperimentRequest request = + UpdateTensorboardExperimentRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardExperiment(TensorboardExperiment.newBuilder().build()) + .build(); + TensorboardExperiment response = + tensorboardServiceClient.updateTensorboardExperiment(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java new file mode 100644 index 000000000000..76c2df6787ed --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardexperiment/SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_TensorboardexperimentFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperiment; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardExperimentTensorboardexperimentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardExperimentTensorboardexperimentFieldmask(); + } + + public static void syncUpdateTensorboardExperimentTensorboardexperimentFieldmask() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperiment tensorboardExperiment = TensorboardExperiment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardExperiment response = + tensorboardServiceClient.updateTensorboardExperiment(tensorboardExperiment, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardExperiment_TensorboardexperimentFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java new file mode 100644 index 000000000000..db84508d0407 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/AsyncUpdateTensorboardRun.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardRunRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardRun { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardRun(); + } + + public static void asyncUpdateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRunRequest request = + UpdateTensorboardRunRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardRunCallable().futureCall(request); + // Do something. + TensorboardRun response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java new file mode 100644 index 000000000000..25d662c91431 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRun.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardRunRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardRun { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardRun(); + } + + public static void syncUpdateTensorboardRun() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardRunRequest request = + UpdateTensorboardRunRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardRun(TensorboardRun.newBuilder().build()) + .build(); + TensorboardRun response = tensorboardServiceClient.updateTensorboardRun(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java new file mode 100644 index 000000000000..dbc5d38f8e4c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardrun/SyncUpdateTensorboardRunTensorboardrunFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_TensorboardrunFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRun; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardRunTensorboardrunFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardRunTensorboardrunFieldmask(); + } + + public static void syncUpdateTensorboardRunTensorboardrunFieldmask() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRun tensorboardRun = TensorboardRun.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardRun response = + tensorboardServiceClient.updateTensorboardRun(tensorboardRun, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardRun_TensorboardrunFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java new file mode 100644 index 000000000000..19a0b0502b02 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/AsyncUpdateTensorboardTimeSeries.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardTimeSeriesRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + asyncUpdateTensorboardTimeSeries(); + } + + public static void asyncUpdateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardTimeSeriesRequest request = + UpdateTensorboardTimeSeriesRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + ApiFuture future = + tensorboardServiceClient.updateTensorboardTimeSeriesCallable().futureCall(request); + // Do something. + TensorboardTimeSeries response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java new file mode 100644 index 000000000000..c05420ce3f35 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeries.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.cloud.aiplatform.v1beta1.UpdateTensorboardTimeSeriesRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTimeSeries { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTimeSeries(); + } + + public static void syncUpdateTensorboardTimeSeries() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + UpdateTensorboardTimeSeriesRequest request = + UpdateTensorboardTimeSeriesRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setTensorboardTimeSeries(TensorboardTimeSeries.newBuilder().build()) + .build(); + TensorboardTimeSeries response = + tensorboardServiceClient.updateTensorboardTimeSeries(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java new file mode 100644 index 000000000000..4fb2ecfbda03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/updatetensorboardtimeseries/SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_TensorboardtimeseriesFieldmask_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TensorboardTimeSeries; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask(); + } + + public static void syncUpdateTensorboardTimeSeriesTensorboardtimeseriesFieldmask() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardTimeSeries tensorboardTimeSeries = TensorboardTimeSeries.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + TensorboardTimeSeries response = + tensorboardServiceClient.updateTensorboardTimeSeries(tensorboardTimeSeries, updateMask); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_UpdateTensorboardTimeSeries_TensorboardtimeseriesFieldmask_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java new file mode 100644 index 000000000000..f0e61785722e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/AsyncWriteTensorboardExperimentData.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataRequest; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; + +public class AsyncWriteTensorboardExperimentData { + + public static void main(String[] args) throws Exception { + asyncWriteTensorboardExperimentData(); + } + + public static void asyncWriteTensorboardExperimentData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardExperimentDataRequest request = + WriteTensorboardExperimentDataRequest.newBuilder() + .setTensorboardExperiment( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllWriteRunDataRequests(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.writeTensorboardExperimentDataCallable().futureCall(request); + // Do something. + WriteTensorboardExperimentDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java new file mode 100644 index 000000000000..64a40404d8ce --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataRequest; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; + +public class SyncWriteTensorboardExperimentData { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentData(); + } + + public static void syncWriteTensorboardExperimentData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardExperimentDataRequest request = + WriteTensorboardExperimentDataRequest.newBuilder() + .setTensorboardExperiment( + TensorboardExperimentName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString()) + .addAllWriteRunDataRequests(new ArrayList()) + .build(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java new file mode 100644 index 000000000000..811a510aced5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_StringListwritetensorboardrundatarequest_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest(); + } + + public static void syncWriteTensorboardExperimentDataStringListwritetensorboardrundatarequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardExperiment = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]") + .toString(); + List writeRunDataRequests = new ArrayList<>(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData( + tensorboardExperiment, writeRunDataRequests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_StringListwritetensorboardrundatarequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java new file mode 100644 index 000000000000..b459ac83ff9b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardexperimentdata/SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_TensorboardexperimentnameListwritetensorboardrundatarequest_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardExperimentName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardExperimentDataResponse; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import java.util.ArrayList; +import java.util.List; + +public +class SyncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest(); + } + + public static void + syncWriteTensorboardExperimentDataTensorboardexperimentnameListwritetensorboardrundatarequest() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardExperimentName tensorboardExperiment = + TensorboardExperimentName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]"); + List writeRunDataRequests = new ArrayList<>(); + WriteTensorboardExperimentDataResponse response = + tensorboardServiceClient.writeTensorboardExperimentData( + tensorboardExperiment, writeRunDataRequests); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardExperimentData_TensorboardexperimentnameListwritetensorboardrundatarequest_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java new file mode 100644 index 000000000000..d748a91b8f49 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/AsyncWriteTensorboardRunData.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesData; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; + +public class AsyncWriteTensorboardRunData { + + public static void main(String[] args) throws Exception { + asyncWriteTensorboardRunData(); + } + + public static void asyncWriteTensorboardRunData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardRunDataRequest request = + WriteTensorboardRunDataRequest.newBuilder() + .setTensorboardRun( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .addAllTimeSeriesData(new ArrayList()) + .build(); + ApiFuture future = + tensorboardServiceClient.writeTensorboardRunDataCallable().futureCall(request); + // Do something. + WriteTensorboardRunDataResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java new file mode 100644 index 000000000000..44b2a66a3785 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunData.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesData; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataRequest; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; + +public class SyncWriteTensorboardRunData { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunData(); + } + + public static void syncWriteTensorboardRunData() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + WriteTensorboardRunDataRequest request = + WriteTensorboardRunDataRequest.newBuilder() + .setTensorboardRun( + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString()) + .addAllTimeSeriesData(new ArrayList()) + .build(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(request); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java new file mode 100644 index 000000000000..fd45eb1a2d28 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataStringListtimeseriesdata.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_StringListtimeseriesdata_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesData; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardRunDataStringListtimeseriesdata { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunDataStringListtimeseriesdata(); + } + + public static void syncWriteTensorboardRunDataStringListtimeseriesdata() throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + String tensorboardRun = + TensorboardRunName.of("[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]") + .toString(); + List timeSeriesData = new ArrayList<>(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(tensorboardRun, timeSeriesData); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_StringListtimeseriesdata_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java new file mode 100644 index 000000000000..af0dc23c0f7f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservice/writetensorboardrundata/SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_TensorboardrunnameListtimeseriesdata_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardRunName; +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1beta1.TimeSeriesData; +import com.google.cloud.aiplatform.v1beta1.WriteTensorboardRunDataResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata { + + public static void main(String[] args) throws Exception { + syncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata(); + } + + public static void syncWriteTensorboardRunDataTensorboardrunnameListtimeseriesdata() + throws Exception { + // 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 (TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.create()) { + TensorboardRunName tensorboardRun = + TensorboardRunName.of( + "[PROJECT]", "[LOCATION]", "[TENSORBOARD]", "[EXPERIMENT]", "[RUN]"); + List timeSeriesData = new ArrayList<>(); + WriteTensorboardRunDataResponse response = + tensorboardServiceClient.writeTensorboardRunData(tensorboardRun, timeSeriesData); + } + } +} +// [END aiplatform_v1beta1_generated_TensorboardService_WriteTensorboardRunData_TensorboardrunnameListtimeseriesdata_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java new file mode 100644 index 000000000000..c0f8fb39aabe --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/tensorboardservicesettings/gettensorboard/SyncGetTensorboard.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_TensorboardServiceSettings_GetTensorboard_sync] +import com.google.cloud.aiplatform.v1beta1.TensorboardServiceSettings; +import java.time.Duration; + +public class SyncGetTensorboard { + + public static void main(String[] args) throws Exception { + syncGetTensorboard(); + } + + public static void syncGetTensorboard() throws Exception { + // 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 + TensorboardServiceSettings.Builder tensorboardServiceSettingsBuilder = + TensorboardServiceSettings.newBuilder(); + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .setRetrySettings( + tensorboardServiceSettingsBuilder + .getTensorboardSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TensorboardServiceSettings tensorboardServiceSettings = + tensorboardServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_TensorboardServiceSettings_GetTensorboard_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java new file mode 100644 index 000000000000..062f152d8c32 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/AsyncAddTrialMeasurement.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_AddTrialMeasurement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.AddTrialMeasurementRequest; +import com.google.cloud.aiplatform.v1beta1.Measurement; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncAddTrialMeasurement { + + public static void main(String[] args) throws Exception { + asyncAddTrialMeasurement(); + } + + public static void asyncAddTrialMeasurement() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + AddTrialMeasurementRequest request = + AddTrialMeasurementRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setMeasurement(Measurement.newBuilder().build()) + .build(); + ApiFuture future = + vizierServiceClient.addTrialMeasurementCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_AddTrialMeasurement_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java new file mode 100644 index 000000000000..33432a1b7da1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/addtrialmeasurement/SyncAddTrialMeasurement.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_AddTrialMeasurement_sync] +import com.google.cloud.aiplatform.v1beta1.AddTrialMeasurementRequest; +import com.google.cloud.aiplatform.v1beta1.Measurement; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncAddTrialMeasurement { + + public static void main(String[] args) throws Exception { + syncAddTrialMeasurement(); + } + + public static void syncAddTrialMeasurement() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + AddTrialMeasurementRequest request = + AddTrialMeasurementRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setMeasurement(Measurement.newBuilder().build()) + .build(); + Trial response = vizierServiceClient.addTrialMeasurement(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_AddTrialMeasurement_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java new file mode 100644 index 000000000000..65117333769a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingState.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCheckTrialEarlyStoppingState { + + public static void main(String[] args) throws Exception { + asyncCheckTrialEarlyStoppingState(); + } + + public static void asyncCheckTrialEarlyStoppingState() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = + vizierServiceClient.checkTrialEarlyStoppingStateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java new file mode 100644 index 000000000000..7551c06405e6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/AsyncCheckTrialEarlyStoppingStateLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateMetatdata; +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncCheckTrialEarlyStoppingStateLRO { + + public static void main(String[] args) throws Exception { + asyncCheckTrialEarlyStoppingStateLRO(); + } + + public static void asyncCheckTrialEarlyStoppingStateLRO() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + OperationFuture + future = + vizierServiceClient + .checkTrialEarlyStoppingStateOperationCallable() + .futureCall(request); + // Do something. + CheckTrialEarlyStoppingStateResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java new file mode 100644 index 000000000000..6d2d531ca739 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/checktrialearlystoppingstate/SyncCheckTrialEarlyStoppingState.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_sync] +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateRequest; +import com.google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCheckTrialEarlyStoppingState { + + public static void main(String[] args) throws Exception { + syncCheckTrialEarlyStoppingState(); + } + + public static void syncCheckTrialEarlyStoppingState() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CheckTrialEarlyStoppingStateRequest request = + CheckTrialEarlyStoppingStateRequest.newBuilder() + .setTrialName( + TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + CheckTrialEarlyStoppingStateResponse response = + vizierServiceClient.checkTrialEarlyStoppingStateAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CheckTrialEarlyStoppingState_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/AsyncCompleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/AsyncCompleteTrial.java new file mode 100644 index 000000000000..350b38ce863c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/AsyncCompleteTrial.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CompleteTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CompleteTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Measurement; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncCompleteTrial { + + public static void main(String[] args) throws Exception { + asyncCompleteTrial(); + } + + public static void asyncCompleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CompleteTrialRequest request = + CompleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setFinalMeasurement(Measurement.newBuilder().build()) + .setTrialInfeasible(true) + .setInfeasibleReason("infeasibleReason1040725388") + .build(); + ApiFuture future = vizierServiceClient.completeTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CompleteTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/SyncCompleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/SyncCompleteTrial.java new file mode 100644 index 000000000000..26f769d12c8d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/completetrial/SyncCompleteTrial.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CompleteTrial_sync] +import com.google.cloud.aiplatform.v1beta1.CompleteTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Measurement; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCompleteTrial { + + public static void main(String[] args) throws Exception { + syncCompleteTrial(); + } + + public static void syncCompleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CompleteTrialRequest request = + CompleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .setFinalMeasurement(Measurement.newBuilder().build()) + .setTrialInfeasible(true) + .setInfeasibleReason("infeasibleReason1040725388") + .build(); + Trial response = vizierServiceClient.completeTrial(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CompleteTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetCredentialsProvider.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..48e4ba3ce6ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.aiplatform.v1beta1.VizierServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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 + VizierServiceSettings vizierServiceSettings = + VizierServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_VizierService_Create_SetCredentialsProvider_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetEndpoint.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a2a97be9c576 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_Create_SetEndpoint_sync] +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.aiplatform.v1beta1.VizierServiceSettings; +import com.google.cloud.aiplatform.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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 + VizierServiceSettings vizierServiceSettings = + VizierServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings); + } +} +// [END aiplatform_v1beta1_generated_VizierService_Create_SetEndpoint_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/AsyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/AsyncCreateStudy.java new file mode 100644 index 000000000000..1ce496a85da6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/AsyncCreateStudy.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateStudyRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncCreateStudy { + + public static void main(String[] args) throws Exception { + asyncCreateStudy(); + } + + public static void asyncCreateStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateStudyRequest request = + CreateStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStudy(Study.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.createStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..7d21a5aae66a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateStudy_sync] +import com.google.cloud.aiplatform.v1beta1.CreateStudyRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateStudyRequest request = + CreateStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStudy(Study.newBuilder().build()) + .build(); + Study response = vizierServiceClient.createStudy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java new file mode 100644 index 000000000000..bcf77c7d4609 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyLocationnameStudy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateStudy_LocationnameStudy_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateStudyLocationnameStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudyLocationnameStudy(); + } + + public static void syncCreateStudyLocationnameStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Study study = Study.newBuilder().build(); + Study response = vizierServiceClient.createStudy(parent, study); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateStudy_LocationnameStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyStringStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyStringStudy.java new file mode 100644 index 000000000000..d4c84d40f0be --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createstudy/SyncCreateStudyStringStudy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateStudy_StringStudy_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateStudyStringStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudyStringStudy(); + } + + public static void syncCreateStudyStringStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Study study = Study.newBuilder().build(); + Study response = vizierServiceClient.createStudy(parent, study); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateStudy_StringStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/AsyncCreateTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/AsyncCreateTrial.java new file mode 100644 index 000000000000..6c788499665f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/AsyncCreateTrial.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.CreateTrialRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncCreateTrial { + + public static void main(String[] args) throws Exception { + asyncCreateTrial(); + } + + public static void asyncCreateTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateTrialRequest request = + CreateTrialRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setTrial(Trial.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.createTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrial.java new file mode 100644 index 000000000000..88713e51b1bc --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrial.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateTrial_sync] +import com.google.cloud.aiplatform.v1beta1.CreateTrialRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrial(); + } + + public static void syncCreateTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + CreateTrialRequest request = + CreateTrialRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setTrial(Trial.newBuilder().build()) + .build(); + Trial response = vizierServiceClient.createTrial(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStringTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStringTrial.java new file mode 100644 index 000000000000..0051af96c7c4 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStringTrial.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateTrial_StringTrial_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateTrialStringTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrialStringTrial(); + } + + public static void syncCreateTrialStringTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + Trial trial = Trial.newBuilder().build(); + Trial response = vizierServiceClient.createTrial(parent, trial); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateTrial_StringTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java new file mode 100644 index 000000000000..d33b24e3596a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/createtrial/SyncCreateTrialStudynameTrial.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_CreateTrial_StudynameTrial_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncCreateTrialStudynameTrial { + + public static void main(String[] args) throws Exception { + syncCreateTrialStudynameTrial(); + } + + public static void syncCreateTrialStudynameTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + Trial trial = Trial.newBuilder().build(); + Trial response = vizierServiceClient.createTrial(parent, trial); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_CreateTrial_StudynameTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/AsyncDeleteStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/AsyncDeleteStudy.java new file mode 100644 index 000000000000..b79e42fc0b9c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/AsyncDeleteStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteStudyRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteStudy { + + public static void main(String[] args) throws Exception { + asyncDeleteStudy(); + } + + public static void asyncDeleteStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteStudyRequest request = + DeleteStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = vizierServiceClient.deleteStudyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudy.java new file mode 100644 index 000000000000..c817093fd254 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteStudy_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteStudyRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudy { + + public static void main(String[] args) throws Exception { + syncDeleteStudy(); + } + + public static void syncDeleteStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteStudyRequest request = + DeleteStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + vizierServiceClient.deleteStudy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyString.java new file mode 100644 index 000000000000..753d324eacc6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteStudy_String_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudyString { + + public static void main(String[] args) throws Exception { + syncDeleteStudyString(); + } + + public static void syncDeleteStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + vizierServiceClient.deleteStudy(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java new file mode 100644 index 000000000000..19e127f9bb2c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletestudy/SyncDeleteStudyStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteStudy_Studyname_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteStudyStudyname { + + public static void main(String[] args) throws Exception { + syncDeleteStudyStudyname(); + } + + public static void syncDeleteStudyStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + vizierServiceClient.deleteStudy(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteStudy_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/AsyncDeleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/AsyncDeleteTrial.java new file mode 100644 index 000000000000..58e4951f95d0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/AsyncDeleteTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DeleteTrialRequest; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTrial { + + public static void main(String[] args) throws Exception { + asyncDeleteTrial(); + } + + public static void asyncDeleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteTrialRequest request = + DeleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.deleteTrialCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrial.java new file mode 100644 index 000000000000..ec928b22e24b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteTrial_sync] +import com.google.cloud.aiplatform.v1beta1.DeleteTrialRequest; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrial { + + public static void main(String[] args) throws Exception { + syncDeleteTrial(); + } + + public static void syncDeleteTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + DeleteTrialRequest request = + DeleteTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + vizierServiceClient.deleteTrial(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialString.java new file mode 100644 index 000000000000..4f6af374b1c5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteTrial_String_sync] +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrialString { + + public static void main(String[] args) throws Exception { + syncDeleteTrialString(); + } + + public static void syncDeleteTrialString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); + vizierServiceClient.deleteTrial(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteTrial_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java new file mode 100644 index 000000000000..20e01ebc49d9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/deletetrial/SyncDeleteTrialTrialname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_DeleteTrial_Trialname_sync] +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTrialTrialname { + + public static void main(String[] args) throws Exception { + syncDeleteTrialTrialname(); + } + + public static void syncDeleteTrialTrialname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); + vizierServiceClient.deleteTrial(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_DeleteTrial_Trialname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/AsyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..8434be488fa6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/SyncGetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..e2e282ae9dcd --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = vizierServiceClient.getIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/AsyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..9926d7b2b1af --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = vizierServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetLocation_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/SyncGetLocation.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..b1d2d1804b17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetLocation_sync] +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = vizierServiceClient.getLocation(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetLocation_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/AsyncGetStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/AsyncGetStudy.java new file mode 100644 index 000000000000..419f7d6f84ee --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/AsyncGetStudy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetStudyRequest; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncGetStudy { + + public static void main(String[] args) throws Exception { + asyncGetStudy(); + } + + public static void asyncGetStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetStudyRequest request = + GetStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = vizierServiceClient.getStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudy.java new file mode 100644 index 000000000000..dcd14fe534e5 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetStudy_sync] +import com.google.cloud.aiplatform.v1beta1.GetStudyRequest; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetStudy { + + public static void main(String[] args) throws Exception { + syncGetStudy(); + } + + public static void syncGetStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetStudyRequest request = + GetStudyRequest.newBuilder() + .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + Study response = vizierServiceClient.getStudy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyString.java new file mode 100644 index 000000000000..3193e767a5b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetStudy_String_sync] +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetStudyString { + + public static void main(String[] args) throws Exception { + syncGetStudyString(); + } + + public static void syncGetStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + Study response = vizierServiceClient.getStudy(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyStudyname.java new file mode 100644 index 000000000000..9a748074209a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/getstudy/SyncGetStudyStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetStudy_Studyname_sync] +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetStudyStudyname { + + public static void main(String[] args) throws Exception { + syncGetStudyStudyname(); + } + + public static void syncGetStudyStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + Study response = vizierServiceClient.getStudy(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetStudy_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/AsyncGetTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/AsyncGetTrial.java new file mode 100644 index 000000000000..1f791faad166 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/AsyncGetTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.GetTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncGetTrial { + + public static void main(String[] args) throws Exception { + asyncGetTrial(); + } + + public static void asyncGetTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetTrialRequest request = + GetTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.getTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrial.java new file mode 100644 index 000000000000..8590f006956d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetTrial_sync] +import com.google.cloud.aiplatform.v1beta1.GetTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetTrial { + + public static void main(String[] args) throws Exception { + syncGetTrial(); + } + + public static void syncGetTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + GetTrialRequest request = + GetTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + Trial response = vizierServiceClient.getTrial(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialString.java new file mode 100644 index 000000000000..2d5730d68a6d --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetTrial_String_sync] +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetTrialString { + + public static void main(String[] args) throws Exception { + syncGetTrialString(); + } + + public static void syncGetTrialString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); + Trial response = vizierServiceClient.getTrial(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetTrial_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialTrialname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialTrialname.java new file mode 100644 index 000000000000..7128a87b58da --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/gettrial/SyncGetTrialTrialname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_GetTrial_Trialname_sync] +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncGetTrialTrialname { + + public static void main(String[] args) throws Exception { + syncGetTrialTrialname(); + } + + public static void syncGetTrialTrialname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); + Trial response = vizierServiceClient.getTrial(name); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_GetTrial_Trialname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..ab67817e71cf --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + vizierServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListLocations_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocationsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..3488e5b39d23 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListLocations_Paged_async] +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = vizierServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListLocations_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/SyncListLocations.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..802dc0e033f0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListLocations_sync] +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : vizierServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListLocations_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java new file mode 100644 index 000000000000..24bb76f66f85 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/AsyncListOptimalTrials.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncListOptimalTrials { + + public static void main(String[] args) throws Exception { + asyncListOptimalTrials(); + } + + public static void asyncListOptimalTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListOptimalTrialsRequest request = + ListOptimalTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ApiFuture future = + vizierServiceClient.listOptimalTrialsCallable().futureCall(request); + // Do something. + ListOptimalTrialsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java new file mode 100644 index 000000000000..8ce429d0f6b6 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrials.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_sync] +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListOptimalTrials { + + public static void main(String[] args) throws Exception { + syncListOptimalTrials(); + } + + public static void syncListOptimalTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListOptimalTrialsRequest request = + ListOptimalTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .build(); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java new file mode 100644 index 000000000000..0a16ae3cb367 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_String_sync] +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListOptimalTrialsString { + + public static void main(String[] args) throws Exception { + syncListOptimalTrialsString(); + } + + public static void syncListOptimalTrialsString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java new file mode 100644 index 000000000000..7dcd0e988cb8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listoptimaltrials/SyncListOptimalTrialsStudyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_Studyname_sync] +import com.google.cloud.aiplatform.v1beta1.ListOptimalTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListOptimalTrialsStudyname { + + public static void main(String[] args) throws Exception { + syncListOptimalTrialsStudyname(); + } + + public static void syncListOptimalTrialsStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListOptimalTrials_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudies.java new file mode 100644 index 000000000000..ff989f82c332 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudies.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListStudies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncListStudies { + + public static void main(String[] args) throws Exception { + asyncListStudies(); + } + + public static void asyncListStudies() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = vizierServiceClient.listStudiesPagedCallable().futureCall(request); + // Do something. + for (Study element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListStudies_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudiesPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudiesPaged.java new file mode 100644 index 000000000000..5ccdd7c11f9b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/AsyncListStudiesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListStudies_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1beta1.ListStudiesResponse; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.common.base.Strings; + +public class AsyncListStudiesPaged { + + public static void main(String[] args) throws Exception { + asyncListStudiesPaged(); + } + + public static void asyncListStudiesPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListStudiesResponse response = vizierServiceClient.listStudiesCallable().call(request); + for (Study element : response.getStudiesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListStudies_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudies.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudies.java new file mode 100644 index 000000000000..8e9fa57248c9 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudies.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListStudies_sync] +import com.google.cloud.aiplatform.v1beta1.ListStudiesRequest; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListStudies { + + public static void main(String[] args) throws Exception { + syncListStudies(); + } + + public static void syncListStudies() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListStudiesRequest request = + ListStudiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Study element : vizierServiceClient.listStudies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListStudies_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesLocationname.java new file mode 100644 index 000000000000..12cc54231077 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListStudies_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListStudiesLocationname { + + public static void main(String[] args) throws Exception { + syncListStudiesLocationname(); + } + + public static void syncListStudiesLocationname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListStudies_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesString.java new file mode 100644 index 000000000000..5f1c22a97f23 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/liststudies/SyncListStudiesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListStudies_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListStudiesString { + + public static void main(String[] args) throws Exception { + syncListStudiesString(); + } + + public static void syncListStudiesString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListStudies_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrials.java new file mode 100644 index 000000000000..a2dc2ec5cf5b --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrials.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncListTrials { + + public static void main(String[] args) throws Exception { + asyncListTrials(); + } + + public static void asyncListTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = vizierServiceClient.listTrialsPagedCallable().futureCall(request); + // Do something. + for (Trial element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrialsPaged.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrialsPaged.java new file mode 100644 index 000000000000..f5d019fa2bca --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/AsyncListTrialsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListTrials_Paged_async] +import com.google.cloud.aiplatform.v1beta1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.ListTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTrialsPaged { + + public static void main(String[] args) throws Exception { + asyncListTrialsPaged(); + } + + public static void asyncListTrialsPaged() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListTrialsResponse response = vizierServiceClient.listTrialsCallable().call(request); + for (Trial element : response.getTrialsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListTrials_Paged_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrials.java new file mode 100644 index 000000000000..e5b2b16fca2a --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrials.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListTrials_sync] +import com.google.cloud.aiplatform.v1beta1.ListTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListTrials { + + public static void main(String[] args) throws Exception { + syncListTrials(); + } + + public static void syncListTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + ListTrialsRequest request = + ListTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Trial element : vizierServiceClient.listTrials(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsString.java new file mode 100644 index 000000000000..27365688fb17 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListTrials_String_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListTrialsString { + + public static void main(String[] args) throws Exception { + syncListTrialsString(); + } + + public static void syncListTrialsString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); + for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListTrials_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsStudyname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsStudyname.java new file mode 100644 index 000000000000..e6c21ee461e8 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/listtrials/SyncListTrialsStudyname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_ListTrials_Studyname_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncListTrialsStudyname { + + public static void main(String[] args) throws Exception { + syncListTrialsStudyname(); + } + + public static void syncListTrialsStudyname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); + for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_ListTrials_Studyname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/AsyncLookupStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/AsyncLookupStudy.java new file mode 100644 index 000000000000..90d3c112bfe0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/AsyncLookupStudy.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_LookupStudy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.LookupStudyRequest; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncLookupStudy { + + public static void main(String[] args) throws Exception { + asyncLookupStudy(); + } + + public static void asyncLookupStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LookupStudyRequest request = + LookupStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDisplayName("displayName1714148973") + .build(); + ApiFuture future = vizierServiceClient.lookupStudyCallable().futureCall(request); + // Do something. + Study response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_LookupStudy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudy.java new file mode 100644 index 000000000000..4c3a353df262 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_LookupStudy_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.LookupStudyRequest; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncLookupStudy { + + public static void main(String[] args) throws Exception { + syncLookupStudy(); + } + + public static void syncLookupStudy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LookupStudyRequest request = + LookupStudyRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDisplayName("displayName1714148973") + .build(); + Study response = vizierServiceClient.lookupStudy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_LookupStudy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java new file mode 100644 index 000000000000..65c6812e6e03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_LookupStudy_Locationname_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncLookupStudyLocationname { + + public static void main(String[] args) throws Exception { + syncLookupStudyLocationname(); + } + + public static void syncLookupStudyLocationname() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Study response = vizierServiceClient.lookupStudy(parent); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_LookupStudy_Locationname_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyString.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyString.java new file mode 100644 index 000000000000..6f78248e2d22 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/lookupstudy/SyncLookupStudyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_LookupStudy_String_sync] +import com.google.cloud.aiplatform.v1beta1.LocationName; +import com.google.cloud.aiplatform.v1beta1.Study; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncLookupStudyString { + + public static void main(String[] args) throws Exception { + syncLookupStudyString(); + } + + public static void syncLookupStudyString() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Study response = vizierServiceClient.lookupStudy(parent); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_LookupStudy_String_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/AsyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..4201b6d8b78c --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = vizierServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_SetIamPolicy_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/SyncSetIamPolicy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..8ebe0000facb --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_SetIamPolicy_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = vizierServiceClient.setIamPolicy(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_SetIamPolicy_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/AsyncStopTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/AsyncStopTrial.java new file mode 100644 index 000000000000..44fa85aa9f22 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/AsyncStopTrial.java @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_StopTrial_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.StopTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncStopTrial { + + public static void main(String[] args) throws Exception { + asyncStopTrial(); + } + + public static void asyncStopTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StopTrialRequest request = + StopTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + ApiFuture future = vizierServiceClient.stopTrialCallable().futureCall(request); + // Do something. + Trial response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_StopTrial_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/SyncStopTrial.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/SyncStopTrial.java new file mode 100644 index 000000000000..280d99566c13 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/stoptrial/SyncStopTrial.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_StopTrial_sync] +import com.google.cloud.aiplatform.v1beta1.StopTrialRequest; +import com.google.cloud.aiplatform.v1beta1.Trial; +import com.google.cloud.aiplatform.v1beta1.TrialName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncStopTrial { + + public static void main(String[] args) throws Exception { + syncStopTrial(); + } + + public static void syncStopTrial() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + StopTrialRequest request = + StopTrialRequest.newBuilder() + .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) + .build(); + Trial response = vizierServiceClient.stopTrial(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_StopTrial_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrials.java new file mode 100644 index 000000000000..94927aea7ef0 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrials.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_SuggestTrials_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.longrunning.Operation; + +public class AsyncSuggestTrials { + + public static void main(String[] args) throws Exception { + asyncSuggestTrials(); + } + + public static void asyncSuggestTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + ApiFuture future = vizierServiceClient.suggestTrialsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_SuggestTrials_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java new file mode 100644 index 000000000000..e6b78c8f56f1 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/AsyncSuggestTrialsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_SuggestTrials_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsMetadata; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class AsyncSuggestTrialsLRO { + + public static void main(String[] args) throws Exception { + asyncSuggestTrialsLRO(); + } + + public static void asyncSuggestTrialsLRO() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + OperationFuture future = + vizierServiceClient.suggestTrialsOperationCallable().futureCall(request); + // Do something. + SuggestTrialsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_SuggestTrials_LRO_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/SyncSuggestTrials.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/SyncSuggestTrials.java new file mode 100644 index 000000000000..d92edc551486 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/suggesttrials/SyncSuggestTrials.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_SuggestTrials_sync] +import com.google.cloud.aiplatform.v1beta1.StudyName; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsRequest; +import com.google.cloud.aiplatform.v1beta1.SuggestTrialsResponse; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; + +public class SyncSuggestTrials { + + public static void main(String[] args) throws Exception { + syncSuggestTrials(); + } + + public static void syncSuggestTrials() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + SuggestTrialsRequest request = + SuggestTrialsRequest.newBuilder() + .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) + .setSuggestionCount(390130452) + .setClientId("clientId908408390") + .build(); + SuggestTrialsResponse response = vizierServiceClient.suggestTrialsAsync(request).get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_SuggestTrials_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/AsyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..3c6e5e49752f --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + vizierServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_TestIamPermissions_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/SyncTestIamPermissions.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..bc5b17db1091 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservice/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierService_TestIamPermissions_sync] +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.VizierServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = vizierServiceClient.testIamPermissions(request); + } + } +} +// [END aiplatform_v1beta1_generated_VizierService_TestIamPermissions_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservicesettings/createstudy/SyncCreateStudy.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservicesettings/createstudy/SyncCreateStudy.java new file mode 100644 index 000000000000..209fcffaa241 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/vizierservicesettings/createstudy/SyncCreateStudy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_VizierServiceSettings_CreateStudy_sync] +import com.google.cloud.aiplatform.v1beta1.VizierServiceSettings; +import java.time.Duration; + +public class SyncCreateStudy { + + public static void main(String[] args) throws Exception { + syncCreateStudy(); + } + + public static void syncCreateStudy() throws Exception { + // 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 + VizierServiceSettings.Builder vizierServiceSettingsBuilder = VizierServiceSettings.newBuilder(); + vizierServiceSettingsBuilder + .createStudySettings() + .setRetrySettings( + vizierServiceSettingsBuilder + .createStudySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + VizierServiceSettings vizierServiceSettings = vizierServiceSettingsBuilder.build(); + } +} +// [END aiplatform_v1beta1_generated_VizierServiceSettings_CreateStudy_sync]