
software.amazon.awssdk.services.securityhub.model.AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails Maven / Gradle / Ivy
/*
* 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.securityhub.model;
import java.io.Serializable;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about the instances distribution.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails
implements
SdkPojo,
Serializable,
ToCopyableBuilder {
private static final SdkField ON_DEMAND_ALLOCATION_STRATEGY_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("OnDemandAllocationStrategy")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::onDemandAllocationStrategy))
.setter(setter(Builder::onDemandAllocationStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnDemandAllocationStrategy").build())
.build();
private static final SdkField ON_DEMAND_BASE_CAPACITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("OnDemandBaseCapacity")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::onDemandBaseCapacity))
.setter(setter(Builder::onDemandBaseCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnDemandBaseCapacity").build())
.build();
private static final SdkField ON_DEMAND_PERCENTAGE_ABOVE_BASE_CAPACITY_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("OnDemandPercentageAboveBaseCapacity")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::onDemandPercentageAboveBaseCapacity))
.setter(setter(Builder::onDemandPercentageAboveBaseCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("OnDemandPercentageAboveBaseCapacity").build()).build();
private static final SdkField SPOT_ALLOCATION_STRATEGY_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("SpotAllocationStrategy")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::spotAllocationStrategy))
.setter(setter(Builder::spotAllocationStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SpotAllocationStrategy").build())
.build();
private static final SdkField SPOT_INSTANCE_POOLS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("SpotInstancePools")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::spotInstancePools))
.setter(setter(Builder::spotInstancePools))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SpotInstancePools").build()).build();
private static final SdkField SPOT_MAX_PRICE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SpotMaxPrice")
.getter(getter(AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails::spotMaxPrice))
.setter(setter(Builder::spotMaxPrice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SpotMaxPrice").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
ON_DEMAND_ALLOCATION_STRATEGY_FIELD, ON_DEMAND_BASE_CAPACITY_FIELD, ON_DEMAND_PERCENTAGE_ABOVE_BASE_CAPACITY_FIELD,
SPOT_ALLOCATION_STRATEGY_FIELD, SPOT_INSTANCE_POOLS_FIELD, SPOT_MAX_PRICE_FIELD));
private static final long serialVersionUID = 1L;
private final String onDemandAllocationStrategy;
private final Integer onDemandBaseCapacity;
private final Integer onDemandPercentageAboveBaseCapacity;
private final String spotAllocationStrategy;
private final Integer spotInstancePools;
private final String spotMaxPrice;
private AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails(BuilderImpl builder) {
this.onDemandAllocationStrategy = builder.onDemandAllocationStrategy;
this.onDemandBaseCapacity = builder.onDemandBaseCapacity;
this.onDemandPercentageAboveBaseCapacity = builder.onDemandPercentageAboveBaseCapacity;
this.spotAllocationStrategy = builder.spotAllocationStrategy;
this.spotInstancePools = builder.spotInstancePools;
this.spotMaxPrice = builder.spotMaxPrice;
}
/**
*
* How to allocate instance types to fulfill On-Demand capacity. The valid value is prioritized
.
*
*
* @return How to allocate instance types to fulfill On-Demand capacity. The valid value is prioritized
* .
*/
public final String onDemandAllocationStrategy() {
return onDemandAllocationStrategy;
}
/**
*
* The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances.
*
*
* @return The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances.
*/
public final Integer onDemandBaseCapacity() {
return onDemandBaseCapacity;
}
/**
*
* The percentage of On-Demand Instances and Spot Instances for additional capacity beyond
* OnDemandBaseCapacity
.
*
*
* @return The percentage of On-Demand Instances and Spot Instances for additional capacity beyond
* OnDemandBaseCapacity
.
*/
public final Integer onDemandPercentageAboveBaseCapacity() {
return onDemandPercentageAboveBaseCapacity;
}
/**
*
* How to allocate instances across Spot Instance pools. Valid values are as follows:
*
*
* -
*
* lowest-price
*
*
* -
*
* capacity-optimized
*
*
* -
*
* capacity-optimized-prioritized
*
*
*
*
* @return How to allocate instances across Spot Instance pools. Valid values are as follows:
*
* -
*
* lowest-price
*
*
* -
*
* capacity-optimized
*
*
* -
*
* capacity-optimized-prioritized
*
*
*/
public final String spotAllocationStrategy() {
return spotAllocationStrategy;
}
/**
*
* The number of Spot Instance pools across which to allocate your Spot Instances.
*
*
* @return The number of Spot Instance pools across which to allocate your Spot Instances.
*/
public final Integer spotInstancePools() {
return spotInstancePools;
}
/**
*
* The maximum price per unit hour that you are willing to pay for a Spot Instance.
*
*
* @return The maximum price per unit hour that you are willing to pay for a Spot Instance.
*/
public final String spotMaxPrice() {
return spotMaxPrice;
}
@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(onDemandAllocationStrategy());
hashCode = 31 * hashCode + Objects.hashCode(onDemandBaseCapacity());
hashCode = 31 * hashCode + Objects.hashCode(onDemandPercentageAboveBaseCapacity());
hashCode = 31 * hashCode + Objects.hashCode(spotAllocationStrategy());
hashCode = 31 * hashCode + Objects.hashCode(spotInstancePools());
hashCode = 31 * hashCode + Objects.hashCode(spotMaxPrice());
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 AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails)) {
return false;
}
AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails other = (AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails) obj;
return Objects.equals(onDemandAllocationStrategy(), other.onDemandAllocationStrategy())
&& Objects.equals(onDemandBaseCapacity(), other.onDemandBaseCapacity())
&& Objects.equals(onDemandPercentageAboveBaseCapacity(), other.onDemandPercentageAboveBaseCapacity())
&& Objects.equals(spotAllocationStrategy(), other.spotAllocationStrategy())
&& Objects.equals(spotInstancePools(), other.spotInstancePools())
&& Objects.equals(spotMaxPrice(), other.spotMaxPrice());
}
/**
* 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("AwsAutoScalingAutoScalingGroupMixedInstancesPolicyInstancesDistributionDetails")
.add("OnDemandAllocationStrategy", onDemandAllocationStrategy())
.add("OnDemandBaseCapacity", onDemandBaseCapacity())
.add("OnDemandPercentageAboveBaseCapacity", onDemandPercentageAboveBaseCapacity())
.add("SpotAllocationStrategy", spotAllocationStrategy()).add("SpotInstancePools", spotInstancePools())
.add("SpotMaxPrice", spotMaxPrice()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OnDemandAllocationStrategy":
return Optional.ofNullable(clazz.cast(onDemandAllocationStrategy()));
case "OnDemandBaseCapacity":
return Optional.ofNullable(clazz.cast(onDemandBaseCapacity()));
case "OnDemandPercentageAboveBaseCapacity":
return Optional.ofNullable(clazz.cast(onDemandPercentageAboveBaseCapacity()));
case "SpotAllocationStrategy":
return Optional.ofNullable(clazz.cast(spotAllocationStrategy()));
case "SpotInstancePools":
return Optional.ofNullable(clazz.cast(spotInstancePools()));
case "SpotMaxPrice":
return Optional.ofNullable(clazz.cast(spotMaxPrice()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function