def post()

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


    def post(self, event: ParentPost):

        application_id = event.application_id

        _LOG.debug(f'Describing application by id \'{application_id}\'')
        application = self.application_service.get_application_by_id(
            application_id=application_id
        )
        if not application:
            _LOG.warning(f'Application with id \'{application_id}\' does not '
                         f'exist.')
            raise ResponseFactory(HTTPStatus.NOT_FOUND).message(
                f'Application with id \'{application_id}\' does not exist.'
            ).exc()

        _LOG.debug('Creating parent')
        parent = self.parent_service.create(
            application_id=application_id,
            customer_id=event.customer_id,
            parent_type=event.type.value,
            description=event.description,
            is_deleted=False,
            meta=event.meta,
            scope=event.scope.value,
            tenant_name=event.tenant,
            cloud=event.cloud.value
        )

        _LOG.debug('Saving parent')
        self.parent_service.save(parent=parent)

        _LOG.debug('Describing parent dto.')
        response = self.parent_service.get_dto(parent=parent)
        _LOG.debug(f'Response: {response}')
        return build_response(content=response)