def test_s3_bucket_accelerate_configuration(self): t = Template() ac = AccelerateConfiguration(AccelerationStatus="Enabled") b = Bucket("s3Bucket", AccelerateConfiguration=ac) t.add_resource(b) output = t.to_json() self.assertIn('"AccelerationStatus": "Enabled"', output)
from troposphere.s3 import AccelerateConfiguration, Bucket, PublicRead t = Template() t.set_description( "AWS CloudFormation Sample Template S3_Bucket: Sample template showing :" "How to create a publicly accessible S3 bucket. " "How to enable S3 Transfer Acceleration. " "**WARNING** This template creates an Amazon S3 Bucket. " "You will be billed for the AWS resources used if you create " "a stack from this template.") s3bucket = t.add_resource( Bucket( "S3Bucket", # Make public Read AccessControl=PublicRead, # Enable s3 Transfer Acceleration AccelerateConfiguration=AccelerateConfiguration( AccelerationStatus="Enabled", ), )) t.add_output( Output( "BucketName", Value=Ref(s3bucket), Description="Name of S3 bucket with s3 transfer acceleration enabled", )) print(t.to_json())
def test_accelerate_configuration_invalid_value(self): with self.assertRaises(ValueError): AccelerateConfiguration(AccelerationStatus='Invalid Value')
def test_accelerate_configuration_suspended(self): ac = AccelerateConfiguration( AccelerationStatus='Suspended', ) self.assertEqual('Suspended', ac.AccelerationStatus)
def test_accelerate_configuration_enabled(self): ac = AccelerateConfiguration( AccelerationStatus='Enabled', ) self.assertEqual('Enabled', ac.AccelerationStatus)
CorsConfiguration, CorsRules) BUCKET_NAME_SUFFIX = 'MockDatalake' BUCKETS = [["LandingZone", "Raw"], ["WorkZone", "Partially Processed"], ["GoldZone", "Final Processed"]] BUCKET_CORS_CONFIG = CorsConfiguration(CorsRules=[CorsRules( AllowedOrigins=["*"], AllowedMethods=["POST", "PUT", "HEAD", "GET"], AllowedHeaders=["*"], )]) BUCKET_VERSIONING_CONFIG = VersioningConfiguration(Status="Enabled") BUCKET_ACCELERATION_CONFIG = AccelerateConfiguration( AccelerationStatus="Enabled") def init(): load_dotenv(find_dotenv()) init() DEBUG = os.getenv('DEBUG', False) if not DEBUG: print('---------------------------------------------') print('Loading .env ....') print('Using VIRTUAL_ENV = ', os.getenv('VIRTUAL_ENV')) print('Successfully loaded .env')