def post_aws_credentials()

in src/lambdas/modular_api_handler/processors/application_processor.py [0:0]


    def post_aws_credentials(self, event: ApplicationPostAWSCredentials,
                             _pe: ProcessedEvent):
        meta = AWSCredentialsApplicationMeta(accountNumber=event.account_id)
        secret = AWSCredentialsApplicationSecret(
            accessKeyId=event.access_key_id,
            secretAccessKey=event.secret_access_key,
            sessionToken=event.session_token,
            defaultRegion=event.default_region
        )
        app = self.application_service.build(
            customer_id=event.customer_id,
            type=ApplicationType.AWS_CREDENTIALS.value,
            description=event.description,
            is_deleted=False,
            meta=meta.dict(),
            created_by=_pe['cognito_user_id'],
        )
        secret_name = self.ssm.safe_name(
            name=f'modular-service.app.{app.application_id}',
            date=False
        )
        app.secret = self.ssm.put_parameter(
            name=secret_name,
            value=secret.dict()
        )
        _LOG.debug('Saving application')
        self.application_service.save(app)
        return build_response(
            content=self.application_service.get_dto(app),
            code=HTTPStatus.CREATED
        )