All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.lookoutvision.DefaultLookoutVisionClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Lookout Vision module holds the client classes that are used for communicating with Lookout Vision.

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.lookoutvision;

import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.runtime.transform.StreamingRequestMarshaller;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.lookoutvision.model.AccessDeniedException;
import software.amazon.awssdk.services.lookoutvision.model.ConflictException;
import software.amazon.awssdk.services.lookoutvision.model.CreateDatasetRequest;
import software.amazon.awssdk.services.lookoutvision.model.CreateDatasetResponse;
import software.amazon.awssdk.services.lookoutvision.model.CreateModelRequest;
import software.amazon.awssdk.services.lookoutvision.model.CreateModelResponse;
import software.amazon.awssdk.services.lookoutvision.model.CreateProjectRequest;
import software.amazon.awssdk.services.lookoutvision.model.CreateProjectResponse;
import software.amazon.awssdk.services.lookoutvision.model.DeleteDatasetRequest;
import software.amazon.awssdk.services.lookoutvision.model.DeleteDatasetResponse;
import software.amazon.awssdk.services.lookoutvision.model.DeleteModelRequest;
import software.amazon.awssdk.services.lookoutvision.model.DeleteModelResponse;
import software.amazon.awssdk.services.lookoutvision.model.DeleteProjectRequest;
import software.amazon.awssdk.services.lookoutvision.model.DeleteProjectResponse;
import software.amazon.awssdk.services.lookoutvision.model.DescribeDatasetRequest;
import software.amazon.awssdk.services.lookoutvision.model.DescribeDatasetResponse;
import software.amazon.awssdk.services.lookoutvision.model.DescribeModelPackagingJobRequest;
import software.amazon.awssdk.services.lookoutvision.model.DescribeModelPackagingJobResponse;
import software.amazon.awssdk.services.lookoutvision.model.DescribeModelRequest;
import software.amazon.awssdk.services.lookoutvision.model.DescribeModelResponse;
import software.amazon.awssdk.services.lookoutvision.model.DescribeProjectRequest;
import software.amazon.awssdk.services.lookoutvision.model.DescribeProjectResponse;
import software.amazon.awssdk.services.lookoutvision.model.DetectAnomaliesRequest;
import software.amazon.awssdk.services.lookoutvision.model.DetectAnomaliesResponse;
import software.amazon.awssdk.services.lookoutvision.model.InternalServerException;
import software.amazon.awssdk.services.lookoutvision.model.ListDatasetEntriesRequest;
import software.amazon.awssdk.services.lookoutvision.model.ListDatasetEntriesResponse;
import software.amazon.awssdk.services.lookoutvision.model.ListModelPackagingJobsRequest;
import software.amazon.awssdk.services.lookoutvision.model.ListModelPackagingJobsResponse;
import software.amazon.awssdk.services.lookoutvision.model.ListModelsRequest;
import software.amazon.awssdk.services.lookoutvision.model.ListModelsResponse;
import software.amazon.awssdk.services.lookoutvision.model.ListProjectsRequest;
import software.amazon.awssdk.services.lookoutvision.model.ListProjectsResponse;
import software.amazon.awssdk.services.lookoutvision.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.lookoutvision.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.lookoutvision.model.LookoutVisionException;
import software.amazon.awssdk.services.lookoutvision.model.LookoutVisionRequest;
import software.amazon.awssdk.services.lookoutvision.model.ResourceNotFoundException;
import software.amazon.awssdk.services.lookoutvision.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.lookoutvision.model.StartModelPackagingJobRequest;
import software.amazon.awssdk.services.lookoutvision.model.StartModelPackagingJobResponse;
import software.amazon.awssdk.services.lookoutvision.model.StartModelRequest;
import software.amazon.awssdk.services.lookoutvision.model.StartModelResponse;
import software.amazon.awssdk.services.lookoutvision.model.StopModelRequest;
import software.amazon.awssdk.services.lookoutvision.model.StopModelResponse;
import software.amazon.awssdk.services.lookoutvision.model.TagResourceRequest;
import software.amazon.awssdk.services.lookoutvision.model.TagResourceResponse;
import software.amazon.awssdk.services.lookoutvision.model.ThrottlingException;
import software.amazon.awssdk.services.lookoutvision.model.UntagResourceRequest;
import software.amazon.awssdk.services.lookoutvision.model.UntagResourceResponse;
import software.amazon.awssdk.services.lookoutvision.model.UpdateDatasetEntriesRequest;
import software.amazon.awssdk.services.lookoutvision.model.UpdateDatasetEntriesResponse;
import software.amazon.awssdk.services.lookoutvision.model.ValidationException;
import software.amazon.awssdk.services.lookoutvision.paginators.ListDatasetEntriesIterable;
import software.amazon.awssdk.services.lookoutvision.paginators.ListModelPackagingJobsIterable;
import software.amazon.awssdk.services.lookoutvision.paginators.ListModelsIterable;
import software.amazon.awssdk.services.lookoutvision.paginators.ListProjectsIterable;
import software.amazon.awssdk.services.lookoutvision.transform.CreateDatasetRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.CreateModelRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.CreateProjectRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DeleteDatasetRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DeleteModelRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DeleteProjectRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DescribeDatasetRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DescribeModelPackagingJobRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DescribeModelRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DescribeProjectRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.DetectAnomaliesRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.ListDatasetEntriesRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.ListModelPackagingJobsRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.ListModelsRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.ListProjectsRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.StartModelPackagingJobRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.StartModelRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.StopModelRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.lookoutvision.transform.UpdateDatasetEntriesRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link LookoutVisionClient}.
 *
 * @see LookoutVisionClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultLookoutVisionClient implements LookoutVisionClient {
    private static final Logger log = Logger.loggerFor(DefaultLookoutVisionClient.class);

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    private final LookoutVisionServiceClientConfiguration serviceClientConfiguration;

    protected DefaultLookoutVisionClient(LookoutVisionServiceClientConfiguration serviceClientConfiguration,
            SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration;
        this.serviceClientConfiguration = serviceClientConfiguration;
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Creates a new dataset in an Amazon Lookout for Vision project. CreateDataset can create a training * or a test dataset from a valid dataset source (DatasetSource). *

*

* If you want a single dataset project, specify train for the value of DatasetType. *

*

* To have a project with separate training and test datasets, call CreateDataset twice. On the first * call, specify train for the value of DatasetType. On the second call, specify * test for the value of DatasetType. *

*

* This operation requires permissions to perform the lookoutvision:CreateDataset operation. *

* * @param createDatasetRequest * @return Result of the CreateDataset operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.CreateDataset * @see AWS * API Documentation */ @Override public CreateDatasetResponse createDataset(CreateDatasetRequest createDatasetRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateDatasetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDatasetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateDataset").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createDatasetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateDatasetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new version of a model within an an Amazon Lookout for Vision project. CreateModel is an * asynchronous operation in which Amazon Lookout for Vision trains, tests, and evaluates a new version of a model. *

*

* To get the current status, check the Status field returned in the response from * DescribeModel. *

*

* If the project has a single dataset, Amazon Lookout for Vision internally splits the dataset to create a training * and a test dataset. If the project has a training and a test dataset, Lookout for Vision uses the respective * datasets to train and test the model. *

*

* After training completes, the evaluation metrics are stored at the location specified in * OutputConfig. *

*

* This operation requires permissions to perform the lookoutvision:CreateModel operation. If you want * to tag your model, you also require permission to the lookoutvision:TagResource operation. *

* * @param createModelRequest * @return Result of the CreateModel operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.CreateModel * @see AWS API * Documentation */ @Override public CreateModelResponse createModel(CreateModelRequest createModelRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateModelResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createModelRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateModel"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateModel").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createModelRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateModelRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates an empty Amazon Lookout for Vision project. After you create the project, add a dataset by calling * CreateDataset. *

*

* This operation requires permissions to perform the lookoutvision:CreateProject operation. *

* * @param createProjectRequest * @return Result of the CreateProject operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.CreateProject * @see AWS * API Documentation */ @Override public CreateProjectResponse createProject(CreateProjectRequest createProjectRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateProjectResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createProjectRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateProject"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateProject").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createProjectRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateProjectRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an existing Amazon Lookout for Vision dataset. *

*

* If your the project has a single dataset, you must create a new dataset before you can create a model. *

*

* If you project has a training dataset and a test dataset consider the following. *

*
    *
  • *

    * If you delete the test dataset, your project reverts to a single dataset project. If you then train the model, * Amazon Lookout for Vision internally splits the remaining dataset into a training and test dataset. *

    *
  • *
  • *

    * If you delete the training dataset, you must create a training dataset before you can create a model. *

    *
  • *
*

* This operation requires permissions to perform the lookoutvision:DeleteDataset operation. *

* * @param deleteDatasetRequest * @return Result of the DeleteDataset operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DeleteDataset * @see AWS * API Documentation */ @Override public DeleteDatasetResponse deleteDataset(DeleteDatasetRequest deleteDatasetRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteDatasetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDatasetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteDataset").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteDatasetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteDatasetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an Amazon Lookout for Vision model. You can't delete a running model. To stop a running model, use the * StopModel operation. *

*

* It might take a few seconds to delete a model. To determine if a model has been deleted, call ListModels * and check if the version of the model (ModelVersion) is in the Models array. *

*

*

* This operation requires permissions to perform the lookoutvision:DeleteModel operation. *

* * @param deleteModelRequest * @return Result of the DeleteModel operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DeleteModel * @see AWS API * Documentation */ @Override public DeleteModelResponse deleteModel(DeleteModelRequest deleteModelRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteModelResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteModelRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteModel"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteModel").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteModelRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteModelRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an Amazon Lookout for Vision project. *

*

* To delete a project, you must first delete each version of the model associated with the project. To delete a * model use the DeleteModel operation. *

*

* You also have to delete the dataset(s) associated with the model. For more information, see DeleteDataset. * The images referenced by the training and test datasets aren't deleted. *

*

* This operation requires permissions to perform the lookoutvision:DeleteProject operation. *

* * @param deleteProjectRequest * @return Result of the DeleteProject operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DeleteProject * @see AWS * API Documentation */ @Override public DeleteProjectResponse deleteProject(DeleteProjectRequest deleteProjectRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteProjectResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteProjectRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteProject"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteProject").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteProjectRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteProjectRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describe an Amazon Lookout for Vision dataset. *

*

* This operation requires permissions to perform the lookoutvision:DescribeDataset operation. *

* * @param describeDatasetRequest * @return Result of the DescribeDataset operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DescribeDataset * @see AWS * API Documentation */ @Override public DescribeDatasetResponse describeDataset(DescribeDatasetRequest describeDatasetRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeDatasetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDatasetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDataset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeDataset").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeDatasetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeDatasetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes a version of an Amazon Lookout for Vision model. *

*

* This operation requires permissions to perform the lookoutvision:DescribeModel operation. *

* * @param describeModelRequest * @return Result of the DescribeModel operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DescribeModel * @see AWS * API Documentation */ @Override public DescribeModelResponse describeModel(DescribeModelRequest describeModelRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeModelResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeModelRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeModel"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeModel").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeModelRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeModelRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes an Amazon Lookout for Vision model packaging job. *

*

* This operation requires permissions to perform the lookoutvision:DescribeModelPackagingJob * operation. *

*

* For more information, see Using your Amazon Lookout for Vision model on an edge device in the Amazon * Lookout for Vision Developer Guide. *

* * @param describeModelPackagingJobRequest * @return Result of the DescribeModelPackagingJob operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DescribeModelPackagingJob * @see AWS API Documentation */ @Override public DescribeModelPackagingJobResponse describeModelPackagingJob( DescribeModelPackagingJobRequest describeModelPackagingJobRequest) throws AccessDeniedException, InternalServerException, ValidationException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeModelPackagingJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeModelPackagingJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeModelPackagingJob"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeModelPackagingJob").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeModelPackagingJobRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeModelPackagingJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes an Amazon Lookout for Vision project. *

*

* This operation requires permissions to perform the lookoutvision:DescribeProject operation. *

* * @param describeProjectRequest * @return Result of the DescribeProject operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DescribeProject * @see AWS * API Documentation */ @Override public DescribeProjectResponse describeProject(DescribeProjectRequest describeProjectRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeProjectResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeProjectRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeProject"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeProject").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeProjectRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeProjectRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Detects anomalies in an image that you supply. *

*

* The response from DetectAnomalies includes a boolean prediction that the image contains one or more * anomalies and a confidence value for the prediction. If the model is an image segmentation model, the response * also includes segmentation information for each type of anomaly found in the image. *

* *

* Before calling DetectAnomalies, you must first start your model with the StartModel * operation. You are charged for the amount of time, in minutes, that a model runs and for the number of anomaly * detection units that your model uses. If you are not using a model, use the StopModel operation to stop * your model. *

*
*

* For more information, see Detecting anomalies in an image in the Amazon Lookout for Vision developer * guide. *

*

* This operation requires permissions to perform the lookoutvision:DetectAnomalies operation. *

* * @param detectAnomaliesRequest * @param requestBody * The content to send to the service. A {@link RequestBody} can be created using one of several factory * methods for various sources of data. For example, to create a request body from a file you can do the * following. * *
     * {@code RequestBody.fromFile(new File("myfile.txt"))}
     * 
* * See documentation in {@link RequestBody} for additional details and which sources of data are supported. * The service documentation for the request content is as follows ' *

* The unencrypted image bytes that you want to analyze. *

* ' * @return Result of the DetectAnomalies operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.DetectAnomalies * @see AWS * API Documentation */ @Override public DetectAnomaliesResponse detectAnomalies(DetectAnomaliesRequest detectAnomaliesRequest, RequestBody requestBody) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DetectAnomaliesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, detectAnomaliesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DetectAnomalies"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DetectAnomalies") .withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler) .withInput(detectAnomaliesRequest) .withMetricCollector(apiCallMetricCollector) .withRequestBody(requestBody) .withMarshaller( StreamingRequestMarshaller.builder() .delegateMarshaller(new DetectAnomaliesRequestMarshaller(protocolFactory)) .requestBody(requestBody).requiresLength(true).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the JSON Lines within a dataset. An Amazon Lookout for Vision JSON Line contains the anomaly information * for a single image, including the image location and the assigned label. *

*

* This operation requires permissions to perform the lookoutvision:ListDatasetEntries operation. *

* * @param listDatasetEntriesRequest * @return Result of the ListDatasetEntries operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListDatasetEntries * @see AWS API Documentation */ @Override public ListDatasetEntriesResponse listDatasetEntries(ListDatasetEntriesRequest listDatasetEntriesRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListDatasetEntriesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDatasetEntriesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDatasetEntries"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListDatasetEntries").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listDatasetEntriesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListDatasetEntriesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the JSON Lines within a dataset. An Amazon Lookout for Vision JSON Line contains the anomaly information * for a single image, including the image location and the assigned label. *

*

* This operation requires permissions to perform the lookoutvision:ListDatasetEntries operation. *

*
*

* This is a variant of * {@link #listDatasetEntries(software.amazon.awssdk.services.lookoutvision.model.ListDatasetEntriesRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListDatasetEntriesIterable responses = client.listDatasetEntriesPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.lookoutvision.paginators.ListDatasetEntriesIterable responses = client
     *             .listDatasetEntriesPaginator(request);
     *     for (software.amazon.awssdk.services.lookoutvision.model.ListDatasetEntriesResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListDatasetEntriesIterable responses = client.listDatasetEntriesPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listDatasetEntries(software.amazon.awssdk.services.lookoutvision.model.ListDatasetEntriesRequest)} * operation. *

* * @param listDatasetEntriesRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListDatasetEntries * @see AWS API Documentation */ @Override public ListDatasetEntriesIterable listDatasetEntriesPaginator(ListDatasetEntriesRequest listDatasetEntriesRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { return new ListDatasetEntriesIterable(this, applyPaginatorUserAgent(listDatasetEntriesRequest)); } /** *

* Lists the model packaging jobs created for an Amazon Lookout for Vision project. *

*

* This operation requires permissions to perform the lookoutvision:ListModelPackagingJobs operation. *

*

* For more information, see Using your Amazon Lookout for Vision model on an edge device in the Amazon * Lookout for Vision Developer Guide. *

* * @param listModelPackagingJobsRequest * @return Result of the ListModelPackagingJobs operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListModelPackagingJobs * @see AWS API Documentation */ @Override public ListModelPackagingJobsResponse listModelPackagingJobs(ListModelPackagingJobsRequest listModelPackagingJobsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListModelPackagingJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listModelPackagingJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListModelPackagingJobs"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListModelPackagingJobs").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listModelPackagingJobsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListModelPackagingJobsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the model packaging jobs created for an Amazon Lookout for Vision project. *

*

* This operation requires permissions to perform the lookoutvision:ListModelPackagingJobs operation. *

*

* For more information, see Using your Amazon Lookout for Vision model on an edge device in the Amazon * Lookout for Vision Developer Guide. *

*
*

* This is a variant of * {@link #listModelPackagingJobs(software.amazon.awssdk.services.lookoutvision.model.ListModelPackagingJobsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListModelPackagingJobsIterable responses = client.listModelPackagingJobsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.lookoutvision.paginators.ListModelPackagingJobsIterable responses = client
     *             .listModelPackagingJobsPaginator(request);
     *     for (software.amazon.awssdk.services.lookoutvision.model.ListModelPackagingJobsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListModelPackagingJobsIterable responses = client.listModelPackagingJobsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listModelPackagingJobs(software.amazon.awssdk.services.lookoutvision.model.ListModelPackagingJobsRequest)} * operation. *

* * @param listModelPackagingJobsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListModelPackagingJobs * @see AWS API Documentation */ @Override public ListModelPackagingJobsIterable listModelPackagingJobsPaginator( ListModelPackagingJobsRequest listModelPackagingJobsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { return new ListModelPackagingJobsIterable(this, applyPaginatorUserAgent(listModelPackagingJobsRequest)); } /** *

* Lists the versions of a model in an Amazon Lookout for Vision project. *

*

* The ListModels operation is eventually consistent. Recent calls to CreateModel might * take a while to appear in the response from ListProjects. *

*

* This operation requires permissions to perform the lookoutvision:ListModels operation. *

* * @param listModelsRequest * @return Result of the ListModels operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListModels * @see AWS API * Documentation */ @Override public ListModelsResponse listModels(ListModelsRequest listModelsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListModelsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listModelsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListModels"); return clientHandler .execute(new ClientExecutionParams().withOperationName("ListModels") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(listModelsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListModelsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the versions of a model in an Amazon Lookout for Vision project. *

*

* The ListModels operation is eventually consistent. Recent calls to CreateModel might * take a while to appear in the response from ListProjects. *

*

* This operation requires permissions to perform the lookoutvision:ListModels operation. *

*
*

* This is a variant of {@link #listModels(software.amazon.awssdk.services.lookoutvision.model.ListModelsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListModelsIterable responses = client.listModelsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.lookoutvision.paginators.ListModelsIterable responses = client.listModelsPaginator(request);
     *     for (software.amazon.awssdk.services.lookoutvision.model.ListModelsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListModelsIterable responses = client.listModelsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listModels(software.amazon.awssdk.services.lookoutvision.model.ListModelsRequest)} operation. *

* * @param listModelsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListModels * @see AWS API * Documentation */ @Override public ListModelsIterable listModelsPaginator(ListModelsRequest listModelsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { return new ListModelsIterable(this, applyPaginatorUserAgent(listModelsRequest)); } /** *

* Lists the Amazon Lookout for Vision projects in your AWS account that are in the AWS Region in which you call * ListProjects. *

*

* The ListProjects operation is eventually consistent. Recent calls to CreateProject and * DeleteProject might take a while to appear in the response from ListProjects. *

*

* This operation requires permissions to perform the lookoutvision:ListProjects operation. *

* * @param listProjectsRequest * @return Result of the ListProjects operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListProjects * @see AWS * API Documentation */ @Override public ListProjectsResponse listProjects(ListProjectsRequest listProjectsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListProjectsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listProjectsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListProjects"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListProjects").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listProjectsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListProjectsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the Amazon Lookout for Vision projects in your AWS account that are in the AWS Region in which you call * ListProjects. *

*

* The ListProjects operation is eventually consistent. Recent calls to CreateProject and * DeleteProject might take a while to appear in the response from ListProjects. *

*

* This operation requires permissions to perform the lookoutvision:ListProjects operation. *

*
*

* This is a variant of * {@link #listProjects(software.amazon.awssdk.services.lookoutvision.model.ListProjectsRequest)} operation. The * return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle * making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListProjectsIterable responses = client.listProjectsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.lookoutvision.paginators.ListProjectsIterable responses = client
     *             .listProjectsPaginator(request);
     *     for (software.amazon.awssdk.services.lookoutvision.model.ListProjectsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.lookoutvision.paginators.ListProjectsIterable responses = client.listProjectsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listProjects(software.amazon.awssdk.services.lookoutvision.model.ListProjectsRequest)} operation. *

* * @param listProjectsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListProjects * @see AWS * API Documentation */ @Override public ListProjectsIterable listProjectsPaginator(ListProjectsRequest listProjectsRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { return new ListProjectsIterable(this, applyPaginatorUserAgent(listProjectsRequest)); } /** *

* Returns a list of tags attached to the specified Amazon Lookout for Vision model. *

*

* This operation requires permissions to perform the lookoutvision:ListTagsForResource operation. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.ListTagsForResource * @see AWS API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Starts the running of the version of an Amazon Lookout for Vision model. Starting a model takes a while to * complete. To check the current state of the model, use DescribeModel. *

*

* A model is ready to use when its status is HOSTED. *

*

* Once the model is running, you can detect custom labels in new images by calling DetectAnomalies. *

* *

* You are charged for the amount of time that the model is running. To stop a running model, call StopModel. *

*
*

* This operation requires permissions to perform the lookoutvision:StartModel operation. *

* * @param startModelRequest * @return Result of the StartModel operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.StartModel * @see AWS API * Documentation */ @Override public StartModelResponse startModel(StartModelRequest startModelRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StartModelResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, startModelRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartModel"); return clientHandler .execute(new ClientExecutionParams().withOperationName("StartModel") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(startModelRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartModelRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Starts an Amazon Lookout for Vision model packaging job. A model packaging job creates an AWS IoT Greengrass * component for a Lookout for Vision model. You can use the component to deploy your model to an edge device * managed by Greengrass. *

*

* Use the DescribeModelPackagingJob API to determine the current status of the job. The model packaging job * is complete if the value of Status is SUCCEEDED. *

*

* To deploy the component to the target device, use the component name and component version with the AWS IoT * Greengrass CreateDeployment API. *

*

* This operation requires the following permissions: *

*
    *
  • *

    * lookoutvision:StartModelPackagingJob *

    *
  • *
  • *

    * s3:PutObject *

    *
  • *
  • *

    * s3:GetBucketLocation *

    *
  • *
  • *

    * kms:GenerateDataKey *

    *
  • *
  • *

    * greengrass:CreateComponentVersion *

    *
  • *
  • *

    * greengrass:DescribeComponent *

    *
  • *
  • *

    * (Optional) greengrass:TagResource. Only required if you want to tag the component. *

    *
  • *
*

* For more information, see Using your Amazon Lookout for Vision model on an edge device in the Amazon * Lookout for Vision Developer Guide. *

* * @param startModelPackagingJobRequest * @return Result of the StartModelPackagingJob operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.StartModelPackagingJob * @see AWS API Documentation */ @Override public StartModelPackagingJobResponse startModelPackagingJob(StartModelPackagingJobRequest startModelPackagingJobRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartModelPackagingJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, startModelPackagingJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartModelPackagingJob"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("StartModelPackagingJob").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(startModelPackagingJobRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartModelPackagingJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Stops the hosting of a running model. The operation might take a while to complete. To check the current status, * call DescribeModel. *

*

* After the model hosting stops, the Status of the model is TRAINED. *

*

* This operation requires permissions to perform the lookoutvision:StopModel operation. *

* * @param stopModelRequest * @return Result of the StopModel operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.StopModel * @see AWS API * Documentation */ @Override public StopModelResponse stopModel(StopModelRequest stopModelRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StopModelResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopModelRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopModel"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StopModel").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(stopModelRequest) .withMetricCollector(apiCallMetricCollector).withMarshaller(new StopModelRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds one or more key-value tags to an Amazon Lookout for Vision model. For more information, see Tagging a * model in the Amazon Lookout for Vision Developer Guide. *

*

* This operation requires permissions to perform the lookoutvision:TagResource operation. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws ServiceQuotaExceededException * A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for * Vision in the Amazon Lookout for Vision Developer Guide. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes one or more tags from an Amazon Lookout for Vision model. For more information, see Tagging a * model in the Amazon Lookout for Vision Developer Guide. *

*

* This operation requires permissions to perform the lookoutvision:UntagResource operation. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.UntagResource * @see AWS * API Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds or updates one or more JSON Line entries in a dataset. A JSON Line includes information about an image used * for training or testing an Amazon Lookout for Vision model. *

*

* To update an existing JSON Line, use the source-ref field to identify the JSON Line. The JSON line * that you supply replaces the existing JSON line. Any existing annotations that are not in the new JSON line are * removed from the dataset. *

*

* For more information, see Defining JSON lines for anomaly classification in the Amazon Lookout for Vision * Developer Guide. *

* *

* The images you reference in the source-ref field of a JSON line, must be in the same S3 bucket as * the existing images in the dataset. *

*
*

* Updating a dataset might take a while to complete. To check the current status, call DescribeDataset and * check the Status field in the response. *

*

* This operation requires permissions to perform the lookoutvision:UpdateDatasetEntries operation. *

* * @param updateDatasetEntriesRequest * @return Result of the UpdateDatasetEntries operation returned by the service. * @throws AccessDeniedException * You are not authorized to perform the action. * @throws InternalServerException * Amazon Lookout for Vision experienced a service issue. Try your call again. * @throws ValidationException * An input validation error occured. For example, invalid characters in a project name, or if a pagination * token is invalid. * @throws ConflictException * The update or deletion of a resource caused an inconsistent state. * @throws ResourceNotFoundException * The resource could not be found. * @throws ThrottlingException * Amazon Lookout for Vision is temporarily unable to process the request. Try your call again. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws LookoutVisionException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample LookoutVisionClient.UpdateDatasetEntries * @see AWS API Documentation */ @Override public UpdateDatasetEntriesResponse updateDatasetEntries(UpdateDatasetEntriesRequest updateDatasetEntriesRequest) throws AccessDeniedException, InternalServerException, ValidationException, ConflictException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, LookoutVisionException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateDatasetEntriesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDatasetEntriesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "LookoutVision"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDatasetEntries"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateDatasetEntries").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateDatasetEntriesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateDatasetEntriesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } private T applyPaginatorUserAgent(T request) { Consumer userAgentApplier = b -> b.addApiName(ApiName.builder() .version(VersionInfo.SDK_VERSION).name("PAGINATED").build()); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() .map(c -> c.toBuilder().applyMutation(userAgentApplier).build()) .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(LookoutVisionException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()); } @Override public final LookoutVisionServiceClientConfiguration serviceClientConfiguration() { return this.serviceClientConfiguration; } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy