/* * Copyright 2018-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.keyspaces.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* The replication specification of the keyspace includes: *

* * * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ReplicationSpecification implements Serializable, Cloneable, StructuredPojo { /** *

* The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. *

*/ private String replicationStrategy; /** *

* The regionList can contain up to six Amazon Web Services Regions where the keyspace is replicated * in. *

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

* The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. *

* * @param replicationStrategy * The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. * @see Rs */ public void setReplicationStrategy(String replicationStrategy) { this.replicationStrategy = replicationStrategy; } /** *

* The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. *

* * @return The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. * @see Rs */ public String getReplicationStrategy() { return this.replicationStrategy; } /** *

* The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. *

* * @param replicationStrategy * The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. * @return Returns a reference to this object so that method calls can be chained together. * @see Rs */ public ReplicationSpecification withReplicationStrategy(String replicationStrategy) { setReplicationStrategy(replicationStrategy); return this; } /** *

* The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. *

* * @param replicationStrategy * The replicationStrategy of a keyspace, the required value is SINGLE_REGION or * MULTI_REGION. * @return Returns a reference to this object so that method calls can be chained together. * @see Rs */ public ReplicationSpecification withReplicationStrategy(Rs replicationStrategy) { this.replicationStrategy = replicationStrategy.toString(); return this; } /** *

* The regionList can contain up to six Amazon Web Services Regions where the keyspace is replicated * in. *

* * @return The regionList can contain up to six Amazon Web Services Regions where the keyspace is * replicated in. */ public java.util.List getRegionList() { return regionList; } /** *

* The regionList can contain up to six Amazon Web Services Regions where the keyspace is replicated * in. *

* * @param regionList * The regionList can contain up to six Amazon Web Services Regions where the keyspace is * replicated in. */ public void setRegionList(java.util.Collection regionList) { if (regionList == null) { this.regionList = null; return; } this.regionList = new java.util.ArrayList(regionList); } /** *

* The regionList can contain up to six Amazon Web Services Regions where the keyspace is replicated * in. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setRegionList(java.util.Collection)} or {@link #withRegionList(java.util.Collection)} if you want to * override the existing values. *

* * @param regionList * The regionList can contain up to six Amazon Web Services Regions where the keyspace is * replicated in. * @return Returns a reference to this object so that method calls can be chained together. */ public ReplicationSpecification withRegionList(String... regionList) { if (this.regionList == null) { setRegionList(new java.util.ArrayList(regionList.length)); } for (String ele : regionList) { this.regionList.add(ele); } return this; } /** *

* The regionList can contain up to six Amazon Web Services Regions where the keyspace is replicated * in. *

* * @param regionList * The regionList can contain up to six Amazon Web Services Regions where the keyspace is * replicated in. * @return Returns a reference to this object so that method calls can be chained together. */ public ReplicationSpecification withRegionList(java.util.Collection regionList) { setRegionList(regionList); 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 (getReplicationStrategy() != null) sb.append("ReplicationStrategy: ").append(getReplicationStrategy()).append(","); if (getRegionList() != null) sb.append("RegionList: ").append(getRegionList()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ReplicationSpecification == false) return false; ReplicationSpecification other = (ReplicationSpecification) obj; if (other.getReplicationStrategy() == null ^ this.getReplicationStrategy() == null) return false; if (other.getReplicationStrategy() != null && other.getReplicationStrategy().equals(this.getReplicationStrategy()) == false) return false; if (other.getRegionList() == null ^ this.getRegionList() == null) return false; if (other.getRegionList() != null && other.getRegionList().equals(this.getRegionList()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getReplicationStrategy() == null) ? 0 : getReplicationStrategy().hashCode()); hashCode = prime * hashCode + ((getRegionList() == null) ? 0 : getRegionList().hashCode()); return hashCode; } @Override public ReplicationSpecification clone() { try { return (ReplicationSpecification) 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.keyspaces.model.transform.ReplicationSpecificationMarshaller.getInstance().marshall(this, protocolMarshaller); } }