com.amazonaws.services.kms.model.MultiRegionConfiguration Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kms Show documentation
/*
* Copyright 2019-2024 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;
/**
*
* Describes the configuration of this multi-Region key. This field appears only when the KMS key is a primary or
* replica of a multi-Region key.
*
*
* For more information about any listed KMS key, use the DescribeKey operation.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class MultiRegionConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
*
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
*
*/
private String multiRegionKeyType;
/**
*
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the primary
* key.
*
*/
private MultiRegionKey primaryKey;
/**
*
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a replica
* key.
*
*/
private com.amazonaws.internal.SdkInternalList replicaKeys;
/**
*
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
*
*
* @param multiRegionKeyType
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
* @see MultiRegionKeyType
*/
public void setMultiRegionKeyType(String multiRegionKeyType) {
this.multiRegionKeyType = multiRegionKeyType;
}
/**
*
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
*
*
* @return Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
* @see MultiRegionKeyType
*/
public String getMultiRegionKeyType() {
return this.multiRegionKeyType;
}
/**
*
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
*
*
* @param multiRegionKeyType
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MultiRegionKeyType
*/
public MultiRegionConfiguration withMultiRegionKeyType(String multiRegionKeyType) {
setMultiRegionKeyType(multiRegionKeyType);
return this;
}
/**
*
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
*
*
* @param multiRegionKeyType
* Indicates whether the KMS key is a PRIMARY
or REPLICA
key.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MultiRegionKeyType
*/
public MultiRegionConfiguration withMultiRegionKeyType(MultiRegionKeyType multiRegionKeyType) {
this.multiRegionKeyType = multiRegionKeyType.toString();
return this;
}
/**
*
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the primary
* key.
*
*
* @param primaryKey
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the
* primary key.
*/
public void setPrimaryKey(MultiRegionKey primaryKey) {
this.primaryKey = primaryKey;
}
/**
*
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the primary
* key.
*
*
* @return Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the
* primary key.
*/
public MultiRegionKey getPrimaryKey() {
return this.primaryKey;
}
/**
*
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the primary
* key.
*
*
* @param primaryKey
* Displays the key ARN and Region of the primary key. This field includes the current KMS key if it is the
* primary key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MultiRegionConfiguration withPrimaryKey(MultiRegionKey primaryKey) {
setPrimaryKey(primaryKey);
return this;
}
/**
*
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a replica
* key.
*
*
* @return displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a
* replica key.
*/
public java.util.List getReplicaKeys() {
if (replicaKeys == null) {
replicaKeys = new com.amazonaws.internal.SdkInternalList();
}
return replicaKeys;
}
/**
*
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a replica
* key.
*
*
* @param replicaKeys
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a
* replica key.
*/
public void setReplicaKeys(java.util.Collection replicaKeys) {
if (replicaKeys == null) {
this.replicaKeys = null;
return;
}
this.replicaKeys = new com.amazonaws.internal.SdkInternalList(replicaKeys);
}
/**
*
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a replica
* key.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setReplicaKeys(java.util.Collection)} or {@link #withReplicaKeys(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param replicaKeys
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a
* replica key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MultiRegionConfiguration withReplicaKeys(MultiRegionKey... replicaKeys) {
if (this.replicaKeys == null) {
setReplicaKeys(new com.amazonaws.internal.SdkInternalList(replicaKeys.length));
}
for (MultiRegionKey ele : replicaKeys) {
this.replicaKeys.add(ele);
}
return this;
}
/**
*
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a replica
* key.
*
*
* @param replicaKeys
* displays the key ARNs and Regions of all replica keys. This field includes the current KMS key if it is a
* replica key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MultiRegionConfiguration withReplicaKeys(java.util.Collection replicaKeys) {
setReplicaKeys(replicaKeys);
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 (getMultiRegionKeyType() != null)
sb.append("MultiRegionKeyType: ").append(getMultiRegionKeyType()).append(",");
if (getPrimaryKey() != null)
sb.append("PrimaryKey: ").append(getPrimaryKey()).append(",");
if (getReplicaKeys() != null)
sb.append("ReplicaKeys: ").append(getReplicaKeys());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof MultiRegionConfiguration == false)
return false;
MultiRegionConfiguration other = (MultiRegionConfiguration) obj;
if (other.getMultiRegionKeyType() == null ^ this.getMultiRegionKeyType() == null)
return false;
if (other.getMultiRegionKeyType() != null && other.getMultiRegionKeyType().equals(this.getMultiRegionKeyType()) == false)
return false;
if (other.getPrimaryKey() == null ^ this.getPrimaryKey() == null)
return false;
if (other.getPrimaryKey() != null && other.getPrimaryKey().equals(this.getPrimaryKey()) == false)
return false;
if (other.getReplicaKeys() == null ^ this.getReplicaKeys() == null)
return false;
if (other.getReplicaKeys() != null && other.getReplicaKeys().equals(this.getReplicaKeys()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMultiRegionKeyType() == null) ? 0 : getMultiRegionKeyType().hashCode());
hashCode = prime * hashCode + ((getPrimaryKey() == null) ? 0 : getPrimaryKey().hashCode());
hashCode = prime * hashCode + ((getReplicaKeys() == null) ? 0 : getReplicaKeys().hashCode());
return hashCode;
}
@Override
public MultiRegionConfiguration clone() {
try {
return (MultiRegionConfiguration) 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.MultiRegionConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}