diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/AutoMlClient.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/AutoMlClient.java index 94cf4cc87..cea5d32db 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/AutoMlClient.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/AutoMlClient.java @@ -59,6 +59,13 @@ *

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
+ * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+ *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
+ *   Dataset response = autoMlClient.getDataset(name);
+ * }
+ * }
+ * *

Note: close() needs to be called on the AutoMlClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -170,6 +177,16 @@ public final OperationsClient getOperationsClient() { /** * Creates a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Dataset dataset = Dataset.newBuilder().build();
+   *   Dataset response = autoMlClient.createDatasetAsync(parent, dataset).get();
+   * }
+   * }
+ * * @param parent Required. The resource name of the project to create the dataset for. * @param dataset Required. The dataset to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -188,6 +205,16 @@ public final OperationFuture createDatasetAsync( /** * Creates a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Dataset dataset = Dataset.newBuilder().build();
+   *   Dataset response = autoMlClient.createDatasetAsync(parent, dataset).get();
+   * }
+   * }
+ * * @param parent Required. The resource name of the project to create the dataset for. * @param dataset Required. The dataset to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -203,6 +230,19 @@ public final OperationFuture createDatasetAsync( /** * Creates a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateDatasetRequest request =
+   *       CreateDatasetRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setDataset(Dataset.newBuilder().build())
+   *           .build();
+   *   Dataset response = autoMlClient.createDatasetAsync(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 */ @@ -216,6 +256,20 @@ public final OperationFuture createDatasetAsync( * Creates a dataset. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateDatasetRequest request =
+   *       CreateDatasetRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setDataset(Dataset.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.createDatasetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Dataset response = future.get();
+   * }
+   * }
*/ public final OperationCallable createDatasetOperationCallable() { @@ -227,6 +281,19 @@ public final OperationFuture createDatasetAsync( * Creates a dataset. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateDatasetRequest request =
+   *       CreateDatasetRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setDataset(Dataset.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.createDatasetCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createDatasetCallable() { return stub.createDatasetCallable(); @@ -236,6 +303,15 @@ public final UnaryCallable createDatasetCallabl /** * Gets a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
+   *   Dataset response = autoMlClient.getDataset(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -249,6 +325,15 @@ public final Dataset getDataset(DatasetName name) { /** * Gets a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
+   *   Dataset response = autoMlClient.getDataset(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -261,6 +346,18 @@ public final Dataset getDataset(String name) { /** * Gets a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetDatasetRequest request =
+   *       GetDatasetRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .build();
+   *   Dataset response = autoMlClient.getDataset(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 */ @@ -273,6 +370,18 @@ public final Dataset getDataset(GetDatasetRequest request) { * Gets a dataset. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetDatasetRequest request =
+   *       GetDatasetRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.getDatasetCallable().futureCall(request);
+   *   // Do something.
+   *   Dataset response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getDatasetCallable() { return stub.getDatasetCallable(); @@ -282,6 +391,17 @@ public final UnaryCallable getDatasetCallable() { /** * Lists datasets in a project. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name of the project from which to list datasets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -297,6 +417,17 @@ public final ListDatasetsPagedResponse listDatasets(LocationName parent) { /** * Lists datasets in a project. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name of the project from which to list datasets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -309,6 +440,23 @@ public final ListDatasetsPagedResponse listDatasets(String parent) { /** * Lists datasets in a project. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListDatasetsRequest request =
+   *       ListDatasetsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Dataset element : autoMlClient.listDatasets(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 */ @@ -321,6 +469,23 @@ public final ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) * Lists datasets in a project. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListDatasetsRequest request =
+   *       ListDatasetsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = autoMlClient.listDatasetsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Dataset element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listDatasetsPagedCallable() { @@ -332,6 +497,23 @@ public final ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) * Lists datasets in a project. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   while (true) {
+   *     ListDatasetsResponse response = autoMlClient.listDatasetsCallable().call(request);
+   *     for (Dataset element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listDatasetsCallable() { return stub.listDatasetsCallable(); @@ -341,6 +523,16 @@ public final UnaryCallable listDatase /** * Updates a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   Dataset dataset = Dataset.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Dataset response = autoMlClient.updateDataset(dataset, updateMask);
+   * }
+   * }
+ * * @param dataset Required. The dataset which replaces the resource on the server. * @param updateMask Required. The update mask applies to the resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -355,6 +547,19 @@ public final Dataset updateDataset(Dataset dataset, FieldMask updateMask) { /** * Updates a dataset. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UpdateDatasetRequest request =
+   *       UpdateDatasetRequest.newBuilder()
+   *           .setDataset(Dataset.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Dataset response = autoMlClient.updateDataset(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 */ @@ -367,6 +572,19 @@ public final Dataset updateDataset(UpdateDatasetRequest request) { * Updates a dataset. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UpdateDatasetRequest request =
+   *       UpdateDatasetRequest.newBuilder()
+   *           .setDataset(Dataset.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.updateDatasetCallable().futureCall(request);
+   *   // Do something.
+   *   Dataset response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateDatasetCallable() { return stub.updateDatasetCallable(); @@ -378,6 +596,15 @@ public final UnaryCallable updateDatasetCallable( * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
+   *   autoMlClient.deleteDatasetAsync(name).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -393,6 +620,15 @@ public final OperationFuture deleteDatasetAsync(Datase * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
+   *   autoMlClient.deleteDatasetAsync(name).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -407,6 +643,18 @@ public final OperationFuture deleteDatasetAsync(String * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteDatasetRequest request =
+   *       DeleteDatasetRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .build();
+   *   autoMlClient.deleteDatasetAsync(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 */ @@ -422,6 +670,19 @@ public final OperationFuture deleteDatasetAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteDatasetRequest request =
+   *       DeleteDatasetRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.deleteDatasetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable deleteDatasetOperationCallable() { @@ -435,6 +696,18 @@ public final OperationFuture deleteDatasetAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteDatasetRequest request =
+   *       DeleteDatasetRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.deleteDatasetCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteDatasetCallable() { return stub.deleteDatasetCallable(); @@ -452,6 +725,16 @@ public final UnaryCallable deleteDatasetCallabl * [response][google.longrunning.Operation.response] field when it completes. * * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
+   *   InputConfig inputConfig = InputConfig.newBuilder().build();
+   *   autoMlClient.importDataAsync(name, inputConfig).get();
+   * }
+   * }
+ * * @param name Required. Dataset name. Dataset must already exist. All imported annotations and * examples will be added. * @param inputConfig Required. The desired input location and its domain specific semantics, if @@ -480,6 +763,16 @@ public final OperationFuture importDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
+   *   InputConfig inputConfig = InputConfig.newBuilder().build();
+   *   autoMlClient.importDataAsync(name, inputConfig).get();
+   * }
+   * }
+ * * @param name Required. Dataset name. Dataset must already exist. All imported annotations and * examples will be added. * @param inputConfig Required. The desired input location and its domain specific semantics, if @@ -505,6 +798,19 @@ public final OperationFuture importDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ImportDataRequest request =
+   *       ImportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setInputConfig(InputConfig.newBuilder().build())
+   *           .build();
+   *   autoMlClient.importDataAsync(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 */ @@ -526,6 +832,20 @@ public final OperationFuture importDataAsync( * * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ImportDataRequest request =
+   *       ImportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setInputConfig(InputConfig.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.importDataOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable importDataOperationCallable() { @@ -545,6 +865,19 @@ public final OperationFuture importDataAsync( * * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ImportDataRequest request =
+   *       ImportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setInputConfig(InputConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.importDataCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable importDataCallable() { return stub.importDataCallable(); @@ -555,6 +888,16 @@ public final UnaryCallable importDataCallable() { * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
+   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *   autoMlClient.exportDataAsync(name, outputConfig).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset. * @param outputConfig Required. The desired output location. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -574,6 +917,16 @@ public final OperationFuture exportDataAsync( * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
+   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *   autoMlClient.exportDataAsync(name, outputConfig).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the dataset. * @param outputConfig Required. The desired output location. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -590,6 +943,19 @@ public final OperationFuture exportDataAsync( * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportDataRequest request =
+   *       ExportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setOutputConfig(OutputConfig.newBuilder().build())
+   *           .build();
+   *   autoMlClient.exportDataAsync(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 */ @@ -604,6 +970,20 @@ public final OperationFuture exportDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportDataRequest request =
+   *       ExportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setOutputConfig(OutputConfig.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.exportDataOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable exportDataOperationCallable() { @@ -616,6 +996,19 @@ public final OperationFuture exportDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportDataRequest request =
+   *       ExportDataRequest.newBuilder()
+   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
+   *           .setOutputConfig(OutputConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.exportDataCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable exportDataCallable() { return stub.exportDataCallable(); @@ -625,6 +1018,16 @@ public final UnaryCallable exportDataCallable() { /** * Gets an annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   AnnotationSpecName name =
+   *       AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]");
+   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the annotation spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -640,6 +1043,17 @@ public final AnnotationSpec getAnnotationSpec(AnnotationSpecName name) { /** * Gets an annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name =
+   *       AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
+   *           .toString();
+   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the annotation spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -652,6 +1066,20 @@ public final AnnotationSpec getAnnotationSpec(String name) { /** * Gets an annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetAnnotationSpecRequest request =
+   *       GetAnnotationSpecRequest.newBuilder()
+   *           .setName(
+   *               AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
+   *                   .toString())
+   *           .build();
+   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(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 */ @@ -664,6 +1092,21 @@ public final AnnotationSpec getAnnotationSpec(GetAnnotationSpecRequest request) * Gets an annotation spec. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetAnnotationSpecRequest request =
+   *       GetAnnotationSpecRequest.newBuilder()
+   *           .setName(
+   *               AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future =
+   *       autoMlClient.getAnnotationSpecCallable().futureCall(request);
+   *   // Do something.
+   *   AnnotationSpec response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getAnnotationSpecCallable() { return stub.getAnnotationSpecCallable(); @@ -675,6 +1118,16 @@ public final UnaryCallable getAnnotati * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Model model = Model.newBuilder().build();
+   *   Model response = autoMlClient.createModelAsync(parent, model).get();
+   * }
+   * }
+ * * @param parent Required. Resource name of the parent project where the model is being created. * @param model Required. The model to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -695,6 +1148,16 @@ public final OperationFuture createModelAsync( * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Model model = Model.newBuilder().build();
+   *   Model response = autoMlClient.createModelAsync(parent, model).get();
+   * }
+   * }
+ * * @param parent Required. Resource name of the parent project where the model is being created. * @param model Required. The model to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -712,6 +1175,19 @@ public final OperationFuture createModelAsync( * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateModelRequest request =
+   *       CreateModelRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setModel(Model.newBuilder().build())
+   *           .build();
+   *   Model response = autoMlClient.createModelAsync(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 */ @@ -727,6 +1203,20 @@ public final OperationFuture createModelAsync( * global evaluation, and one evaluation for each annotation spec. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateModelRequest request =
+   *       CreateModelRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setModel(Model.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.createModelOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Model response = future.get();
+   * }
+   * }
*/ public final OperationCallable createModelOperationCallable() { @@ -740,6 +1230,19 @@ public final OperationFuture createModelAsync( * global evaluation, and one evaluation for each annotation spec. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   CreateModelRequest request =
+   *       CreateModelRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setModel(Model.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.createModelCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createModelCallable() { return stub.createModelCallable(); @@ -749,6 +1252,15 @@ public final UnaryCallable createModelCallable() /** * Gets a model. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   Model response = autoMlClient.getModel(name);
+   * }
+   * }
+ * * @param name Required. Resource name of the model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -762,6 +1274,15 @@ public final Model getModel(ModelName name) { /** * Gets a model. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   Model response = autoMlClient.getModel(name);
+   * }
+   * }
+ * * @param name Required. Resource name of the model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -774,6 +1295,18 @@ public final Model getModel(String name) { /** * Gets a model. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetModelRequest request =
+   *       GetModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   Model response = autoMlClient.getModel(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 */ @@ -786,6 +1319,18 @@ public final Model getModel(GetModelRequest request) { * Gets a model. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetModelRequest request =
+   *       GetModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.getModelCallable().futureCall(request);
+   *   // Do something.
+   *   Model response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getModelCallable() { return stub.getModelCallable(); @@ -795,6 +1340,17 @@ public final UnaryCallable getModelCallable() { /** * Lists models. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Model element : autoMlClient.listModels(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. Resource name of the project, from which to list the models. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -808,6 +1364,17 @@ public final ListModelsPagedResponse listModels(LocationName parent) { /** * Lists models. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Model element : autoMlClient.listModels(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. Resource name of the project, from which to list the models. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -820,6 +1387,23 @@ public final ListModelsPagedResponse listModels(String parent) { /** * Lists models. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListModelsRequest request =
+   *       ListModelsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Model element : autoMlClient.listModels(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 */ @@ -832,6 +1416,23 @@ public final ListModelsPagedResponse listModels(ListModelsRequest request) { * Lists models. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListModelsRequest request =
+   *       ListModelsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = autoMlClient.listModelsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Model element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listModelsPagedCallable() { return stub.listModelsPagedCallable(); @@ -842,6 +1443,23 @@ public final UnaryCallable listModel * Lists models. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   while (true) {
+   *     ListModelsResponse response = autoMlClient.listModelsCallable().call(request);
+   *     for (Model element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listModelsCallable() { return stub.listModelsCallable(); @@ -853,6 +1471,15 @@ public final UnaryCallable listModelsCall * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   autoMlClient.deleteModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model being deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -868,6 +1495,15 @@ public final OperationFuture deleteModelAsync(ModelNam * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   autoMlClient.deleteModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model being deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -882,6 +1518,18 @@ public final OperationFuture deleteModelAsync(String n * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteModelRequest request =
+   *       DeleteModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   autoMlClient.deleteModelAsync(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 */ @@ -897,6 +1545,19 @@ public final OperationFuture deleteModelAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteModelRequest request =
+   *       DeleteModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.deleteModelOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable deleteModelOperationCallable() { @@ -910,6 +1571,18 @@ public final OperationFuture deleteModelAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeleteModelRequest request =
+   *       DeleteModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.deleteModelCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteModelCallable() { return stub.deleteModelCallable(); @@ -919,6 +1592,16 @@ public final UnaryCallable deleteModelCallable() /** * Updates a model. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   Model model = Model.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Model response = autoMlClient.updateModel(model, updateMask);
+   * }
+   * }
+ * * @param model Required. The model which replaces the resource on the server. * @param updateMask Required. The update mask applies to the resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -933,6 +1616,19 @@ public final Model updateModel(Model model, FieldMask updateMask) { /** * Updates a model. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UpdateModelRequest request =
+   *       UpdateModelRequest.newBuilder()
+   *           .setModel(Model.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Model response = autoMlClient.updateModel(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 */ @@ -945,6 +1641,19 @@ public final Model updateModel(UpdateModelRequest request) { * Updates a model. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UpdateModelRequest request =
+   *       UpdateModelRequest.newBuilder()
+   *           .setModel(Model.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.updateModelCallable().futureCall(request);
+   *   // Do something.
+   *   Model response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateModelCallable() { return stub.updateModelCallable(); @@ -964,6 +1673,15 @@ public final UnaryCallable updateModelCallable() { *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   autoMlClient.deployModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model to deploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -987,6 +1705,15 @@ public final OperationFuture deployModelAsync(ModelNam *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   autoMlClient.deployModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model to deploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1009,6 +1736,18 @@ public final OperationFuture deployModelAsync(String n *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeployModelRequest request =
+   *       DeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   autoMlClient.deployModelAsync(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 */ @@ -1032,6 +1771,19 @@ public final OperationFuture deployModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeployModelRequest request =
+   *       DeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.deployModelOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable deployModelOperationCallable() { @@ -1053,6 +1805,18 @@ public final OperationFuture deployModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   DeployModelRequest request =
+   *       DeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.deployModelCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deployModelCallable() { return stub.deployModelCallable(); @@ -1068,6 +1832,15 @@ public final UnaryCallable deployModelCallable() *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   autoMlClient.undeployModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model to undeploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1087,6 +1860,15 @@ public final OperationFuture undeployModelAsync(ModelN *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   autoMlClient.undeployModelAsync(name).get();
+   * }
+   * }
+ * * @param name Required. Resource name of the model to undeploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1105,6 +1887,18 @@ public final OperationFuture undeployModelAsync(String *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UndeployModelRequest request =
+   *       UndeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   autoMlClient.undeployModelAsync(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 */ @@ -1124,6 +1918,19 @@ public final OperationFuture undeployModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UndeployModelRequest request =
+   *       UndeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.undeployModelOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable undeployModelOperationCallable() { @@ -1141,6 +1948,18 @@ public final OperationFuture undeployModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   UndeployModelRequest request =
+   *       UndeployModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .build();
+   *   ApiFuture future = autoMlClient.undeployModelCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable undeployModelCallable() { return stub.undeployModelCallable(); @@ -1155,6 +1974,16 @@ public final UnaryCallable undeployModelCallabl *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build();
+   *   autoMlClient.exportModelAsync(name, outputConfig).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the model to export. * @param outputConfig Required. The desired output location and configuration. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1178,6 +2007,16 @@ public final OperationFuture exportModelAsync( *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build();
+   *   autoMlClient.exportModelAsync(name, outputConfig).get();
+   * }
+   * }
+ * * @param name Required. The resource name of the model to export. * @param outputConfig Required. The desired output location and configuration. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1198,6 +2037,19 @@ public final OperationFuture exportModelAsync( *

Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportModelRequest request =
+   *       ExportModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
+   *           .build();
+   *   autoMlClient.exportModelAsync(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 */ @@ -1216,6 +2068,20 @@ public final OperationFuture exportModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportModelRequest request =
+   *       ExportModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       autoMlClient.exportModelOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable exportModelOperationCallable() { @@ -1232,6 +2098,19 @@ public final OperationFuture exportModelAsync( * when it completes. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ExportModelRequest request =
+   *       ExportModelRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = autoMlClient.exportModelCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable exportModelCallable() { return stub.exportModelCallable(); @@ -1241,6 +2120,16 @@ public final UnaryCallable exportModelCallable() /** * Gets a model evaluation. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelEvaluationName name =
+   *       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]");
+   *   ModelEvaluation response = autoMlClient.getModelEvaluation(name);
+   * }
+   * }
+ * * @param name Required. Resource name for the model evaluation. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1256,6 +2145,17 @@ public final ModelEvaluation getModelEvaluation(ModelEvaluationName name) { /** * Gets a model evaluation. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String name =
+   *       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
+   *           .toString();
+   *   ModelEvaluation response = autoMlClient.getModelEvaluation(name);
+   * }
+   * }
+ * * @param name Required. Resource name for the model evaluation. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1269,6 +2169,20 @@ public final ModelEvaluation getModelEvaluation(String name) { /** * Gets a model evaluation. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetModelEvaluationRequest request =
+   *       GetModelEvaluationRequest.newBuilder()
+   *           .setName(
+   *               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
+   *                   .toString())
+   *           .build();
+   *   ModelEvaluation response = autoMlClient.getModelEvaluation(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 */ @@ -1281,6 +2195,21 @@ public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest reques * Gets a model evaluation. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   GetModelEvaluationRequest request =
+   *       GetModelEvaluationRequest.newBuilder()
+   *           .setName(
+   *               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future =
+   *       autoMlClient.getModelEvaluationCallable().futureCall(request);
+   *   // Do something.
+   *   ModelEvaluation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getModelEvaluationCallable() { @@ -1291,6 +2220,19 @@ public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest reques /** * Lists model evaluations. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   String filter = "filter-1274492040";
+   *   for (ModelEvaluation element :
+   *       autoMlClient.listModelEvaluations(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. Resource name of the model to list the model evaluations for. If * modelId is set as "-", this will list model evaluations from across all models of the * parent location. @@ -1316,6 +2258,19 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( /** * Lists model evaluations. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   String filter = "filter-1274492040";
+   *   for (ModelEvaluation element :
+   *       autoMlClient.listModelEvaluations(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. Resource name of the model to list the model evaluations for. If * modelId is set as "-", this will list model evaluations from across all models of the * parent location. @@ -1338,6 +2293,23 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( /** * Lists model evaluations. * + *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListModelEvaluationsRequest request =
+   *       ListModelEvaluationsRequest.newBuilder()
+   *           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (ModelEvaluation element : autoMlClient.listModelEvaluations(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 */ @@ -1351,6 +2323,24 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( * Lists model evaluations. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   ListModelEvaluationsRequest request =
+   *       ListModelEvaluationsRequest.newBuilder()
+   *           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       autoMlClient.listModelEvaluationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ModelEvaluation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listModelEvaluationsPagedCallable() { @@ -1362,6 +2352,24 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( * Lists model evaluations. * *

Sample code: + * + *

{@code
+   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
+   *   while (true) {
+   *     ListModelEvaluationsResponse response =
+   *         autoMlClient.listModelEvaluationsCallable().call(request);
+   *     for (ModelEvaluation element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listModelEvaluationsCallable() { diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/PredictionServiceClient.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/PredictionServiceClient.java index c3a229b27..8239ad0a1 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/PredictionServiceClient.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/PredictionServiceClient.java @@ -40,6 +40,15 @@ *

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
+ * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+ *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+ *   ExamplePayload payload = ExamplePayload.newBuilder().build();
+ *   Map params = new HashMap<>();
+ *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
+ * }
+ * }
+ * *

Note: close() needs to be called on the PredictionServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -204,6 +213,17 @@ public final OperationsClient getOperationsClient() { * FORECASTING `prediction_type`. * * + *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
+   *   ExamplePayload payload = ExamplePayload.newBuilder().build();
+   *   Map params = new HashMap<>();
+   *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
+   * }
+   * }
+ * * @param name Required. Name of the model requested to serve the prediction. * @param payload Required. Payload to perform a prediction on. The payload must match the problem * type that the model was trained to solve. @@ -288,6 +308,17 @@ public final PredictResponse predict( * FORECASTING `prediction_type`. * * + *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
+   *   ExamplePayload payload = ExamplePayload.newBuilder().build();
+   *   Map params = new HashMap<>();
+   *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
+   * }
+   * }
+ * * @param name Required. Name of the model requested to serve the prediction. * @param payload Required. Payload to perform a prediction on. The payload must match the problem * type that the model was trained to solve. @@ -368,6 +399,20 @@ public final PredictResponse predict( * FORECASTING `prediction_type`. * * + *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   PredictRequest request =
+   *       PredictRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setPayload(ExamplePayload.newBuilder().build())
+   *           .putAllParams(new HashMap())
+   *           .build();
+   *   PredictResponse response = predictionServiceClient.predict(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 */ @@ -427,6 +472,21 @@ public final PredictResponse predict(PredictRequest request) { * * *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   PredictRequest request =
+   *       PredictRequest.newBuilder()
+   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
+   *           .setPayload(ExamplePayload.newBuilder().build())
+   *           .putAllParams(new HashMap())
+   *           .build();
+   *   ApiFuture future =
+   *       predictionServiceClient.predictCallable().futureCall(request);
+   *   // Do something.
+   *   PredictResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable predictCallable() { return stub.predictCallable(); @@ -452,6 +512,19 @@ public final UnaryCallable predictCallable() { *
  • AutoML Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   BatchPredictInputConfig inputConfig = BatchPredictInputConfig.newBuilder().build();
    +   *   BatchPredictOutputConfig outputConfig = BatchPredictOutputConfig.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   BatchPredictResult response =
    +   *       predictionServiceClient.batchPredictAsync(name, inputConfig, outputConfig, params).get();
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the batch prediction. * @param inputConfig Required. The input configuration for batch prediction. * @param outputConfig Required. The Configuration specifying where output predictions should be @@ -540,6 +613,19 @@ public final OperationFuture batchPredict *
  • AutoML Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   BatchPredictInputConfig inputConfig = BatchPredictInputConfig.newBuilder().build();
    +   *   BatchPredictOutputConfig outputConfig = BatchPredictOutputConfig.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   BatchPredictResult response =
    +   *       predictionServiceClient.batchPredictAsync(name, inputConfig, outputConfig, params).get();
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the batch prediction. * @param inputConfig Required. The input configuration for batch prediction. * @param outputConfig Required. The Configuration specifying where output predictions should be @@ -628,6 +714,21 @@ public final OperationFuture batchPredict *
  • AutoML Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   BatchPredictResult response = predictionServiceClient.batchPredictAsync(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 */ @@ -657,6 +758,22 @@ public final OperationFuture batchPredict * * *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       predictionServiceClient.batchPredictOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   BatchPredictResult response = future.get();
    +   * }
    +   * }
    */ public final OperationCallable batchPredictOperationCallable() { @@ -684,6 +801,22 @@ public final OperationFuture batchPredict * * *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       predictionServiceClient.batchPredictCallable().futureCall(request);
    +   *   // Do something.
    +   *   Operation response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable batchPredictCallable() { return stub.batchPredictCallable(); diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/package-info.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/package-info.java index 90ab04b9a..2ed80907a 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/package-info.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1/package-info.java @@ -26,6 +26,15 @@ * *

    Sample for PredictionServiceClient: * + *

    {@code
    + * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    + *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    + *   ExamplePayload payload = ExamplePayload.newBuilder().build();
    + *   Map params = new HashMap<>();
    + *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
    + * }
    + * }
    + * *

    ======================= AutoMlClient ======================= * *

    Service Description: AutoML Server API. @@ -43,6 +52,13 @@ * either of those cases is accepted. * *

    Sample for AutoMlClient: + * + *

    {@code
    + * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    + *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    + *   Dataset response = autoMlClient.getDataset(name);
    + * }
    + * }
    */ @Generated("by gapic-generator-java") package com.google.cloud.automl.v1; diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java index d6b79a0f1..ced1d6d5e 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java @@ -58,6 +58,14 @@ *

    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
    + * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    + *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    + *   Dataset dataset = Dataset.newBuilder().build();
    + *   Dataset response = autoMlClient.createDataset(parent, dataset);
    + * }
    + * }
    + * *

    Note: close() needs to be called on the AutoMlClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -170,6 +178,16 @@ public final OperationsClient getOperationsClient() { /** * Creates a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    +   *   Dataset dataset = Dataset.newBuilder().build();
    +   *   Dataset response = autoMlClient.createDataset(parent, dataset);
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the project to create the dataset for. * @param dataset Required. The dataset to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -187,6 +205,16 @@ public final Dataset createDataset(LocationName parent, Dataset dataset) { /** * Creates a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    +   *   Dataset dataset = Dataset.newBuilder().build();
    +   *   Dataset response = autoMlClient.createDataset(parent, dataset);
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the project to create the dataset for. * @param dataset Required. The dataset to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -201,6 +229,19 @@ public final Dataset createDataset(String parent, Dataset dataset) { /** * Creates a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   CreateDatasetRequest request =
    +   *       CreateDatasetRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setDataset(Dataset.newBuilder().build())
    +   *           .build();
    +   *   Dataset response = autoMlClient.createDataset(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 */ @@ -213,6 +254,19 @@ public final Dataset createDataset(CreateDatasetRequest request) { * Creates a dataset. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   CreateDatasetRequest request =
    +   *       CreateDatasetRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setDataset(Dataset.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.createDatasetCallable().futureCall(request);
    +   *   // Do something.
    +   *   Dataset response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable createDatasetCallable() { return stub.createDatasetCallable(); @@ -222,6 +276,15 @@ public final UnaryCallable createDatasetCallable( /** * Gets a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    +   *   Dataset response = autoMlClient.getDataset(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -235,6 +298,15 @@ public final Dataset getDataset(DatasetName name) { /** * Gets a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
    +   *   Dataset response = autoMlClient.getDataset(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -247,6 +319,18 @@ public final Dataset getDataset(String name) { /** * Gets a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetDatasetRequest request =
    +   *       GetDatasetRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .build();
    +   *   Dataset response = autoMlClient.getDataset(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 */ @@ -259,6 +343,18 @@ public final Dataset getDataset(GetDatasetRequest request) { * Gets a dataset. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetDatasetRequest request =
    +   *       GetDatasetRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.getDatasetCallable().futureCall(request);
    +   *   // Do something.
    +   *   Dataset response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getDatasetCallable() { return stub.getDatasetCallable(); @@ -268,6 +364,17 @@ public final UnaryCallable getDatasetCallable() { /** * Lists datasets in a project. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    +   *   for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the project from which to list datasets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -283,6 +390,17 @@ public final ListDatasetsPagedResponse listDatasets(LocationName parent) { /** * Lists datasets in a project. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    +   *   for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the project from which to list datasets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -295,6 +413,23 @@ public final ListDatasetsPagedResponse listDatasets(String parent) { /** * Lists datasets in a project. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListDatasetsRequest request =
    +   *       ListDatasetsRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   for (Dataset element : autoMlClient.listDatasets(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 */ @@ -307,6 +442,23 @@ public final ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) * Lists datasets in a project. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListDatasetsRequest request =
    +   *       ListDatasetsRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.listDatasetsPagedCallable().futureCall(request);
    +   *   // Do something.
    +   *   for (Dataset element : future.get().iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listDatasetsPagedCallable() { @@ -318,6 +470,23 @@ public final ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) * Lists datasets in a project. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   while (true) {
    +   *     ListDatasetsResponse response = autoMlClient.listDatasetsCallable().call(request);
    +   *     for (Dataset element : response.getResponsesList()) {
    +   *       // doThingsWith(element);
    +   *     }
    +   *     String nextPageToken = response.getNextPageToken();
    +   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    +   *       request = request.toBuilder().setPageToken(nextPageToken).build();
    +   *     } else {
    +   *       break;
    +   *     }
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listDatasetsCallable() { return stub.listDatasetsCallable(); @@ -327,6 +496,15 @@ public final UnaryCallable listDatase /** * Updates a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   Dataset dataset = Dataset.newBuilder().build();
    +   *   Dataset response = autoMlClient.updateDataset(dataset);
    +   * }
    +   * }
    + * * @param dataset Required. The dataset which replaces the resource on the server. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -339,6 +517,19 @@ public final Dataset updateDataset(Dataset dataset) { /** * Updates a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateDatasetRequest request =
    +   *       UpdateDatasetRequest.newBuilder()
    +   *           .setDataset(Dataset.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   Dataset response = autoMlClient.updateDataset(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 */ @@ -351,6 +542,19 @@ public final Dataset updateDataset(UpdateDatasetRequest request) { * Updates a dataset. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateDatasetRequest request =
    +   *       UpdateDatasetRequest.newBuilder()
    +   *           .setDataset(Dataset.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.updateDatasetCallable().futureCall(request);
    +   *   // Do something.
    +   *   Dataset response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable updateDatasetCallable() { return stub.updateDatasetCallable(); @@ -362,6 +566,15 @@ public final UnaryCallable updateDatasetCallable( * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    +   *   autoMlClient.deleteDatasetAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -377,6 +590,15 @@ public final OperationFuture deleteDatasetAsync(Datase * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
    +   *   autoMlClient.deleteDatasetAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -391,6 +613,18 @@ public final OperationFuture deleteDatasetAsync(String * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteDatasetRequest request =
    +   *       DeleteDatasetRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .build();
    +   *   autoMlClient.deleteDatasetAsync(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 */ @@ -406,6 +640,19 @@ public final OperationFuture deleteDatasetAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteDatasetRequest request =
    +   *       DeleteDatasetRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.deleteDatasetOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable deleteDatasetOperationCallable() { @@ -419,6 +666,18 @@ public final OperationFuture deleteDatasetAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteDatasetRequest request =
    +   *       DeleteDatasetRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.deleteDatasetCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable deleteDatasetCallable() { return stub.deleteDatasetCallable(); @@ -436,6 +695,16 @@ public final UnaryCallable deleteDatasetCallabl * [response][google.longrunning.Operation.response] field when it completes. * * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    +   *   InputConfig inputConfig = InputConfig.newBuilder().build();
    +   *   autoMlClient.importDataAsync(name, inputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. Dataset name. Dataset must already exist. All imported annotations and * examples will be added. * @param inputConfig Required. The desired input location and its domain specific semantics, if @@ -464,6 +733,16 @@ public final OperationFuture importDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
    +   *   InputConfig inputConfig = InputConfig.newBuilder().build();
    +   *   autoMlClient.importDataAsync(name, inputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. Dataset name. Dataset must already exist. All imported annotations and * examples will be added. * @param inputConfig Required. The desired input location and its domain specific semantics, if @@ -489,6 +768,19 @@ public final OperationFuture importDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ImportDataRequest request =
    +   *       ImportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setInputConfig(InputConfig.newBuilder().build())
    +   *           .build();
    +   *   autoMlClient.importDataAsync(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 */ @@ -510,6 +802,20 @@ public final OperationFuture importDataAsync( * * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ImportDataRequest request =
    +   *       ImportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setInputConfig(InputConfig.newBuilder().build())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.importDataOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable importDataOperationCallable() { @@ -529,6 +835,19 @@ public final OperationFuture importDataAsync( * * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ImportDataRequest request =
    +   *       ImportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setInputConfig(InputConfig.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.importDataCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable importDataCallable() { return stub.importDataCallable(); @@ -539,6 +858,16 @@ public final UnaryCallable importDataCallable() { * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    +   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
    +   *   autoMlClient.exportDataAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset. * @param outputConfig Required. The desired output location. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -558,6 +887,16 @@ public final OperationFuture exportDataAsync( * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
    +   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
    +   *   autoMlClient.exportDataAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the dataset. * @param outputConfig Required. The desired output location. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -574,6 +913,19 @@ public final OperationFuture exportDataAsync( * Exports dataset's data to the provided output location. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportDataRequest request =
    +   *       ExportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setOutputConfig(OutputConfig.newBuilder().build())
    +   *           .build();
    +   *   autoMlClient.exportDataAsync(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 */ @@ -588,6 +940,20 @@ public final OperationFuture exportDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportDataRequest request =
    +   *       ExportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setOutputConfig(OutputConfig.newBuilder().build())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.exportDataOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable exportDataOperationCallable() { @@ -600,6 +966,19 @@ public final OperationFuture exportDataAsync( * [response][google.longrunning.Operation.response] field when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportDataRequest request =
    +   *       ExportDataRequest.newBuilder()
    +   *           .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setOutputConfig(OutputConfig.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.exportDataCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable exportDataCallable() { return stub.exportDataCallable(); @@ -609,6 +988,16 @@ public final UnaryCallable exportDataCallable() { /** * Gets an annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   AnnotationSpecName name =
    +   *       AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]");
    +   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the annotation spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -624,6 +1013,17 @@ public final AnnotationSpec getAnnotationSpec(AnnotationSpecName name) { /** * Gets an annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name =
    +   *       AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
    +   *           .toString();
    +   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the annotation spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -636,6 +1036,20 @@ public final AnnotationSpec getAnnotationSpec(String name) { /** * Gets an annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetAnnotationSpecRequest request =
    +   *       GetAnnotationSpecRequest.newBuilder()
    +   *           .setName(
    +   *               AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
    +   *                   .toString())
    +   *           .build();
    +   *   AnnotationSpec response = autoMlClient.getAnnotationSpec(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 */ @@ -648,6 +1062,21 @@ public final AnnotationSpec getAnnotationSpec(GetAnnotationSpecRequest request) * Gets an annotation spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetAnnotationSpecRequest request =
    +   *       GetAnnotationSpecRequest.newBuilder()
    +   *           .setName(
    +   *               AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
    +   *                   .toString())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       autoMlClient.getAnnotationSpecCallable().futureCall(request);
    +   *   // Do something.
    +   *   AnnotationSpec response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getAnnotationSpecCallable() { return stub.getAnnotationSpecCallable(); @@ -657,6 +1086,15 @@ public final UnaryCallable getAnnotati /** * Gets a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   TableSpecName name = TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]");
    +   *   TableSpec response = autoMlClient.getTableSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the table spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -670,6 +1108,16 @@ public final TableSpec getTableSpec(TableSpecName name) { /** * Gets a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name =
    +   *       TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]").toString();
    +   *   TableSpec response = autoMlClient.getTableSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the table spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -682,6 +1130,21 @@ public final TableSpec getTableSpec(String name) { /** * Gets a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetTableSpecRequest request =
    +   *       GetTableSpecRequest.newBuilder()
    +   *           .setName(
    +   *               TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   TableSpec response = autoMlClient.getTableSpec(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 */ @@ -694,6 +1157,21 @@ public final TableSpec getTableSpec(GetTableSpecRequest request) { * Gets a table spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetTableSpecRequest request =
    +   *       GetTableSpecRequest.newBuilder()
    +   *           .setName(
    +   *               TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.getTableSpecCallable().futureCall(request);
    +   *   // Do something.
    +   *   TableSpec response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getTableSpecCallable() { return stub.getTableSpecCallable(); @@ -703,6 +1181,17 @@ public final UnaryCallable getTableSpecCallable( /** * Lists table specs in a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
    +   *   for (TableSpec element : autoMlClient.listTableSpecs(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the dataset to list table specs from. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -718,6 +1207,17 @@ public final ListTableSpecsPagedResponse listTableSpecs(DatasetName parent) { /** * Lists table specs in a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
    +   *   for (TableSpec element : autoMlClient.listTableSpecs(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the dataset to list table specs from. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -730,6 +1230,24 @@ public final ListTableSpecsPagedResponse listTableSpecs(String parent) { /** * Lists table specs in a dataset. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListTableSpecsRequest request =
    +   *       ListTableSpecsRequest.newBuilder()
    +   *           .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   for (TableSpec element : autoMlClient.listTableSpecs(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 */ @@ -742,6 +1260,24 @@ public final ListTableSpecsPagedResponse listTableSpecs(ListTableSpecsRequest re * Lists table specs in a dataset. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListTableSpecsRequest request =
    +   *       ListTableSpecsRequest.newBuilder()
    +   *           .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.listTableSpecsPagedCallable().futureCall(request);
    +   *   // Do something.
    +   *   for (TableSpec element : future.get().iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listTableSpecsPagedCallable() { @@ -753,6 +1289,23 @@ public final ListTableSpecsPagedResponse listTableSpecs(ListTableSpecsRequest re * Lists table specs in a dataset. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   while (true) {
    +   *     ListTableSpecsResponse response = autoMlClient.listTableSpecsCallable().call(request);
    +   *     for (TableSpec element : response.getResponsesList()) {
    +   *       // doThingsWith(element);
    +   *     }
    +   *     String nextPageToken = response.getNextPageToken();
    +   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    +   *       request = request.toBuilder().setPageToken(nextPageToken).build();
    +   *     } else {
    +   *       break;
    +   *     }
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listTableSpecsCallable() { @@ -763,6 +1316,15 @@ public final ListTableSpecsPagedResponse listTableSpecs(ListTableSpecsRequest re /** * Updates a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   TableSpec tableSpec = TableSpec.newBuilder().build();
    +   *   TableSpec response = autoMlClient.updateTableSpec(tableSpec);
    +   * }
    +   * }
    + * * @param tableSpec Required. The table spec which replaces the resource on the server. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -776,6 +1338,19 @@ public final TableSpec updateTableSpec(TableSpec tableSpec) { /** * Updates a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateTableSpecRequest request =
    +   *       UpdateTableSpecRequest.newBuilder()
    +   *           .setTableSpec(TableSpec.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   TableSpec response = autoMlClient.updateTableSpec(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 */ @@ -788,6 +1363,19 @@ public final TableSpec updateTableSpec(UpdateTableSpecRequest request) { * Updates a table spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateTableSpecRequest request =
    +   *       UpdateTableSpecRequest.newBuilder()
    +   *           .setTableSpec(TableSpec.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.updateTableSpecCallable().futureCall(request);
    +   *   // Do something.
    +   *   TableSpec response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable updateTableSpecCallable() { return stub.updateTableSpecCallable(); @@ -797,6 +1385,17 @@ public final UnaryCallable updateTableSpecCal /** * Gets a column spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ColumnSpecName name =
    +   *       ColumnSpecName.of(
    +   *           "[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]", "[COLUMN_SPEC]");
    +   *   ColumnSpec response = autoMlClient.getColumnSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the column spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -810,6 +1409,17 @@ public final ColumnSpec getColumnSpec(ColumnSpecName name) { /** * Gets a column spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name =
    +   *       ColumnSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]", "[COLUMN_SPEC]")
    +   *           .toString();
    +   *   ColumnSpec response = autoMlClient.getColumnSpec(name);
    +   * }
    +   * }
    + * * @param name Required. The resource name of the column spec to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -822,6 +1432,22 @@ public final ColumnSpec getColumnSpec(String name) { /** * Gets a column spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetColumnSpecRequest request =
    +   *       GetColumnSpecRequest.newBuilder()
    +   *           .setName(
    +   *               ColumnSpecName.of(
    +   *                       "[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]", "[COLUMN_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ColumnSpec response = autoMlClient.getColumnSpec(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 */ @@ -834,6 +1460,22 @@ public final ColumnSpec getColumnSpec(GetColumnSpecRequest request) { * Gets a column spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetColumnSpecRequest request =
    +   *       GetColumnSpecRequest.newBuilder()
    +   *           .setName(
    +   *               ColumnSpecName.of(
    +   *                       "[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]", "[COLUMN_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.getColumnSpecCallable().futureCall(request);
    +   *   // Do something.
    +   *   ColumnSpec response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getColumnSpecCallable() { return stub.getColumnSpecCallable(); @@ -843,6 +1485,18 @@ public final UnaryCallable getColumnSpecCallab /** * Lists column specs in a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   TableSpecName parent =
    +   *       TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]");
    +   *   for (ColumnSpec element : autoMlClient.listColumnSpecs(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the table spec to list column specs from. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -858,6 +1512,18 @@ public final ListColumnSpecsPagedResponse listColumnSpecs(TableSpecName parent) /** * Lists column specs in a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent =
    +   *       TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]").toString();
    +   *   for (ColumnSpec element : autoMlClient.listColumnSpecs(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. The resource name of the table spec to list column specs from. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -870,6 +1536,26 @@ public final ListColumnSpecsPagedResponse listColumnSpecs(String parent) { /** * Lists column specs in a table spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListColumnSpecsRequest request =
    +   *       ListColumnSpecsRequest.newBuilder()
    +   *           .setParent(
    +   *               TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   for (ColumnSpec element : autoMlClient.listColumnSpecs(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 */ @@ -882,6 +1568,27 @@ public final ListColumnSpecsPagedResponse listColumnSpecs(ListColumnSpecsRequest * Lists column specs in a table spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListColumnSpecsRequest request =
    +   *       ListColumnSpecsRequest.newBuilder()
    +   *           .setParent(
    +   *               TableSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
    +   *                   .toString())
    +   *           .setFieldMask(FieldMask.newBuilder().build())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   ApiFuture future =
    +   *       autoMlClient.listColumnSpecsPagedCallable().futureCall(request);
    +   *   // Do something.
    +   *   for (ColumnSpec element : future.get().iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listColumnSpecsPagedCallable() { @@ -893,6 +1600,23 @@ public final ListColumnSpecsPagedResponse listColumnSpecs(ListColumnSpecsRequest * Lists column specs in a table spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   while (true) {
    +   *     ListColumnSpecsResponse response = autoMlClient.listColumnSpecsCallable().call(request);
    +   *     for (ColumnSpec element : response.getResponsesList()) {
    +   *       // doThingsWith(element);
    +   *     }
    +   *     String nextPageToken = response.getNextPageToken();
    +   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    +   *       request = request.toBuilder().setPageToken(nextPageToken).build();
    +   *     } else {
    +   *       break;
    +   *     }
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listColumnSpecsCallable() { @@ -903,6 +1627,15 @@ public final ListColumnSpecsPagedResponse listColumnSpecs(ListColumnSpecsRequest /** * Updates a column spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ColumnSpec columnSpec = ColumnSpec.newBuilder().build();
    +   *   ColumnSpec response = autoMlClient.updateColumnSpec(columnSpec);
    +   * }
    +   * }
    + * * @param columnSpec Required. The column spec which replaces the resource on the server. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -916,6 +1649,19 @@ public final ColumnSpec updateColumnSpec(ColumnSpec columnSpec) { /** * Updates a column spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateColumnSpecRequest request =
    +   *       UpdateColumnSpecRequest.newBuilder()
    +   *           .setColumnSpec(ColumnSpec.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ColumnSpec response = autoMlClient.updateColumnSpec(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 */ @@ -928,6 +1674,19 @@ public final ColumnSpec updateColumnSpec(UpdateColumnSpecRequest request) { * Updates a column spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UpdateColumnSpecRequest request =
    +   *       UpdateColumnSpecRequest.newBuilder()
    +   *           .setColumnSpec(ColumnSpec.newBuilder().build())
    +   *           .setUpdateMask(FieldMask.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.updateColumnSpecCallable().futureCall(request);
    +   *   // Do something.
    +   *   ColumnSpec response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable updateColumnSpecCallable() { return stub.updateColumnSpecCallable(); @@ -939,6 +1698,16 @@ public final UnaryCallable updateColumnSpec * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    +   *   Model model = Model.newBuilder().build();
    +   *   Model response = autoMlClient.createModelAsync(parent, model).get();
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the parent project where the model is being created. * @param model Required. The model to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -959,6 +1728,16 @@ public final OperationFuture createModelAsync( * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    +   *   Model model = Model.newBuilder().build();
    +   *   Model response = autoMlClient.createModelAsync(parent, model).get();
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the parent project where the model is being created. * @param model Required. The model to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -976,6 +1755,19 @@ public final OperationFuture createModelAsync( * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   CreateModelRequest request =
    +   *       CreateModelRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setModel(Model.newBuilder().build())
    +   *           .build();
    +   *   Model response = autoMlClient.createModelAsync(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 */ @@ -991,6 +1783,20 @@ public final OperationFuture createModelAsync( * global evaluation, and one evaluation for each annotation spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   CreateModelRequest request =
    +   *       CreateModelRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setModel(Model.newBuilder().build())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.createModelOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   Model response = future.get();
    +   * }
    +   * }
    */ public final OperationCallable createModelOperationCallable() { @@ -1004,6 +1810,19 @@ public final OperationFuture createModelAsync( * global evaluation, and one evaluation for each annotation spec. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   CreateModelRequest request =
    +   *       CreateModelRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setModel(Model.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.createModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   Operation response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable createModelCallable() { return stub.createModelCallable(); @@ -1013,6 +1832,15 @@ public final UnaryCallable createModelCallable() /** * Gets a model. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   Model response = autoMlClient.getModel(name);
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1026,6 +1854,15 @@ public final Model getModel(ModelName name) { /** * Gets a model. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   Model response = autoMlClient.getModel(name);
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1038,6 +1875,18 @@ public final Model getModel(String name) { /** * Gets a model. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetModelRequest request =
    +   *       GetModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   Model response = autoMlClient.getModel(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 */ @@ -1050,6 +1899,18 @@ public final Model getModel(GetModelRequest request) { * Gets a model. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetModelRequest request =
    +   *       GetModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.getModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   Model response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getModelCallable() { return stub.getModelCallable(); @@ -1059,6 +1920,17 @@ public final UnaryCallable getModelCallable() { /** * Lists models. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    +   *   for (Model element : autoMlClient.listModels(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the project, from which to list the models. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1072,6 +1944,17 @@ public final ListModelsPagedResponse listModels(LocationName parent) { /** * Lists models. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    +   *   for (Model element : autoMlClient.listModels(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the project, from which to list the models. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1084,6 +1967,23 @@ public final ListModelsPagedResponse listModels(String parent) { /** * Lists models. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListModelsRequest request =
    +   *       ListModelsRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   for (Model element : autoMlClient.listModels(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 */ @@ -1096,6 +1996,23 @@ public final ListModelsPagedResponse listModels(ListModelsRequest request) { * Lists models. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListModelsRequest request =
    +   *       ListModelsRequest.newBuilder()
    +   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.listModelsPagedCallable().futureCall(request);
    +   *   // Do something.
    +   *   for (Model element : future.get().iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listModelsPagedCallable() { return stub.listModelsPagedCallable(); @@ -1106,6 +2023,23 @@ public final UnaryCallable listModel * Lists models. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   while (true) {
    +   *     ListModelsResponse response = autoMlClient.listModelsCallable().call(request);
    +   *     for (Model element : response.getResponsesList()) {
    +   *       // doThingsWith(element);
    +   *     }
    +   *     String nextPageToken = response.getNextPageToken();
    +   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    +   *       request = request.toBuilder().setPageToken(nextPageToken).build();
    +   *     } else {
    +   *       break;
    +   *     }
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listModelsCallable() { return stub.listModelsCallable(); @@ -1117,6 +2051,15 @@ public final UnaryCallable listModelsCall * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   autoMlClient.deleteModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model being deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1132,6 +2075,15 @@ public final OperationFuture deleteModelAsync(ModelNam * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   autoMlClient.deleteModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model being deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1146,6 +2098,18 @@ public final OperationFuture deleteModelAsync(String n * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteModelRequest request =
    +   *       DeleteModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   autoMlClient.deleteModelAsync(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 */ @@ -1161,6 +2125,19 @@ public final OperationFuture deleteModelAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteModelRequest request =
    +   *       DeleteModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.deleteModelOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable deleteModelOperationCallable() { @@ -1174,6 +2151,18 @@ public final OperationFuture deleteModelAsync( * in the [metadata][google.longrunning.Operation.metadata] field. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeleteModelRequest request =
    +   *       DeleteModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.deleteModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable deleteModelCallable() { return stub.deleteModelCallable(); @@ -1193,6 +2182,15 @@ public final UnaryCallable deleteModelCallable() *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   autoMlClient.deployModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model to deploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1216,6 +2214,15 @@ public final OperationFuture deployModelAsync(ModelNam *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   autoMlClient.deployModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model to deploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1238,6 +2245,18 @@ public final OperationFuture deployModelAsync(String n *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeployModelRequest request =
    +   *       DeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   autoMlClient.deployModelAsync(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 */ @@ -1261,6 +2280,19 @@ public final OperationFuture deployModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeployModelRequest request =
    +   *       DeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.deployModelOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable deployModelOperationCallable() { @@ -1282,6 +2314,18 @@ public final OperationFuture deployModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   DeployModelRequest request =
    +   *       DeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.deployModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable deployModelCallable() { return stub.deployModelCallable(); @@ -1297,6 +2341,15 @@ public final UnaryCallable deployModelCallable() *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   autoMlClient.undeployModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model to undeploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1316,6 +2369,15 @@ public final OperationFuture undeployModelAsync(ModelN *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   autoMlClient.undeployModelAsync(name).get();
    +   * }
    +   * }
    + * * @param name Required. Resource name of the model to undeploy. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1334,6 +2396,18 @@ public final OperationFuture undeployModelAsync(String *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UndeployModelRequest request =
    +   *       UndeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   autoMlClient.undeployModelAsync(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 */ @@ -1353,6 +2427,19 @@ public final OperationFuture undeployModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UndeployModelRequest request =
    +   *       UndeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.undeployModelOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable undeployModelOperationCallable() { @@ -1370,6 +2457,18 @@ public final OperationFuture undeployModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   UndeployModelRequest request =
    +   *       UndeployModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.undeployModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable undeployModelCallable() { return stub.undeployModelCallable(); @@ -1385,6 +2484,16 @@ public final UnaryCallable undeployModelCallabl *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build();
    +   *   autoMlClient.exportModelAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the model to export. * @param outputConfig Required. The desired output location and configuration. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1409,6 +2518,16 @@ public final OperationFuture exportModelAsync( *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build();
    +   *   autoMlClient.exportModelAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the model to export. * @param outputConfig Required. The desired output location and configuration. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1430,6 +2549,19 @@ public final OperationFuture exportModelAsync( *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportModelRequest request =
    +   *       ExportModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   autoMlClient.exportModelAsync(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 */ @@ -1449,6 +2581,20 @@ public final OperationFuture exportModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportModelRequest request =
    +   *       ExportModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.exportModelOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable exportModelOperationCallable() { @@ -1466,6 +2612,19 @@ public final OperationFuture exportModelAsync( * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportModelRequest request =
    +   *       ExportModelRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ModelExportOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future = autoMlClient.exportModelCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable exportModelCallable() { return stub.exportModelCallable(); @@ -1485,6 +2644,17 @@ public final UnaryCallable exportModelCallable() *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   ExportEvaluatedExamplesOutputConfig outputConfig =
    +   *       ExportEvaluatedExamplesOutputConfig.newBuilder().build();
    +   *   autoMlClient.exportEvaluatedExamplesAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the model whose evaluated examples are to be * exported. * @param outputConfig Required. The desired output location and configuration. @@ -1514,6 +2684,17 @@ public final OperationFuture exportEvaluatedExamplesAs *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   ExportEvaluatedExamplesOutputConfig outputConfig =
    +   *       ExportEvaluatedExamplesOutputConfig.newBuilder().build();
    +   *   autoMlClient.exportEvaluatedExamplesAsync(name, outputConfig).get();
    +   * }
    +   * }
    + * * @param name Required. The resource name of the model whose evaluated examples are to be * exported. * @param outputConfig Required. The desired output location and configuration. @@ -1543,6 +2724,19 @@ public final OperationFuture exportEvaluatedExamplesAs *

    Returns an empty response in the [response][google.longrunning.Operation.response] field * when it completes. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportEvaluatedExamplesRequest request =
    +   *       ExportEvaluatedExamplesRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ExportEvaluatedExamplesOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   autoMlClient.exportEvaluatedExamplesAsync(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 */ @@ -1566,6 +2760,20 @@ public final OperationFuture exportEvaluatedExamplesAs * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportEvaluatedExamplesRequest request =
    +   *       ExportEvaluatedExamplesRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ExportEvaluatedExamplesOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       autoMlClient.exportEvaluatedExamplesOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final OperationCallable exportEvaluatedExamplesOperationCallable() { @@ -1587,6 +2795,20 @@ public final OperationFuture exportEvaluatedExamplesAs * when it completes. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ExportEvaluatedExamplesRequest request =
    +   *       ExportEvaluatedExamplesRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setOutputConfig(ExportEvaluatedExamplesOutputConfig.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       autoMlClient.exportEvaluatedExamplesCallable().futureCall(request);
    +   *   // Do something.
    +   *   future.get();
    +   * }
    +   * }
    */ public final UnaryCallable exportEvaluatedExamplesCallable() { @@ -1597,6 +2819,16 @@ public final OperationFuture exportEvaluatedExamplesAs /** * Gets a model evaluation. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelEvaluationName name =
    +   *       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]");
    +   *   ModelEvaluation response = autoMlClient.getModelEvaluation(name);
    +   * }
    +   * }
    + * * @param name Required. Resource name for the model evaluation. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1612,6 +2844,17 @@ public final ModelEvaluation getModelEvaluation(ModelEvaluationName name) { /** * Gets a model evaluation. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String name =
    +   *       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
    +   *           .toString();
    +   *   ModelEvaluation response = autoMlClient.getModelEvaluation(name);
    +   * }
    +   * }
    + * * @param name Required. Resource name for the model evaluation. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1625,6 +2868,20 @@ public final ModelEvaluation getModelEvaluation(String name) { /** * Gets a model evaluation. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetModelEvaluationRequest request =
    +   *       GetModelEvaluationRequest.newBuilder()
    +   *           .setName(
    +   *               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
    +   *                   .toString())
    +   *           .build();
    +   *   ModelEvaluation response = autoMlClient.getModelEvaluation(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 */ @@ -1637,6 +2894,21 @@ public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest reques * Gets a model evaluation. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   GetModelEvaluationRequest request =
    +   *       GetModelEvaluationRequest.newBuilder()
    +   *           .setName(
    +   *               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
    +   *                   .toString())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       autoMlClient.getModelEvaluationCallable().futureCall(request);
    +   *   // Do something.
    +   *   ModelEvaluation response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getModelEvaluationCallable() { @@ -1647,6 +2919,17 @@ public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest reques /** * Lists model evaluations. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   for (ModelEvaluation element : autoMlClient.listModelEvaluations(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the model to list the model evaluations for. If * modelId is set as "-", this will list model evaluations from across all models of the * parent location. @@ -1664,6 +2947,17 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations(ModelName pa /** * Lists model evaluations. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   for (ModelEvaluation element : autoMlClient.listModelEvaluations(parent).iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    + * * @param parent Required. Resource name of the model to list the model evaluations for. If * modelId is set as "-", this will list model evaluations from across all models of the * parent location. @@ -1679,6 +2973,23 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations(String paren /** * Lists model evaluations. * + *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListModelEvaluationsRequest request =
    +   *       ListModelEvaluationsRequest.newBuilder()
    +   *           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   for (ModelEvaluation element : autoMlClient.listModelEvaluations(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 */ @@ -1692,6 +3003,24 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( * Lists model evaluations. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   ListModelEvaluationsRequest request =
    +   *       ListModelEvaluationsRequest.newBuilder()
    +   *           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setFilter("filter-1274492040")
    +   *           .setPageSize(883849137)
    +   *           .setPageToken("pageToken873572522")
    +   *           .build();
    +   *   ApiFuture future =
    +   *       autoMlClient.listModelEvaluationsPagedCallable().futureCall(request);
    +   *   // Do something.
    +   *   for (ModelEvaluation element : future.get().iterateAll()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listModelEvaluationsPagedCallable() { @@ -1703,6 +3032,24 @@ public final ListModelEvaluationsPagedResponse listModelEvaluations( * Lists model evaluations. * *

    Sample code: + * + *

    {@code
    +   * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    +   *   while (true) {
    +   *     ListModelEvaluationsResponse response =
    +   *         autoMlClient.listModelEvaluationsCallable().call(request);
    +   *     for (ModelEvaluation element : response.getResponsesList()) {
    +   *       // doThingsWith(element);
    +   *     }
    +   *     String nextPageToken = response.getNextPageToken();
    +   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    +   *       request = request.toBuilder().setPageToken(nextPageToken).build();
    +   *     } else {
    +   *       break;
    +   *     }
    +   *   }
    +   * }
    +   * }
    */ public final UnaryCallable listModelEvaluationsCallable() { diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/PredictionServiceClient.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/PredictionServiceClient.java index a01cc5d0a..98012e209 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/PredictionServiceClient.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/PredictionServiceClient.java @@ -40,6 +40,15 @@ *

    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
    + * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    + *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    + *   ExamplePayload payload = ExamplePayload.newBuilder().build();
    + *   Map params = new HashMap<>();
    + *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
    + * }
    + * }
    + * *

    Note: close() needs to be called on the PredictionServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -175,6 +184,17 @@ public final OperationsClient getOperationsClient() { *

  • Text Sentiment - TextSnippet, content up 500 characters, UTF-8 encoded. * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   ExamplePayload payload = ExamplePayload.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the prediction. * @param payload Required. Payload to perform a prediction on. The payload must match the problem * type that the model was trained to solve. @@ -231,6 +251,17 @@ public final PredictResponse predict( *
  • Text Sentiment - TextSnippet, content up 500 characters, UTF-8 encoded. * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   ExamplePayload payload = ExamplePayload.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the prediction. * @param payload Required. Payload to perform a prediction on. The payload must match the problem * type that the model was trained to solve. @@ -283,6 +314,20 @@ public final PredictResponse predict( *
  • Text Sentiment - TextSnippet, content up 500 characters, UTF-8 encoded. * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   PredictRequest request =
    +   *       PredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setPayload(ExamplePayload.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   PredictResponse response = predictionServiceClient.predict(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 */ @@ -312,6 +357,21 @@ public final PredictResponse predict(PredictRequest request) { * * *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   PredictRequest request =
    +   *       PredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setPayload(ExamplePayload.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       predictionServiceClient.predictCallable().futureCall(request);
    +   *   // Do something.
    +   *   PredictResponse response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable predictCallable() { return stub.predictCallable(); @@ -335,6 +395,19 @@ public final UnaryCallable predictCallable() { *
  • Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    +   *   BatchPredictInputConfig inputConfig = BatchPredictInputConfig.newBuilder().build();
    +   *   BatchPredictOutputConfig outputConfig = BatchPredictOutputConfig.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   BatchPredictResult response =
    +   *       predictionServiceClient.batchPredictAsync(name, inputConfig, outputConfig, params).get();
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the batch prediction. * @param inputConfig Required. The input configuration for batch prediction. * @param outputConfig Required. The Configuration specifying where output predictions should be @@ -432,6 +505,19 @@ public final OperationFuture batchPredict *
  • Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
    +   *   BatchPredictInputConfig inputConfig = BatchPredictInputConfig.newBuilder().build();
    +   *   BatchPredictOutputConfig outputConfig = BatchPredictOutputConfig.newBuilder().build();
    +   *   Map params = new HashMap<>();
    +   *   BatchPredictResult response =
    +   *       predictionServiceClient.batchPredictAsync(name, inputConfig, outputConfig, params).get();
    +   * }
    +   * }
    + * * @param name Required. Name of the model requested to serve the batch prediction. * @param inputConfig Required. The input configuration for batch prediction. * @param outputConfig Required. The Configuration specifying where output predictions should be @@ -529,6 +615,21 @@ public final OperationFuture batchPredict *
  • Tables * * + *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   BatchPredictResult response = predictionServiceClient.batchPredictAsync(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 */ @@ -556,6 +657,22 @@ public final OperationFuture batchPredict * * *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   OperationFuture future =
    +   *       predictionServiceClient.batchPredictOperationCallable().futureCall(request);
    +   *   // Do something.
    +   *   BatchPredictResult response = future.get();
    +   * }
    +   * }
    */ public final OperationCallable batchPredictOperationCallable() { @@ -581,6 +698,22 @@ public final OperationFuture batchPredict * * *

    Sample code: + * + *

    {@code
    +   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    +   *   BatchPredictRequest request =
    +   *       BatchPredictRequest.newBuilder()
    +   *           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
    +   *           .setInputConfig(BatchPredictInputConfig.newBuilder().build())
    +   *           .setOutputConfig(BatchPredictOutputConfig.newBuilder().build())
    +   *           .putAllParams(new HashMap())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       predictionServiceClient.batchPredictCallable().futureCall(request);
    +   *   // Do something.
    +   *   Operation response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable batchPredictCallable() { return stub.batchPredictCallable(); diff --git a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/package-info.java b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/package-info.java index 67b605844..96f613a5c 100644 --- a/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/package-info.java +++ b/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/package-info.java @@ -26,6 +26,15 @@ * *

    Sample for PredictionServiceClient: * + *

    {@code
    + * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
    + *   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    + *   ExamplePayload payload = ExamplePayload.newBuilder().build();
    + *   Map params = new HashMap<>();
    + *   PredictResponse response = predictionServiceClient.predict(name, payload, params);
    + * }
    + * }
    + * *

    ======================= AutoMlClient ======================= * *

    Service Description: AutoML Server API. @@ -43,6 +52,14 @@ * either of those cases is accepted. * *

    Sample for AutoMlClient: + * + *

    {@code
    + * try (AutoMlClient autoMlClient = AutoMlClient.create()) {
    + *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    + *   Dataset dataset = Dataset.newBuilder().build();
    + *   Dataset response = autoMlClient.createDataset(parent, dataset);
    + * }
    + * }
    */ @Generated("by gapic-generator-java") package com.google.cloud.automl.v1beta1; diff --git a/synth.metadata b/synth.metadata index 44dfc8901..663eb7c55 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-automl.git", - "sha": "6a33cff3b7e656ef546224917e6b95c7d892d69d" + "sha": "051d91ef659cb81f286edfa8de783da7f73730be" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {