<reponame>awichmann-mintel/lpipe
import base64
import json


def raw_payload(payloads):
    def fmt(p):
        return json.dumps(p).encode()

    records = [fmt(p) for p in payloads]
    return records


def kinesis_payload(payloads):
    def fmt(p):
        return {
            "kinesis": {"data": str(base64.b64encode(json.dumps(p).encode()), "utf-8")}
        }

    records = [fmt(p) for p in payloads]
    return {"Records": records}


def sqs_payload(payloads):
    def fmt(p):
        return {"body": json.dumps(p)}

    records = [fmt(p) for p in payloads]
    return {"Records": records}

import base64
import json


def raw_payload(payloads):
    def fmt(p):
        return json.dumps(p).encode()

    records = [fmt(p) for p in payloads]
    return records


def kinesis_payload(payloads):
    def fmt(p):
        return {
            "kinesis": {"data": str(base64.b64encode(json.dumps(p).encode()), "utf-8")}
        }

    records = [fmt(p) for p in payloads]
    return {"Records": records}


def sqs_payload(payloads):
    def fmt(p):
        return {"body": json.dumps(p)}

    records = [fmt(p) for p in payloads]
    return {"Records": records}