org.apache.inlong.sort.filesystem.shaded.com.amazonaws.services.kms.model.Tag Maven / Gradle / Ivy
/*
* Copyright 2017-2022 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.kms.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A key-value pair. A tag consists of a tag key and a tag value. Tag keys and tag values are both required, but tag
* values can be empty (null) strings.
*
*
* For information about the rules that apply to tag keys and tag values, see User-Defined Tag
* Restrictions in the Amazon Web Services Billing and Cost Management User Guide.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Tag implements Serializable, Cloneable, StructuredPojo {
/**
*
* The key of the tag.
*
*/
private String tagKey;
/**
*
* The value of the tag.
*
*/
private String tagValue;
/**
*
* The key of the tag.
*
*
* @param tagKey
* The key of the tag.
*/
public void setTagKey(String tagKey) {
this.tagKey = tagKey;
}
/**
*
* The key of the tag.
*
*
* @return The key of the tag.
*/
public String getTagKey() {
return this.tagKey;
}
/**
*
* The key of the tag.
*
*
* @param tagKey
* The key of the tag.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Tag withTagKey(String tagKey) {
setTagKey(tagKey);
return this;
}
/**
*
* The value of the tag.
*
*
* @param tagValue
* The value of the tag.
*/
public void setTagValue(String tagValue) {
this.tagValue = tagValue;
}
/**
*
* The value of the tag.
*
*
* @return The value of the tag.
*/
public String getTagValue() {
return this.tagValue;
}
/**
*
* The value of the tag.
*
*
* @param tagValue
* The value of the tag.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Tag withTagValue(String tagValue) {
setTagValue(tagValue);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTagKey() != null)
sb.append("TagKey: ").append(getTagKey()).append(",");
if (getTagValue() != null)
sb.append("TagValue: ").append(getTagValue());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Tag == false)
return false;
Tag other = (Tag) obj;
if (other.getTagKey() == null ^ this.getTagKey() == null)
return false;
if (other.getTagKey() != null && other.getTagKey().equals(this.getTagKey()) == false)
return false;
if (other.getTagValue() == null ^ this.getTagValue() == null)
return false;
if (other.getTagValue() != null && other.getTagValue().equals(this.getTagValue()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTagKey() == null) ? 0 : getTagKey().hashCode());
hashCode = prime * hashCode + ((getTagValue() == null) ? 0 : getTagValue().hashCode());
return hashCode;
}
@Override
public Tag clone() {
try {
return (Tag) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.kms.model.transform.TagMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}