Esempio n. 1
0
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', '*', '*', '*')],
                ),
            ]
        )
    )
Esempio n. 2
0
 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")
Esempio n. 3
0
 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")
Esempio n. 4
0
 def test_aws(self):
     arn = BaseARN("service", "resource", "us-east-1", "account")
     self.assertEqual(arn.JSONrepr(),
                      "arn:aws:service:us-east-1:account:resource")
Esempio n. 5
0
 def test_dynamic(self):
     arn = BaseARN("service", "resource", "${AWS::Region}", "account")
     self.assertEqual(
         arn.JSONrepr(),
         "arn:${AWS::Partition}:service:${AWS::Region}:account:resource",
     )