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

* Create a dimension that you can use to limit the scope of a metric used in a * security profile for IoT Device Defender. For example, using a * TOPIC_FILTER dimension, you can narrow down the scope of the * metric only to MQTT topics whose name match the pattern specified in the * dimension. *

*

* Requires permission to access the CreateDimension action. *

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

* A unique identifier for the dimension. Choose something that describes * the type and value to make it easy to remember what it does. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*/ private String name; /** *

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

* Constraints:
* Allowed Values: TOPIC_FILTER */ private String type; /** *

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to match the * MQTT topic (for example, "admin/#"). *

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

* Metadata that can be used to manage the dimension. *

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

* Each dimension must have a unique client request token. If you try to * create a new dimension with the same token as a dimension that already * exists, an exception occurs. If you omit this value, Amazon Web Services * SDKs will automatically generate a unique client request. *

*

* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
*/ private String clientRequestToken; /** *

* A unique identifier for the dimension. Choose something that describes * the type and value to make it easy to remember what it does. *

*

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

* A unique identifier for the dimension. Choose something that * describes the type and value to make it easy to remember what it * does. *

*/ public String getName() { return name; } /** *

* A unique identifier for the dimension. Choose something that describes * the type and value to make it easy to remember what it does. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
* * @param name

* A unique identifier for the dimension. Choose something that * describes the type and value to make it easy to remember what * it does. *

*/ public void setName(String name) { this.name = name; } /** *

* A unique identifier for the dimension. Choose something that describes * the type and value to make it easy to remember what it does. *

*

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

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
* * @param name

* A unique identifier for the dimension. Choose something that * describes the type and value to make it easy to remember what * it does. *

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

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

* Constraints:
* Allowed Values: TOPIC_FILTER * * @return

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

* @see DimensionType */ public String getType() { return type; } /** *

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

* Constraints:
* Allowed Values: TOPIC_FILTER * * @param type

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

* @see DimensionType */ public void setType(String type) { this.type = type; } /** *

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

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

* Constraints:
* Allowed Values: TOPIC_FILTER * * @param type

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

* @return A reference to this updated object so that method calls can be * chained together. * @see DimensionType */ public CreateDimensionRequest withType(String type) { this.type = type; return this; } /** *

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

* Constraints:
* Allowed Values: TOPIC_FILTER * * @param type

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

* @see DimensionType */ public void setType(DimensionType type) { this.type = type.toString(); } /** *

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

*

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

* Constraints:
* Allowed Values: TOPIC_FILTER * * @param type

* Specifies the type of dimension. Supported types: * TOPIC_FILTER. *

* @return A reference to this updated object so that method calls can be * chained together. * @see DimensionType */ public CreateDimensionRequest withType(DimensionType type) { this.type = type.toString(); return this; } /** *

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to match the * MQTT topic (for example, "admin/#"). *

* * @return

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to * match the MQTT topic (for example, "admin/#"). *

*/ public java.util.List getStringValues() { return stringValues; } /** *

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to match the * MQTT topic (for example, "admin/#"). *

* * @param stringValues

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used * to match the MQTT topic (for example, "admin/#"). *

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

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to match the * MQTT topic (for example, "admin/#"). *

*

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

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used * to match the MQTT topic (for example, "admin/#"). *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateDimensionRequest withStringValues(String... stringValues) { if (getStringValues() == null) { this.stringValues = new java.util.ArrayList(stringValues.length); } for (String value : stringValues) { this.stringValues.add(value); } return this; } /** *

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used to match the * MQTT topic (for example, "admin/#"). *

*

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

* Specifies the value or list of values for the dimension. For * TOPIC_FILTER dimensions, this is a pattern used * to match the MQTT topic (for example, "admin/#"). *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateDimensionRequest withStringValues(java.util.Collection stringValues) { setStringValues(stringValues); return this; } /** *

* Metadata that can be used to manage the dimension. *

* * @return

* Metadata that can be used to manage the dimension. *

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

* Metadata that can be used to manage the dimension. *

* * @param tags

* Metadata that can be used to manage the dimension. *

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

* Metadata that can be used to manage the dimension. *

*

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

* Metadata that can be used to manage the dimension. *

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

* Metadata that can be used to manage the dimension. *

*

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

* Metadata that can be used to manage the dimension. *

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

* Each dimension must have a unique client request token. If you try to * create a new dimension with the same token as a dimension that already * exists, an exception occurs. If you omit this value, Amazon Web Services * SDKs will automatically generate a unique client request. *

*

* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
* * @return

* Each dimension must have a unique client request token. If you * try to create a new dimension with the same token as a dimension * that already exists, an exception occurs. If you omit this value, * Amazon Web Services SDKs will automatically generate a unique * client request. *

*/ public String getClientRequestToken() { return clientRequestToken; } /** *

* Each dimension must have a unique client request token. If you try to * create a new dimension with the same token as a dimension that already * exists, an exception occurs. If you omit this value, Amazon Web Services * SDKs will automatically generate a unique client request. *

*

* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
* * @param clientRequestToken

* Each dimension must have a unique client request token. If you * try to create a new dimension with the same token as a * dimension that already exists, an exception occurs. If you * omit this value, Amazon Web Services SDKs will automatically * generate a unique client request. *

*/ public void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } /** *

* Each dimension must have a unique client request token. If you try to * create a new dimension with the same token as a dimension that already * exists, an exception occurs. If you omit this value, Amazon Web Services * SDKs will automatically generate a unique client request. *

*

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

* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
* * @param clientRequestToken

* Each dimension must have a unique client request token. If you * try to create a new dimension with the same token as a * dimension that already exists, an exception occurs. If you * omit this value, Amazon Web Services SDKs will automatically * generate a unique client request. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateDimensionRequest withClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; 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 (getName() != null) sb.append("name: " + getName() + ","); if (getType() != null) sb.append("type: " + getType() + ","); if (getStringValues() != null) sb.append("stringValues: " + getStringValues() + ","); if (getTags() != null) sb.append("tags: " + getTags() + ","); if (getClientRequestToken() != null) sb.append("clientRequestToken: " + getClientRequestToken()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getStringValues() == null) ? 0 : getStringValues().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateDimensionRequest == false) return false; CreateDimensionRequest other = (CreateDimensionRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getStringValues() == null ^ this.getStringValues() == null) return false; if (other.getStringValues() != null && other.getStringValues().equals(this.getStringValues()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null) return false; if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false) return false; return true; } }