Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoupling target sending logic from what the payload is #754

Open
aerosouund opened this issue Feb 7, 2025 · 0 comments
Open

Decoupling target sending logic from what the payload is #754

aerosouund opened this issue Feb 7, 2025 · 0 comments

Comments

@aerosouund
Copy link
Contributor

aerosouund commented Feb 7, 2025

The code for sending to targets should not expect that the payload is a policy report. instead it should treat it as an arbitrary object and interact with it through a generic interface. this would allow the later expansion of the tool to support sending things other than policy reports.
Ideally, the code can depend on something like type Payload interface. and any data that we want to send with the reporter can implement this interface. The description of this interface is still to be discussed. Some of the starting methods can be

type Payload interface {
  Timestamp() time.Time // returns the time this payload was created in
  Body() map[string]interface{} // returns the payload in json format
}

Some targets already transform the result into a json serializable struct (s3, webhook, gcs, kinesis, elasticsearch), while others (slack, telegram, loki) do destination specific transformations that may not be very straightforward to make generic.

cc: @fjogeleit @JimBugwadia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant