software.amazon.awssdk.services.cloudformation.model.StackSetOperationPreferences Maven / Gradle / Ivy
Show all versions of cloudformation Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.cloudformation.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The user-specified preferences for how CloudFormation performs a stack set operation.
*
*
* For more information about maximum concurrent accounts and failure tolerance, see Stack set operation options.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StackSetOperationPreferences implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField REGION_CONCURRENCY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RegionConcurrencyType").getter(getter(StackSetOperationPreferences::regionConcurrencyTypeAsString))
.setter(setter(Builder::regionConcurrencyType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RegionConcurrencyType").build())
.build();
private static final SdkField> REGION_ORDER_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("RegionOrder")
.getter(getter(StackSetOperationPreferences::regionOrder))
.setter(setter(Builder::regionOrder))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RegionOrder").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField FAILURE_TOLERANCE_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("FailureToleranceCount").getter(getter(StackSetOperationPreferences::failureToleranceCount))
.setter(setter(Builder::failureToleranceCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureToleranceCount").build())
.build();
private static final SdkField FAILURE_TOLERANCE_PERCENTAGE_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("FailureTolerancePercentage")
.getter(getter(StackSetOperationPreferences::failureTolerancePercentage))
.setter(setter(Builder::failureTolerancePercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureTolerancePercentage").build())
.build();
private static final SdkField MAX_CONCURRENT_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxConcurrentCount").getter(getter(StackSetOperationPreferences::maxConcurrentCount))
.setter(setter(Builder::maxConcurrentCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxConcurrentCount").build())
.build();
private static final SdkField MAX_CONCURRENT_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxConcurrentPercentage").getter(getter(StackSetOperationPreferences::maxConcurrentPercentage))
.setter(setter(Builder::maxConcurrentPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxConcurrentPercentage").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REGION_CONCURRENCY_TYPE_FIELD,
REGION_ORDER_FIELD, FAILURE_TOLERANCE_COUNT_FIELD, FAILURE_TOLERANCE_PERCENTAGE_FIELD, MAX_CONCURRENT_COUNT_FIELD,
MAX_CONCURRENT_PERCENTAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String regionConcurrencyType;
private final List regionOrder;
private final Integer failureToleranceCount;
private final Integer failureTolerancePercentage;
private final Integer maxConcurrentCount;
private final Integer maxConcurrentPercentage;
private StackSetOperationPreferences(BuilderImpl builder) {
this.regionConcurrencyType = builder.regionConcurrencyType;
this.regionOrder = builder.regionOrder;
this.failureToleranceCount = builder.failureToleranceCount;
this.failureTolerancePercentage = builder.failureTolerancePercentage;
this.maxConcurrentCount = builder.maxConcurrentCount;
this.maxConcurrentPercentage = builder.maxConcurrentPercentage;
}
/**
*
* The concurrency type of deploying StackSets operations in Regions, could be in parallel or one Region at a time.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #regionConcurrencyType} will return {@link RegionConcurrencyType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #regionConcurrencyTypeAsString}.
*
*
* @return The concurrency type of deploying StackSets operations in Regions, could be in parallel or one Region at
* a time.
* @see RegionConcurrencyType
*/
public final RegionConcurrencyType regionConcurrencyType() {
return RegionConcurrencyType.fromValue(regionConcurrencyType);
}
/**
*
* The concurrency type of deploying StackSets operations in Regions, could be in parallel or one Region at a time.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #regionConcurrencyType} will return {@link RegionConcurrencyType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #regionConcurrencyTypeAsString}.
*
*
* @return The concurrency type of deploying StackSets operations in Regions, could be in parallel or one Region at
* a time.
* @see RegionConcurrencyType
*/
public final String regionConcurrencyTypeAsString() {
return regionConcurrencyType;
}
/**
* For responses, this returns true if the service returned a value for the RegionOrder property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasRegionOrder() {
return regionOrder != null && !(regionOrder instanceof SdkAutoConstructList);
}
/**
*
* The order of the Regions in where you want to perform the stack operation.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasRegionOrder} method.
*
*
* @return The order of the Regions in where you want to perform the stack operation.
*/
public final List regionOrder() {
return regionOrder;
}
/**
*
* The number of accounts, per Region, for which this operation can fail before CloudFormation stops the operation
* in that Region. If the operation is stopped in a Region, CloudFormation doesn't attempt the operation in any
* subsequent Regions.
*
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
(but not both).
*
*
* By default, 0
is specified.
*
*
* @return The number of accounts, per Region, for which this operation can fail before CloudFormation stops the
* operation in that Region. If the operation is stopped in a Region, CloudFormation doesn't attempt the
* operation in any subsequent Regions.
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
(but not both).
*
*
* By default, 0
is specified.
*/
public final Integer failureToleranceCount() {
return failureToleranceCount;
}
/**
*
* The percentage of accounts, per Region, for which this stack operation can fail before CloudFormation stops the
* operation in that Region. If the operation is stopped in a Region, CloudFormation doesn't attempt the operation
* in any subsequent Regions.
*
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down to
* the next whole number.
*
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
, but not both.
*
*
* By default, 0
is specified.
*
*
* @return The percentage of accounts, per Region, for which this stack operation can fail before CloudFormation
* stops the operation in that Region. If the operation is stopped in a Region, CloudFormation doesn't
* attempt the operation in any subsequent Regions.
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds
* down to the next whole number.
*
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
, but not both.
*
*
* By default, 0
is specified.
*/
public final Integer failureTolerancePercentage() {
return failureTolerancePercentage;
}
/**
*
* The maximum number of accounts in which to perform this operation at one time. This is dependent on the value of
* FailureToleranceCount
.MaxConcurrentCount
is at most one more than the
* FailureToleranceCount
.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under certain
* circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or MaxConcurrentPercentage
, but
* not both.
*
*
* By default, 1
is specified.
*
*
* @return The maximum number of accounts in which to perform this operation at one time. This is dependent on the
* value of FailureToleranceCount
.MaxConcurrentCount
is at most one more than the
* FailureToleranceCount
.
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under
* certain circumstances the actual number of accounts acted upon concurrently may be lower due to service
* throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or
* MaxConcurrentPercentage
, but not both.
*
*
* By default, 1
is specified.
*/
public final Integer maxConcurrentCount() {
return maxConcurrentCount;
}
/**
*
* The maximum percentage of accounts in which to perform this operation at one time.
*
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down to the next
* whole number. This is true except in cases where rounding down would result is zero. In this case, CloudFormation
* sets the number as one instead.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under certain
* circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or MaxConcurrentPercentage
, but
* not both.
*
*
* By default, 1
is specified.
*
*
* @return The maximum percentage of accounts in which to perform this operation at one time.
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down to
* the next whole number. This is true except in cases where rounding down would result is zero. In this
* case, CloudFormation sets the number as one instead.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under
* certain circumstances the actual number of accounts acted upon concurrently may be lower due to service
* throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or
* MaxConcurrentPercentage
, but not both.
*
*
* By default, 1
is specified.
*/
public final Integer maxConcurrentPercentage() {
return maxConcurrentPercentage;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(regionConcurrencyTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasRegionOrder() ? regionOrder() : null);
hashCode = 31 * hashCode + Objects.hashCode(failureToleranceCount());
hashCode = 31 * hashCode + Objects.hashCode(failureTolerancePercentage());
hashCode = 31 * hashCode + Objects.hashCode(maxConcurrentCount());
hashCode = 31 * hashCode + Objects.hashCode(maxConcurrentPercentage());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StackSetOperationPreferences)) {
return false;
}
StackSetOperationPreferences other = (StackSetOperationPreferences) obj;
return Objects.equals(regionConcurrencyTypeAsString(), other.regionConcurrencyTypeAsString())
&& hasRegionOrder() == other.hasRegionOrder() && Objects.equals(regionOrder(), other.regionOrder())
&& Objects.equals(failureToleranceCount(), other.failureToleranceCount())
&& Objects.equals(failureTolerancePercentage(), other.failureTolerancePercentage())
&& Objects.equals(maxConcurrentCount(), other.maxConcurrentCount())
&& Objects.equals(maxConcurrentPercentage(), other.maxConcurrentPercentage());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("StackSetOperationPreferences").add("RegionConcurrencyType", regionConcurrencyTypeAsString())
.add("RegionOrder", hasRegionOrder() ? regionOrder() : null)
.add("FailureToleranceCount", failureToleranceCount())
.add("FailureTolerancePercentage", failureTolerancePercentage()).add("MaxConcurrentCount", maxConcurrentCount())
.add("MaxConcurrentPercentage", maxConcurrentPercentage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RegionConcurrencyType":
return Optional.ofNullable(clazz.cast(regionConcurrencyTypeAsString()));
case "RegionOrder":
return Optional.ofNullable(clazz.cast(regionOrder()));
case "FailureToleranceCount":
return Optional.ofNullable(clazz.cast(failureToleranceCount()));
case "FailureTolerancePercentage":
return Optional.ofNullable(clazz.cast(failureTolerancePercentage()));
case "MaxConcurrentCount":
return Optional.ofNullable(clazz.cast(maxConcurrentCount()));
case "MaxConcurrentPercentage":
return Optional.ofNullable(clazz.cast(maxConcurrentPercentage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
(but not both).
*
*
* By default, 0
is specified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder failureToleranceCount(Integer failureToleranceCount);
/**
*
* The percentage of accounts, per Region, for which this stack operation can fail before CloudFormation stops
* the operation in that Region. If the operation is stopped in a Region, CloudFormation doesn't attempt the
* operation in any subsequent Regions.
*
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down
* to the next whole number.
*
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
, but not both.
*
*
* By default, 0
is specified.
*
*
* @param failureTolerancePercentage
* The percentage of accounts, per Region, for which this stack operation can fail before CloudFormation
* stops the operation in that Region. If the operation is stopped in a Region, CloudFormation doesn't
* attempt the operation in any subsequent Regions.
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds
* down to the next whole number.
*
*
* Conditional: You must specify either FailureToleranceCount
or
* FailureTolerancePercentage
, but not both.
*
*
* By default, 0
is specified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder failureTolerancePercentage(Integer failureTolerancePercentage);
/**
*
* The maximum number of accounts in which to perform this operation at one time. This is dependent on the value
* of FailureToleranceCount
.MaxConcurrentCount
is at most one more than the
* FailureToleranceCount
.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under
* certain circumstances the actual number of accounts acted upon concurrently may be lower due to service
* throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or MaxConcurrentPercentage
,
* but not both.
*
*
* By default, 1
is specified.
*
*
* @param maxConcurrentCount
* The maximum number of accounts in which to perform this operation at one time. This is dependent on
* the value of FailureToleranceCount
.MaxConcurrentCount
is at most one more
* than the FailureToleranceCount
.
*
* Note that this setting lets you specify the maximum for operations. For large deployments,
* under certain circumstances the actual number of accounts acted upon concurrently may be lower due to
* service throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or
* MaxConcurrentPercentage
, but not both.
*
*
* By default, 1
is specified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxConcurrentCount(Integer maxConcurrentCount);
/**
*
* The maximum percentage of accounts in which to perform this operation at one time.
*
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down to the
* next whole number. This is true except in cases where rounding down would result is zero. In this case,
* CloudFormation sets the number as one instead.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments, under
* certain circumstances the actual number of accounts acted upon concurrently may be lower due to service
* throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or MaxConcurrentPercentage
,
* but not both.
*
*
* By default, 1
is specified.
*
*
* @param maxConcurrentPercentage
* The maximum percentage of accounts in which to perform this operation at one time.
*
* When calculating the number of accounts based on the specified percentage, CloudFormation rounds down
* to the next whole number. This is true except in cases where rounding down would result is zero. In
* this case, CloudFormation sets the number as one instead.
*
*
* Note that this setting lets you specify the maximum for operations. For large deployments,
* under certain circumstances the actual number of accounts acted upon concurrently may be lower due to
* service throttling.
*
*
* Conditional: You must specify either MaxConcurrentCount
or
* MaxConcurrentPercentage
, but not both.
*
*
* By default, 1
is specified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxConcurrentPercentage(Integer maxConcurrentPercentage);
}
static final class BuilderImpl implements Builder {
private String regionConcurrencyType;
private List regionOrder = DefaultSdkAutoConstructList.getInstance();
private Integer failureToleranceCount;
private Integer failureTolerancePercentage;
private Integer maxConcurrentCount;
private Integer maxConcurrentPercentage;
private BuilderImpl() {
}
private BuilderImpl(StackSetOperationPreferences model) {
regionConcurrencyType(model.regionConcurrencyType);
regionOrder(model.regionOrder);
failureToleranceCount(model.failureToleranceCount);
failureTolerancePercentage(model.failureTolerancePercentage);
maxConcurrentCount(model.maxConcurrentCount);
maxConcurrentPercentage(model.maxConcurrentPercentage);
}
public final String getRegionConcurrencyType() {
return regionConcurrencyType;
}
public final void setRegionConcurrencyType(String regionConcurrencyType) {
this.regionConcurrencyType = regionConcurrencyType;
}
@Override
public final Builder regionConcurrencyType(String regionConcurrencyType) {
this.regionConcurrencyType = regionConcurrencyType;
return this;
}
@Override
public final Builder regionConcurrencyType(RegionConcurrencyType regionConcurrencyType) {
this.regionConcurrencyType(regionConcurrencyType == null ? null : regionConcurrencyType.toString());
return this;
}
public final Collection getRegionOrder() {
if (regionOrder instanceof SdkAutoConstructList) {
return null;
}
return regionOrder;
}
public final void setRegionOrder(Collection regionOrder) {
this.regionOrder = RegionListCopier.copy(regionOrder);
}
@Override
public final Builder regionOrder(Collection regionOrder) {
this.regionOrder = RegionListCopier.copy(regionOrder);
return this;
}
@Override
@SafeVarargs
public final Builder regionOrder(String... regionOrder) {
regionOrder(Arrays.asList(regionOrder));
return this;
}
public final Integer getFailureToleranceCount() {
return failureToleranceCount;
}
public final void setFailureToleranceCount(Integer failureToleranceCount) {
this.failureToleranceCount = failureToleranceCount;
}
@Override
public final Builder failureToleranceCount(Integer failureToleranceCount) {
this.failureToleranceCount = failureToleranceCount;
return this;
}
public final Integer getFailureTolerancePercentage() {
return failureTolerancePercentage;
}
public final void setFailureTolerancePercentage(Integer failureTolerancePercentage) {
this.failureTolerancePercentage = failureTolerancePercentage;
}
@Override
public final Builder failureTolerancePercentage(Integer failureTolerancePercentage) {
this.failureTolerancePercentage = failureTolerancePercentage;
return this;
}
public final Integer getMaxConcurrentCount() {
return maxConcurrentCount;
}
public final void setMaxConcurrentCount(Integer maxConcurrentCount) {
this.maxConcurrentCount = maxConcurrentCount;
}
@Override
public final Builder maxConcurrentCount(Integer maxConcurrentCount) {
this.maxConcurrentCount = maxConcurrentCount;
return this;
}
public final Integer getMaxConcurrentPercentage() {
return maxConcurrentPercentage;
}
public final void setMaxConcurrentPercentage(Integer maxConcurrentPercentage) {
this.maxConcurrentPercentage = maxConcurrentPercentage;
}
@Override
public final Builder maxConcurrentPercentage(Integer maxConcurrentPercentage) {
this.maxConcurrentPercentage = maxConcurrentPercentage;
return this;
}
@Override
public StackSetOperationPreferences build() {
return new StackSetOperationPreferences(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}