def publish(self, detail_type, detail, trace_header=None): entry = dict( Detail=json.dumps(detail), DetailType=detail_type, EventBusName=self.bus, Source=self.source, TraceHeader=trace_header, ) params = dict(Entries=[{k: v for k, v in entry.items() if v}]) logger.info('PUT EVENTS %s', logger.json(params)) return self.client.put_events(**params)
def fetch(boto3_session=None, **params): boto3_session = boto3_session or boto3.Session() secrets = boto3_session.client('secretsmanager') logger.info('GET SECRET %s', logger.json(params)) secret = json.loads(secrets.get_secret_value(**params)['SecretString']) return secret
def heartbeat(self, task_token): params = dict(taskToken=task_token) logger.info('SEND TASK HEARTBEAT %s', logger.json(params)) return self.client.send_task_heartbeat(**params)
def succeed(self, task_token, output): params = dict(taskToken=task_token, output=output) logger.info('SEND TASK SUCCESS %s', logger.json(params)) return self.client.send_task_success(**params)
def fail(self, task_token, error, cause): params = dict(taskToken=task_token, error=error, cause=cause) logger.info('SEND TASK FAILURE %s', logger.json(params)) return self.client.send_task_failure(**params)