/* * 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.comprehend.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* Creates a new custom model that replicates a source custom model that you * import. The source model can be in your Amazon Web Services account or * another one. *

*

* If the source model is in another Amazon Web Services account, then it must * have a resource-based policy that authorizes you to import it. *

*

* The source model must be in the same Amazon Web Services Region that you're * using when you import. You can't import a model that's in a different Region. *

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

* The Amazon Resource Name (ARN) of the custom model to import. *

*

* Constraints:
* Length: - 256
* Pattern: * arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:(document * -classifier * |entity-recognizer)/[a-zA-Z0-9](-*[a-zA-Z0-9])*(/version/[a-zA- * Z0-9](-*[a-zA-Z0-9])*)?
*/ private String sourceModelArn; /** *

* The name to assign to the custom model that is created in Amazon * Comprehend by this import. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
*/ private String modelName; /** *

* The version name given to the custom model that is created by this * import. Version names can have a maximum of 256 characters. Alphanumeric * characters, hyphens (-) and underscores (_) are allowed. The version name * must be unique among all models with the same classifier name in the * account/Region. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
*/ private String versionName; /** *

* ID for the KMS key that Amazon Comprehend uses to encrypt trained custom * models. The ModelKmsKeyId can be either of the following formats: *

* *

* Constraints:
* Length: - 2048
* Pattern: ^\p{ASCII}+$
*/ private String modelKmsKeyId; /** *

* The Amazon Resource Name (ARN) of the IAM role that grants Amazon * Comprehend permission to use Amazon Key Management Service (KMS) to * encrypt or decrypt the custom model. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+
*/ private String dataAccessRoleArn; /** *

* Tags to associate with the custom model that is created by this import. A * tag is a key-value pair that adds as a metadata to a resource used by * Amazon Comprehend. For example, a tag with "Sales" as the key might be * added to a resource to indicate its use by the sales department. *

*/ private java.util.List tags; /** *

* The Amazon Resource Name (ARN) of the custom model to import. *

*

* Constraints:
* Length: - 256
* Pattern: * arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:(document * -classifier * |entity-recognizer)/[a-zA-Z0-9](-*[a-zA-Z0-9])*(/version/[a-zA- * Z0-9](-*[a-zA-Z0-9])*)?
* * @return

* The Amazon Resource Name (ARN) of the custom model to import. *

*/ public String getSourceModelArn() { return sourceModelArn; } /** *

* The Amazon Resource Name (ARN) of the custom model to import. *

*

* Constraints:
* Length: - 256
* Pattern: * arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:(document * -classifier * |entity-recognizer)/[a-zA-Z0-9](-*[a-zA-Z0-9])*(/version/[a-zA- * Z0-9](-*[a-zA-Z0-9])*)?
* * @param sourceModelArn

* The Amazon Resource Name (ARN) of the custom model to import. *

*/ public void setSourceModelArn(String sourceModelArn) { this.sourceModelArn = sourceModelArn; } /** *

* The Amazon Resource Name (ARN) of the custom model to import. *

*

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

* Constraints:
* Length: - 256
* Pattern: * arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:(document * -classifier * |entity-recognizer)/[a-zA-Z0-9](-*[a-zA-Z0-9])*(/version/[a-zA- * Z0-9](-*[a-zA-Z0-9])*)?
* * @param sourceModelArn

* The Amazon Resource Name (ARN) of the custom model to import. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withSourceModelArn(String sourceModelArn) { this.sourceModelArn = sourceModelArn; return this; } /** *

* The name to assign to the custom model that is created in Amazon * Comprehend by this import. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @return

* The name to assign to the custom model that is created in Amazon * Comprehend by this import. *

*/ public String getModelName() { return modelName; } /** *

* The name to assign to the custom model that is created in Amazon * Comprehend by this import. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @param modelName

* The name to assign to the custom model that is created in * Amazon Comprehend by this import. *

*/ public void setModelName(String modelName) { this.modelName = modelName; } /** *

* The name to assign to the custom model that is created in Amazon * Comprehend by this import. *

*

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

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @param modelName

* The name to assign to the custom model that is created in * Amazon Comprehend by this import. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withModelName(String modelName) { this.modelName = modelName; return this; } /** *

* The version name given to the custom model that is created by this * import. Version names can have a maximum of 256 characters. Alphanumeric * characters, hyphens (-) and underscores (_) are allowed. The version name * must be unique among all models with the same classifier name in the * account/Region. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @return

* The version name given to the custom model that is created by * this import. Version names can have a maximum of 256 characters. * Alphanumeric characters, hyphens (-) and underscores (_) are * allowed. The version name must be unique among all models with * the same classifier name in the account/Region. *

*/ public String getVersionName() { return versionName; } /** *

* The version name given to the custom model that is created by this * import. Version names can have a maximum of 256 characters. Alphanumeric * characters, hyphens (-) and underscores (_) are allowed. The version name * must be unique among all models with the same classifier name in the * account/Region. *

*

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @param versionName

* The version name given to the custom model that is created by * this import. Version names can have a maximum of 256 * characters. Alphanumeric characters, hyphens (-) and * underscores (_) are allowed. The version name must be unique * among all models with the same classifier name in the * account/Region. *

*/ public void setVersionName(String versionName) { this.versionName = versionName; } /** *

* The version name given to the custom model that is created by this * import. Version names can have a maximum of 256 characters. Alphanumeric * characters, hyphens (-) and underscores (_) are allowed. The version name * must be unique among all models with the same classifier name in the * account/Region. *

*

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

* Constraints:
* Length: - 63
* Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9])*$
* * @param versionName

* The version name given to the custom model that is created by * this import. Version names can have a maximum of 256 * characters. Alphanumeric characters, hyphens (-) and * underscores (_) are allowed. The version name must be unique * among all models with the same classifier name in the * account/Region. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withVersionName(String versionName) { this.versionName = versionName; return this; } /** *

* ID for the KMS key that Amazon Comprehend uses to encrypt trained custom * models. The ModelKmsKeyId can be either of the following formats: *

* *

* Constraints:
* Length: - 2048
* Pattern: ^\p{ASCII}+$
* * @return

* ID for the KMS key that Amazon Comprehend uses to encrypt trained * custom models. The ModelKmsKeyId can be either of the following * formats: *

* */ public String getModelKmsKeyId() { return modelKmsKeyId; } /** *

* ID for the KMS key that Amazon Comprehend uses to encrypt trained custom * models. The ModelKmsKeyId can be either of the following formats: *

* *

* Constraints:
* Length: - 2048
* Pattern: ^\p{ASCII}+$
* * @param modelKmsKeyId

* ID for the KMS key that Amazon Comprehend uses to encrypt * trained custom models. The ModelKmsKeyId can be either of the * following formats: *

* */ public void setModelKmsKeyId(String modelKmsKeyId) { this.modelKmsKeyId = modelKmsKeyId; } /** *

* ID for the KMS key that Amazon Comprehend uses to encrypt trained custom * models. The ModelKmsKeyId can be either of the following formats: *

* *

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

* Constraints:
* Length: - 2048
* Pattern: ^\p{ASCII}+$
* * @param modelKmsKeyId

* ID for the KMS key that Amazon Comprehend uses to encrypt * trained custom models. The ModelKmsKeyId can be either of the * following formats: *

* * @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withModelKmsKeyId(String modelKmsKeyId) { this.modelKmsKeyId = modelKmsKeyId; return this; } /** *

* The Amazon Resource Name (ARN) of the IAM role that grants Amazon * Comprehend permission to use Amazon Key Management Service (KMS) to * encrypt or decrypt the custom model. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+
* * @return

* The Amazon Resource Name (ARN) of the IAM role that grants Amazon * Comprehend permission to use Amazon Key Management Service (KMS) * to encrypt or decrypt the custom model. *

*/ public String getDataAccessRoleArn() { return dataAccessRoleArn; } /** *

* The Amazon Resource Name (ARN) of the IAM role that grants Amazon * Comprehend permission to use Amazon Key Management Service (KMS) to * encrypt or decrypt the custom model. *

*

* Constraints:
* Length: 20 - 2048
* Pattern: arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+
* * @param dataAccessRoleArn

* The Amazon Resource Name (ARN) of the IAM role that grants * Amazon Comprehend permission to use Amazon Key Management * Service (KMS) to encrypt or decrypt the custom model. *

*/ public void setDataAccessRoleArn(String dataAccessRoleArn) { this.dataAccessRoleArn = dataAccessRoleArn; } /** *

* The Amazon Resource Name (ARN) of the IAM role that grants Amazon * Comprehend permission to use Amazon Key Management Service (KMS) to * encrypt or decrypt the custom model. *

*

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

* Constraints:
* Length: 20 - 2048
* Pattern: arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+
* * @param dataAccessRoleArn

* The Amazon Resource Name (ARN) of the IAM role that grants * Amazon Comprehend permission to use Amazon Key Management * Service (KMS) to encrypt or decrypt the custom model. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withDataAccessRoleArn(String dataAccessRoleArn) { this.dataAccessRoleArn = dataAccessRoleArn; return this; } /** *

* Tags to associate with the custom model that is created by this import. A * tag is a key-value pair that adds as a metadata to a resource used by * Amazon Comprehend. For example, a tag with "Sales" as the key might be * added to a resource to indicate its use by the sales department. *

* * @return

* Tags to associate with the custom model that is created by this * import. A tag is a key-value pair that adds as a metadata to a * resource used by Amazon Comprehend. For example, a tag with * "Sales" as the key might be added to a resource to indicate its * use by the sales department. *

*/ public java.util.List getTags() { return tags; } /** *

* Tags to associate with the custom model that is created by this import. A * tag is a key-value pair that adds as a metadata to a resource used by * Amazon Comprehend. For example, a tag with "Sales" as the key might be * added to a resource to indicate its use by the sales department. *

* * @param tags

* Tags to associate with the custom model that is created by * this import. A tag is a key-value pair that adds as a metadata * to a resource used by Amazon Comprehend. For example, a tag * with "Sales" as the key might be added to a resource to * indicate its use by the sales department. *

*/ public void setTags(java.util.Collection tags) { if (tags == null) { this.tags = null; return; } this.tags = new java.util.ArrayList(tags); } /** *

* Tags to associate with the custom model that is created by this import. A * tag is a key-value pair that adds as a metadata to a resource used by * Amazon Comprehend. For example, a tag with "Sales" as the key might be * added to a resource to indicate its use by the sales department. *

*

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

* Tags to associate with the custom model that is created by * this import. A tag is a key-value pair that adds as a metadata * to a resource used by Amazon Comprehend. For example, a tag * with "Sales" as the key might be added to a resource to * indicate its use by the sales department. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withTags(Tag... tags) { if (getTags() == null) { this.tags = new java.util.ArrayList(tags.length); } for (Tag value : tags) { this.tags.add(value); } return this; } /** *

* Tags to associate with the custom model that is created by this import. A * tag is a key-value pair that adds as a metadata to a resource used by * Amazon Comprehend. For example, a tag with "Sales" as the key might be * added to a resource to indicate its use by the sales department. *

*

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

* Tags to associate with the custom model that is created by * this import. A tag is a key-value pair that adds as a metadata * to a resource used by Amazon Comprehend. For example, a tag * with "Sales" as the key might be added to a resource to * indicate its use by the sales department. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ImportModelRequest withTags(java.util.Collection tags) { setTags(tags); 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 (getSourceModelArn() != null) sb.append("SourceModelArn: " + getSourceModelArn() + ","); if (getModelName() != null) sb.append("ModelName: " + getModelName() + ","); if (getVersionName() != null) sb.append("VersionName: " + getVersionName() + ","); if (getModelKmsKeyId() != null) sb.append("ModelKmsKeyId: " + getModelKmsKeyId() + ","); if (getDataAccessRoleArn() != null) sb.append("DataAccessRoleArn: " + getDataAccessRoleArn() + ","); if (getTags() != null) sb.append("Tags: " + getTags()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSourceModelArn() == null) ? 0 : getSourceModelArn().hashCode()); hashCode = prime * hashCode + ((getModelName() == null) ? 0 : getModelName().hashCode()); hashCode = prime * hashCode + ((getVersionName() == null) ? 0 : getVersionName().hashCode()); hashCode = prime * hashCode + ((getModelKmsKeyId() == null) ? 0 : getModelKmsKeyId().hashCode()); hashCode = prime * hashCode + ((getDataAccessRoleArn() == null) ? 0 : getDataAccessRoleArn().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ImportModelRequest == false) return false; ImportModelRequest other = (ImportModelRequest) obj; if (other.getSourceModelArn() == null ^ this.getSourceModelArn() == null) return false; if (other.getSourceModelArn() != null && other.getSourceModelArn().equals(this.getSourceModelArn()) == false) return false; if (other.getModelName() == null ^ this.getModelName() == null) return false; if (other.getModelName() != null && other.getModelName().equals(this.getModelName()) == false) return false; if (other.getVersionName() == null ^ this.getVersionName() == null) return false; if (other.getVersionName() != null && other.getVersionName().equals(this.getVersionName()) == false) return false; if (other.getModelKmsKeyId() == null ^ this.getModelKmsKeyId() == null) return false; if (other.getModelKmsKeyId() != null && other.getModelKmsKeyId().equals(this.getModelKmsKeyId()) == false) return false; if (other.getDataAccessRoleArn() == null ^ this.getDataAccessRoleArn() == null) return false; if (other.getDataAccessRoleArn() != null && other.getDataAccessRoleArn().equals(this.getDataAccessRoleArn()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; return true; } }