Example usage for com.amazonaws.services.autoscaling.model CreateAutoScalingGroupRequest getAvailabilityZones

List of usage examples for com.amazonaws.services.autoscaling.model CreateAutoScalingGroupRequest getAvailabilityZones

Introduction

In this page you can find the example usage for com.amazonaws.services.autoscaling.model CreateAutoScalingGroupRequest getAvailabilityZones.

Prototype


public java.util.List<String> getAvailabilityZones() 

Source Link

Document

One or more Availability Zones for the group.

Usage

From source file:web.component.impl.aws.AWSAutoScalingImpl.java

@Override
public void createAutoScalingGroup(CreateAutoScalingGroupRequest request) {

    if (request.getAutoScalingGroupName() == null || request.getAutoScalingGroupName().isEmpty())
        throw new IllegalArgumentException("Auto scaling group name not specified.");
    if (request.getMaxSize() == null)
        throw new IllegalArgumentException("Max size not specified.");
    if (request.getMinSize() == null)
        throw new IllegalArgumentException("Min size not specified.");
    if ((request.getLaunchConfigurationName() == null || request.getLaunchConfigurationName().isEmpty())
            && (request.getInstanceId() == null || request.getInstanceId().isEmpty()))
        throw new IllegalArgumentException(
                "Either launch configuration name or instance ID must be specified.");
    if ((request.getLaunchConfigurationName() != null && !request.getLaunchConfigurationName().isEmpty())
            && (request.getInstanceId() != null && !request.getInstanceId().isEmpty()))
        throw new IllegalArgumentException(
                "Either launch configuration name or instance ID must be specified.");
    if ((request.getAvailabilityZones() == null || request.getAvailabilityZones().isEmpty())
            && request.getVPCZoneIdentifier() == null)
        throw new IllegalArgumentException("At least one availability zone or VPC subnet must be specified.");

    awsHttpClient.createAutoScalingGroup(request);
}