All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfdsl.autoscaling.ScalingPolicy Maven / Gradle / Ivy

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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy