Example #1
0
def convert_epu_description_to_asg_out(desc, name):

    log(logging.DEBUG, "conversion description: %s" %(str(desc)))

    config = desc['config']['engine_conf']
    
    asg = AutoScalingGroupType('AutoScalingGroup')
    asg.AutoScalingGroupName = desc['name']
    asg.DesiredCapacity = config['minimum_vms']
    tm = _get_key_or_none(config, 'CreatedTime')
    if tm:
        tm = _get_time(config['CreatedTime'])
        asg.CreatedTime = DateTimeType('CreatedTime', tm)

    asg.AutoScalingGroupARN = _get_key_or_none(config, 'AutoScalingGroupARN')
    asg.AvailabilityZones = AWSListType('AvailabilityZones')

    dt_name = config.get('dtname')
    if dt_name is None:
        dt_name = config.get('deployable_type')

    asg.HealthCheckType = _get_key_or_none(config, 'HealthCheckType')
    asg.LaunchConfigurationName = "%s" % (dt_name)
    asg.MaxSize = config.get('maximum_vms')
    if asg.MaxSize is None:
        asg.MaxSize = config.get('maximum_vms')
    asg.MinSize = config.get('minimum_vms')
    if asg.MinSize is None:
        asg.MinSize = config.get('minimum_vms')
    asg.PlacementGroup = _get_key_or_none(config,'PlacementGroup')
    #asg.Status
    asg.VPCZoneIdentifier = _get_key_or_none(config,'VPCZoneIdentifier')
    asg.EnabledMetrics = AWSListType('EnabledMetrics')
    asg.HealthCheckGracePeriod = 0
    asg.LoadBalancerNames = AWSListType('LoadBalancerNames')
    asg.SuspendedProcesses = AWSListType('SuspendedProcesses')
    asg.Tags = AWSListType('Tags')
    asg.Cooldown = 0

    inst_list = desc['instances']

    asg.Instances = AWSListType('Instances')

    for inst in inst_list:
        out_t = convert_instance_type(name, inst)
        asg.Instances.type_list.append(out_t)

    return asg
Example #2
0
def convert_epu_description_to_asg_out(desc, name):

    log(logging.DEBUG, "conversion description: %s" % (str(desc)))

    config = desc['config']['engine_conf']

    asg = AutoScalingGroupType('AutoScalingGroup')
    asg.AutoScalingGroupName = desc['name']
    asg.DesiredCapacity = config['minimum_vms']
    tm = _get_key_or_none(config, 'CreatedTime')
    if tm:
        tm = _get_time(config['CreatedTime'])
        asg.CreatedTime = DateTimeType('CreatedTime', tm)

    asg.AutoScalingGroupARN = _get_key_or_none(config, 'AutoScalingGroupARN')
    asg.AvailabilityZones = AWSListType('AvailabilityZones')

    dt_name = config.get('dtname')
    if dt_name is None:
        dt_name = config.get('deployable_type')

    asg.HealthCheckType = _get_key_or_none(config, 'HealthCheckType')
    asg.LaunchConfigurationName = "%s" % (dt_name)
    asg.MaxSize = config.get('maximum_vms')
    if asg.MaxSize is None:
        asg.MaxSize = config.get('maximum_vms')
    asg.MinSize = config.get('minimum_vms')
    if asg.MinSize is None:
        asg.MinSize = config.get('minimum_vms')
    asg.PlacementGroup = _get_key_or_none(config, 'PlacementGroup')
    #asg.Status
    asg.VPCZoneIdentifier = _get_key_or_none(config, 'VPCZoneIdentifier')
    asg.EnabledMetrics = AWSListType('EnabledMetrics')
    asg.HealthCheckGracePeriod = 0
    asg.LoadBalancerNames = AWSListType('LoadBalancerNames')
    asg.SuspendedProcesses = AWSListType('SuspendedProcesses')
    asg.Tags = AWSListType('Tags')
    asg.Cooldown = 0

    inst_list = desc['instances']

    asg.Instances = AWSListType('Instances')

    for inst in inst_list:
        out_t = convert_instance_type(name, inst)
        asg.Instances.type_list.append(out_t)

    return asg
Example #3
0
def db_asg_to_outtype(asg_db):
    asg = AutoScalingGroupType('AutoScalingGroup')

    asg.AutoScalingGroupName = asg_db.AutoScalingGroupName
    asg.AutoScalingGroupARN = asg_db.AutoScalingGroupARN
    asg.LaunchConfigurationName = asg_db.LaunchConfigurationName
    asg.VPCZoneIdentifier = asg_db.VPCZoneIdentifier
    asg.HealthCheckType = asg_db.HealthCheckType
    asg.PlacementGroup = asg_db.PlacementGroup
    asg.Status = asg_db.Status
    asg.DesiredCapacity = asg_db.DesiredCapacity
    asg.MaxSize = asg_db.MaxSize
    asg.MinSize = asg_db.MinSize
    asg.Cooldown = asg_db.DefaultCooldown
    asg.HealthCheckGracePeriod = asg_db.HealthCheckGracePeriod

    asg.AvailabilityZones = AWSListType('AvailabilityZones')
    asg.AvailabilityZones.type_list.append(asg_db.AvailabilityZones)

    asg.CreatedTime = DateTimeType('CreatedTime', asg_db.CreatedTime)

    return asg