Exemplo n.º 1
0
    def __init__(
            self,
            scope: Stack,
            name: str,
            twilio_account_sid: str,
            twilio_auth_token: str,
            twilio_workspace_sid: str
    ) -> None:
        self.__name = name

        super().__init__(
            scope=scope,
            id=name,
            uuid=f'{name}-uuid',
            function_name=name,
            code=self.__code(),
            layers=[TwilioLayer(scope, f'TwilioLayerFor{name}')],
            handler='index.handler',
            runtime=Runtime.PYTHON_3_8,
            environment={
                'TWILIO_ACCOUNT_SID': twilio_account_sid,
                'TWILIO_AUTH_TOKEN': twilio_auth_token,
                'TWILIO_WORKSPACE_SID': twilio_workspace_sid
            }
        )
Exemplo n.º 2
0
    def __init__(self, scope: Stack):
        super().__init__(scope=scope,
                         id=f'TestingStack',
                         stack_name=f'TestingStack')

        Function(scope=self,
                 id='TestingFunction',
                 code=Code.from_inline('def handler(): return "Hello World!"'),
                 handler='index.handler',
                 runtime=Runtime.PYTHON_3_6,
                 layers=[TwilioLayer(self, 'TestingTwilioLayer')])