Пример #1
0
 def __init__(self, name, type=None, attr=None, func=None, default=None):
     self.name = name
     self.type = type
     self.attr = attr or snake_case(name)
     self.func = func or (lambda x: x)
     self.default= default
Пример #2
0
        return [
            prop('HostedZoneId', HostedZone),
            prop('HosedZoneName', DomainName),
            prop('RecordsSets'),
            prop('Comment')
        ]


#### Public API ####
# Generate functional snake_cased form of constructors for public API
def __is_resource(obj):
    return issubclass(type(obj), type) and issubclass(obj, Resource)


constructors = {
    snake_case(name): obj
    for (name, obj) in globals().items() if __is_resource(obj)
}
globals().update(constructors)

continent_code = ContinentCode
country_code = CountryCode
subdivision_code = SubdivisionCode

hosted_zone_vpc = HostedZoneVPC
hosted_zone_vpcs = HostedZoneVPCs

alias_target = AliasTarget
record_set_geo_location = RecordSetGeoLocation
health_check_config = HealthCheckConfig
hosted_zone_config = HostedZoneConfig
Пример #3
0
    
    @staticmethod
    def props():
        return [prop('AutoScalingGroupName', AutoScalingGroup),
                prop('DesiredCapacity', int),
                prop('EndTime'),
                prop('MaxSize', int),
                prop('MinSize', int),
                prop('Recurrence'),
                prop('StartTime')]

#### Public API ####
# Generate functional snake_cased form of constructors for public API
def __is_resource(obj):
    return issubclass(type(obj), type) and issubclass(obj, Resource)
constructors = {snake_case(name): obj for (name, obj) in globals().items() if __is_resource(obj)}
globals().update(constructors)

adjustment_type            = AdjustmentType
change_in_capacity         = AdjustmentType.change_in_capacity
exact_capacity             = AdjustmentType.exact_capacity
percent_change_in_capacity = AdjustmentType.percent_change_in_capacity


health_check_type = HealthCheckType
ec2_health_check  = HealthCheckType.ec2
elb_health_check  = HealthCheckType.elb

metric_aggregatin_type = MetricAggregationType
minimum                = MetricAggregationType.minimum
maximum                = MetricAggregationType.maximum