cfdsl.autoscaling.ScalingPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cfdsl Show documentation
Show all versions of cfdsl Show documentation
Java DSL for Amazon CloudFormation templates
The newest version!
package cfdsl.autoscaling;
import cfdsl.resource.Resource;
import cfdsl.resource.ResourceBuilder;
/**
* AWS::AutoScaling::ScalingPolicy
* resource type.
*/
public final class ScalingPolicy extends Resource {
ScalingPolicy(Builder b) {
super("AWS::AutoScaling::ScalingPolicy", b);
}
public static Builder of(
String logicalName,
AutoScalingGroup forGroup,
AdjustmentType adjustmentType,
int scalingAdjustment) {
return new ScalingPolicy.Builder(
logicalName, forGroup, adjustmentType, scalingAdjustment);
}
public static final class Builder extends ResourceBuilder {
private Builder(
String logicalName,
AutoScalingGroup forGroup,
AdjustmentType adjustmentType,
int scalingAdjustment) {
super(logicalName);
addProperty("AutoScalingGroupName", forGroup);
addProperty("AdjustmentType", adjustmentType.name());
addProperty("ScalingAdjustment", Integer.toString(scalingAdjustment));
}
public Builder cooldown(int seconds) {
addProperty("Cooldown", Integer.toString(seconds));
return this;
}
@Override
public ScalingPolicy build() {
return new ScalingPolicy(this);
}
}
public static enum AdjustmentType {
ChangeInCapacity,
ExactCapacity,
PercentChangeInCapacity
}
}