/* * 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 collection in an AWS Region. You can add faces to the collection * using the IndexFaces operation. *

*

* For example, you might create collections, one for each of your application * users. A user can then index faces using the IndexFaces * operation and persist results in a specific collection. Then, a user can * search the collection for faces in the user-specific container. *

*

* When you create a collection, it is associated with the latest version of the * face model version. *

* *

* Collection names are case-sensitive. *

*
*

* This operation requires permissions to perform the * rekognition:CreateCollection action. If you want to tag your * collection, you also require permission to perform the * rekognition:TagResource operation. *

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

* ID for the collection that you are creating. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
*/ private String collectionId; /** *

* A set of tags (key-value pairs) that you want to attach to the * collection. *

*/ private java.util.Map tags; /** * Default constructor for CreateCollectionRequest object. Callers should * use the setter or fluent setter (with...) methods to initialize any * additional object members. */ public CreateCollectionRequest() { } /** * Constructs a new CreateCollectionRequest object. Callers should use the * setter or fluent setter (with...) methods to initialize any additional * object members. * * @param collectionId

* ID for the collection that you are creating. *

*/ public CreateCollectionRequest(String collectionId) { setCollectionId(collectionId); } /** *

* ID for the collection that you are creating. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @return

* ID for the collection that you are creating. *

*/ public String getCollectionId() { return collectionId; } /** *

* ID for the collection that you are creating. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @param collectionId

* ID for the collection that you are creating. *

*/ public void setCollectionId(String collectionId) { this.collectionId = collectionId; } /** *

* ID for the collection that you are creating. *

*

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

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @param collectionId

* ID for the collection that you are creating. *

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

* A set of tags (key-value pairs) that you want to attach to the * collection. *

* * @return

* A set of tags (key-value pairs) that you want to attach to the * collection. *

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

* A set of tags (key-value pairs) that you want to attach to the * collection. *

* * @param tags

* A set of tags (key-value pairs) that you want to attach to the * collection. *

*/ public void setTags(java.util.Map tags) { this.tags = tags; } /** *

* A set of tags (key-value pairs) that you want to attach to the * collection. *

*

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

* A set of tags (key-value pairs) that you want to attach to the * collection. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateCollectionRequest withTags(java.util.Map tags) { this.tags = tags; return this; } /** *

* A set of tags (key-value pairs) that you want to attach to the * collection. *

*

* The method adds a new key-value pair into Tags parameter, and returns a * reference to this object so that method calls can be chained together. * * @param key The key of the entry to be added into Tags. * @param value The corresponding value of the entry to be added into Tags. * @return A reference to this updated object so that method calls can be * chained together. */ public CreateCollectionRequest addTagsEntry(String key, String value) { if (null == this.tags) { this.tags = new java.util.HashMap(); } if (this.tags.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.tags.put(key, value); return this; } /** * Removes all the entries added into Tags. *

* Returns a reference to this object so that method calls can be chained * together. */ public CreateCollectionRequest clearTagsEntries() { this.tags = null; 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 (getCollectionId() != null) sb.append("CollectionId: " + getCollectionId() + ","); 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 + ((getCollectionId() == null) ? 0 : getCollectionId().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 CreateCollectionRequest == false) return false; CreateCollectionRequest other = (CreateCollectionRequest) obj; if (other.getCollectionId() == null ^ this.getCollectionId() == null) return false; if (other.getCollectionId() != null && other.getCollectionId().equals(this.getCollectionId()) == 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; } }