def logs_writer(name=None, template=None): name = (name or '').title() + 'LogsWriter' return iam.Policy( PolicyName=name, PolicyDocument=Policy( Statement=[ Statement( Effect=Allow, Action=[ CreateLogGroup, CreateLogStream, PutLogEvents, ], Resource=[BaseARN('logs', '*', '*', '*')], ), ] ) )
def test_gov(self): arn = BaseARN("service", "resource", "us-gov-west-1", "account") self.assertEqual( arn.JSONrepr(), "arn:aws-us-gov:service:us-gov-west-1:account:resource")
def test_cn(self): arn = BaseARN("service", "resource", "cn-north-1", "account") self.assertEqual(arn.JSONrepr(), "arn:aws-cn:service:cn-north-1:account:resource")
def test_aws(self): arn = BaseARN("service", "resource", "us-east-1", "account") self.assertEqual(arn.JSONrepr(), "arn:aws:service:us-east-1:account:resource")
def test_dynamic(self): arn = BaseARN("service", "resource", "${AWS::Region}", "account") self.assertEqual( arn.JSONrepr(), "arn:${AWS::Partition}:service:${AWS::Region}:account:resource", )