/* * Copyright 2010-2023 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 com.amazonaws.services.rekognition.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* Creates a new Amazon Rekognition Custom Labels dataset. You can create a * dataset by using an Amazon Sagemaker format manifest file or by copying an * existing Amazon Rekognition Custom Labels dataset. *

*

* To create a training dataset for a project, specify train for * the value of DatasetType. To create the test dataset for a * project, specify test for the value of DatasetType. *

*

* The response from CreateDataset is the Amazon Resource Name * (ARN) for the dataset. Creating a dataset takes a while to complete. Use * DescribeDataset to check the current status. The dataset created * successfully if the value of Status is * CREATE_COMPLETE. *

*

* To check if any non-terminal errors occurred, call ListDatasetEntries * and check for the presence of errors lists in the JSON Lines. *

*

* Dataset creation fails if a terminal error occurs (Status = * CREATE_FAILED). Currently, you can't access the terminal error * information. *

*

* For more information, see Creating dataset in the Amazon Rekognition * Custom Labels Developer Guide. *

*

* This operation requires permissions to perform the * rekognition:CreateDataset action. If you want to copy an * existing dataset, you also require permission to perform the * rekognition:ListDatasetEntries action. *

*/ public class CreateDatasetRequest extends AmazonWebServiceRequest implements Serializable { /** *

* The source files for the dataset. You can specify the ARN of an existing * dataset or specify the Amazon S3 bucket location of an Amazon Sagemaker * format manifest file. If you don't specify datasetSource, an * empty dataset is created. To add labeled images to the dataset, You can * use the console or call UpdateDatasetEntries. *

*/ private DatasetSource datasetSource; /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Constraints:
* Allowed Values: TRAIN, TEST */ private String datasetType; /** *

* The ARN of the Amazon Rekognition Custom Labels project to which you want * to asssign the dataset. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: * (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA * -Z0-9_.\-]{1,255}\/[0-9]+$)
*/ private String projectArn; /** *

* The source files for the dataset. You can specify the ARN of an existing * dataset or specify the Amazon S3 bucket location of an Amazon Sagemaker * format manifest file. If you don't specify datasetSource, an * empty dataset is created. To add labeled images to the dataset, You can * use the console or call UpdateDatasetEntries. *

* * @return

* The source files for the dataset. You can specify the ARN of an * existing dataset or specify the Amazon S3 bucket location of an * Amazon Sagemaker format manifest file. If you don't specify * datasetSource, an empty dataset is created. To add * labeled images to the dataset, You can use the console or call * UpdateDatasetEntries. *

*/ public DatasetSource getDatasetSource() { return datasetSource; } /** *

* The source files for the dataset. You can specify the ARN of an existing * dataset or specify the Amazon S3 bucket location of an Amazon Sagemaker * format manifest file. If you don't specify datasetSource, an * empty dataset is created. To add labeled images to the dataset, You can * use the console or call UpdateDatasetEntries. *

* * @param datasetSource

* The source files for the dataset. You can specify the ARN of * an existing dataset or specify the Amazon S3 bucket location * of an Amazon Sagemaker format manifest file. If you don't * specify datasetSource, an empty dataset is * created. To add labeled images to the dataset, You can use the * console or call UpdateDatasetEntries. *

*/ public void setDatasetSource(DatasetSource datasetSource) { this.datasetSource = datasetSource; } /** *

* The source files for the dataset. You can specify the ARN of an existing * dataset or specify the Amazon S3 bucket location of an Amazon Sagemaker * format manifest file. If you don't specify datasetSource, an * empty dataset is created. To add labeled images to the dataset, You can * use the console or call UpdateDatasetEntries. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param datasetSource

* The source files for the dataset. You can specify the ARN of * an existing dataset or specify the Amazon S3 bucket location * of an Amazon Sagemaker format manifest file. If you don't * specify datasetSource, an empty dataset is * created. To add labeled images to the dataset, You can use the * console or call UpdateDatasetEntries. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateDatasetRequest withDatasetSource(DatasetSource datasetSource) { this.datasetSource = datasetSource; return this; } /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Constraints:
* Allowed Values: TRAIN, TEST * * @return

* The type of the dataset. Specify train to create a * training dataset. Specify test to create a test * dataset. *

* @see DatasetType */ public String getDatasetType() { return datasetType; } /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Constraints:
* Allowed Values: TRAIN, TEST * * @param datasetType

* The type of the dataset. Specify train to create * a training dataset. Specify test to create a test * dataset. *

* @see DatasetType */ public void setDatasetType(String datasetType) { this.datasetType = datasetType; } /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: TRAIN, TEST * * @param datasetType

* The type of the dataset. Specify train to create * a training dataset. Specify test to create a test * dataset. *

* @return A reference to this updated object so that method calls can be * chained together. * @see DatasetType */ public CreateDatasetRequest withDatasetType(String datasetType) { this.datasetType = datasetType; return this; } /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Constraints:
* Allowed Values: TRAIN, TEST * * @param datasetType

* The type of the dataset. Specify train to create * a training dataset. Specify test to create a test * dataset. *

* @see DatasetType */ public void setDatasetType(DatasetType datasetType) { this.datasetType = datasetType.toString(); } /** *

* The type of the dataset. Specify train to create a training * dataset. Specify test to create a test dataset. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: TRAIN, TEST * * @param datasetType

* The type of the dataset. Specify train to create * a training dataset. Specify test to create a test * dataset. *

* @return A reference to this updated object so that method calls can be * chained together. * @see DatasetType */ public CreateDatasetRequest withDatasetType(DatasetType datasetType) { this.datasetType = datasetType.toString(); return this; } /** *

* The ARN of the Amazon Rekognition Custom Labels project to which you want * to asssign the dataset. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: * (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA * -Z0-9_.\-]{1,255}\/[0-9]+$)
* * @return

* The ARN of the Amazon Rekognition Custom Labels project to which * you want to asssign the dataset. *

*/ public String getProjectArn() { return projectArn; } /** *

* The ARN of the Amazon Rekognition Custom Labels project to which you want * to asssign the dataset. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: * (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA * -Z0-9_.\-]{1,255}\/[0-9]+$)
* * @param projectArn

* The ARN of the Amazon Rekognition Custom Labels project to * which you want to asssign the dataset. *

*/ public void setProjectArn(String projectArn) { this.projectArn = projectArn; } /** *

* The ARN of the Amazon Rekognition Custom Labels project to which you want * to asssign the dataset. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 20 - 2048
* Pattern: * (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA * -Z0-9_.\-]{1,255}\/[0-9]+$)
* * @param projectArn

* The ARN of the Amazon Rekognition Custom Labels project to * which you want to asssign the dataset. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateDatasetRequest withProjectArn(String projectArn) { this.projectArn = projectArn; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getDatasetSource() != null) sb.append("DatasetSource: " + getDatasetSource() + ","); if (getDatasetType() != null) sb.append("DatasetType: " + getDatasetType() + ","); if (getProjectArn() != null) sb.append("ProjectArn: " + getProjectArn()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDatasetSource() == null) ? 0 : getDatasetSource().hashCode()); hashCode = prime * hashCode + ((getDatasetType() == null) ? 0 : getDatasetType().hashCode()); hashCode = prime * hashCode + ((getProjectArn() == null) ? 0 : getProjectArn().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateDatasetRequest == false) return false; CreateDatasetRequest other = (CreateDatasetRequest) obj; if (other.getDatasetSource() == null ^ this.getDatasetSource() == null) return false; if (other.getDatasetSource() != null && other.getDatasetSource().equals(this.getDatasetSource()) == false) return false; if (other.getDatasetType() == null ^ this.getDatasetType() == null) return false; if (other.getDatasetType() != null && other.getDatasetType().equals(this.getDatasetType()) == false) return false; if (other.getProjectArn() == null ^ this.getProjectArn() == null) return false; if (other.getProjectArn() != null && other.getProjectArn().equals(this.getProjectArn()) == false) return false; return true; } }