예제 #1
0
    def test_with_non_bool(self):

        target = properties.Boolean()

        with self.assertRaises(properties.ValidationError) as e:
            value = target('Test', 'string')

        self.assertIn('Test', e.exception.message)
예제 #2
0
 def test_with_bool_string(self):
     target = properties.Boolean()
     self.assertTrue(target('Test', 'true'))
     self.assertTrue(target('Test', 'True'))
     self.assertTrue(target('Test', 'TRUE'))
     self.assertFalse(target('Test', 'false'))
     self.assertFalse(target('Test', 'False'))
     self.assertFalse(target('Test', 'FALSE'))
예제 #3
0
    def test_with_None_and_no_default(self):

        target = properties.Boolean()

        with self.assertRaises(properties.ValidationError) as e:
            value = target('Test', None)

        self.assertIn('Test', e.exception.message)
    properties.String(),
    'ConfigurationKey':
    properties.String(),
    'FunctionName':
    properties.String(),
    'Settings':
    properties.Object(default={}, schema={'*': properties.String()}),
    'Runtime':
    properties.String(),
    'Services':
    properties.ObjectOrListOfObject(default=[],
                                    schema={
                                        'InterfaceId':
                                        properties.String(),
                                        'Optional':
                                        properties.Boolean(default=False)
                                    }),
    'IgnoreAppendingSettingsToZip':
    properties.Boolean(default=False)
}


def handler(event, context):
    props = properties.load(event, PROPERTIES_SCHEMA)

    request_type = event['RequestType']
    stack_arn = event['StackId']
    logical_role_name = props.FunctionName
    stack_manager = stack_info.StackInfoManager()

    id_data = aws_utils.get_data_from_custom_physical_resource_id(

PROPERTIES_SCHEMA = {
    'ConfigurationBucket': properties.String(),
    'ConfigurationKey': properties.String(),
    'FunctionName': properties.String(),
    'Settings': properties.Object( default={},
        schema={
            '*': properties.String()
        }
    ),
    'Runtime': properties.String(),
    'Services': properties.ObjectOrListOfObject( default=[],
        schema={
            'InterfaceId': properties.String(),
            'Optional': properties.Boolean(default = False)
        }
    ),
    'IgnoreAppendingSettingsToZip': properties.Boolean(default = False)
}


def handler(event, context):

    props = properties.load(event, PROPERTIES_SCHEMA)

    request_type = event['RequestType']
    stack_arn = event['StackId']
    logical_role_name = props.FunctionName
    stack_manager = stack_info.StackInfoManager()
예제 #6
0
from cgf_utils import patch
from cgf_utils import aws_utils
from botocore.exceptions import ClientError
from cgf_service_directory import ServiceDirectory

cfg = botocore.config.Config(read_timeout=70, connect_timeout=70)
s3 = aws_utils.ClientWrapper(boto3.client('s3', config = cfg))
api_gateway = aws_utils.ClientWrapper(boto3.client('apigateway', config = cfg), do_not_log_args=['body'])

API_GATEWAY_SERVICE_NAME = 'apigateway.amazonaws.com'
STAGE_NAME = 'api'

PROPERTY_SCHEMA = {
    'ConfigurationBucket': properties.String(),
    'ConfigurationKey': properties.String(),
    'CacheClusterEnabled': properties.Boolean( default = False ),
    'CacheClusterSize': properties.String( default = '0.5' ),
    'SwaggerSettings': properties.Dictionary( default={} ),
    'MethodSettings': properties.Object( default={},
        schema={
            '*': properties.Object( default={}, # path, can be *
                schema={
                    '*': properties.Object( default={}, # method, can be *
                        schema={
                            'cacheDataEncrypted': properties.Boolean( default = False ),
                            'cacheTtlInSeconds': properties.Integer( default = 300 ),
                            'cachingEnabled': properties.Boolean( default = False ),
                            'dataTraceEnabled': properties.Boolean( default = False ),
                            'loggingLevel': properties.String( default='OFF' ),
                            'metricsEnabled': properties.Boolean( default = False ),
                            'throttlingBurstLimit': properties.Integer( default = 500 ),
예제 #7
0
    def test_with_None_and_default(self):

        target = properties.Boolean(default=False)
        value = target('Test', None)

        self.assertEqual(value, False)
예제 #8
0
    def test_with_bool_and_no_default(self):

        target = properties.Boolean()
        value = target('Test', True)

        self.assertEqual(value, True)