def test_with_non_int(self): target = properties.Integer() with self.assertRaises(properties.ValidationError) as e: value = target('Test', 'string') self.assertIn('Test', e.exception.message)
def test_with_None_and_no_default(self): target = properties.Integer() with self.assertRaises(properties.ValidationError) as e: value = target('Test', None) self.assertIn('Test', e.exception.message)
'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), 'throttlingRateLimit': properties.Integer(default=1000), }) }) }),
s3_client = aws_utils.ClientWrapper(boto3.client("s3")) iam_client = aws_utils.ClientWrapper(boto3.client("iam")) _inline_policy_name = "Default" # Default custom resource lambda timeout in MB _default_lambda_memory = 128 # Default custom resource lambda timeout in Seconds, can be between 3-900 as per Lambda spec _default_lambda_timeout = 10 # Seconds # Schema for _handler_properties_configuration # Set these values to increase memory and timeout values for a given custom resource Lambda # These are mostly Lambda configuration properties and should follow existing names and restrictions _handler_properties_configuration = { 'MemorySize': properties.Integer(default=_default_lambda_memory), # MB: Must be a multiple of 64MB as per Lambda spec 'Timeout': properties.Integer(default=_default_lambda_timeout), # Seconds: Must be between 3-900 as per Lambda spec } # Schema for ArnHandler or FunctionHandlers for core resource types _handler_schema = { 'Function': properties.String(""), 'HandlerFunctionConfiguration': properties.Object(default={}, schema=_handler_properties_configuration), 'PolicyStatement': properties.ObjectOrListOfObject(default=[], schema={ 'Sid': properties.String(""), 'Action': properties.StringOrListOfString(), 'Resource': properties.StringOrListOfString(default=[]), 'Effect': properties.String(), 'Condition': 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=60), 'CachingEnable': properties.Boolean(default=False), 'DataTraceEnabled': properties.Boolean(default=False), 'LoggingLevel': properties.String(default='OFF'), 'MetricsEnabled': properties.Boolean(default=False), 'ThrottlingBurstLimit': properties.Integer(default=2000), 'ThrottlingRateLimit': properties.Integer(default=1000), }) }) }),
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 ), 'throttlingRateLimit': properties.Integer( default = 1000 ), } ) } ) } ), 'StageVariables': properties.Dictionary( default = {} ) }
] } _handler_schema = { 'Function': properties.String(""), 'PolicyStatement': properties.ObjectOrListOfObject(default=[], schema={ 'Sid': properties.String(""), 'Action': properties.StringOrListOfString(), 'Resource': properties.StringOrListOfString(default=[]), 'Effect': properties.String() }) } _schema = { 'LambdaConfiguration': properties.Dictionary(default={}), 'LambdaTimeout': properties.Integer(default=10), 'Definitions': properties.Object(default=None, schema={ '*': properties.Object(default={}, schema={ 'PermissionMetadata': properties.Object(default={}, schema={ 'RestrictActions': properties.StringOrListOfString(default=[]), 'DefaultRoleMappings': properties.ObjectOrListOfObject(default=[], schema={ 'AbstractRole': properties.StringOrListOfString(default=[]), 'Action': properties.StringOrListOfString(default=[]), 'ResourceSuffix': properties.StringOrListOfString(default=[]) }) }), 'ServiceApi': properties.String(""), 'ArnFormat': properties.String(""), 'DisplayInfo': properties.Object({}), 'ArnFunction': properties.Object(default={}, schema=_handler_schema), 'HandlerFunction': properties.Object(default={}, schema=_handler_schema)
def test_with_None_and_default(self): target = properties.Integer(default=42) value = target('Test', None) self.assertEqual(value, 42)
def test_with_int_and_no_default(self): target = properties.Integer() value = target('Test', 10) self.assertEqual(value, 10)
'PolicyStatement': properties.ObjectOrListOfObject( default=[], schema={ 'Sid': properties.String(""), 'Action': properties.StringOrListOfString(), 'Resource': properties.StringOrListOfString(default=[]), 'Effect': properties.String() }) } _schema = { 'LambdaConfiguration': properties.Dictionary(default={}), 'LambdaTimeout': properties.Integer(default=10), 'Definitions': properties.Object( default=None, schema={ '*': properties.Object( default={}, schema={ 'PermissionMetadata': properties.Object( default={}, schema={ 'RestrictActions': properties.StringOrListOfString(default=[]), 'DefaultRoleMappings':