[Backend] Set instance-level external audit event destination
Implementation plan
Since there could be a possibility of having multiple external destinations for instance level audit events, following implementation plan is proposed.
- Add a new table with name "instance_audit_events_external_destinations", with following attributes:
- destination_url: text, limit 255, not null.
- verification_token: text.
- For GraphQL API:
- Create new mutations instanceAuditEventExternalDestinationCreate, instanceAuditEventExternalDestinationUpdate, instanceAuditEventExternalDestinationDestroy and query instanceAuditEventExternalDestination for performing CRUD operations on the above table. Details of GraphQL mutations and queries are mentioned in later section.
- For authentication, user must be an admin of the instance.
- No need to create REST APIs or make any changes to existing REST APIs, these will be similar to CI/CD and some other settings.
- Feature will be behind a feature flag
ff_external_audit_events
. - This feature will be available for only ultimate customers under the existing the feature with name
external_audit_events
.
GraphQL queries:
- Create destination:
mutation {
instanceAuditEventExternalDestinationCreate(input: { destinationUrl: "https://example.com/hello". verificationToken: "f4242Qadaf" }) {
errors
instanceAuditEventExternalDestination {
id
destinationUrl
verificationToken
}
}
}
- List destinations:
query {
instanceAuditEventExternalDestination {
nodes {
destinationUrl
verificationToken
id
}
}
}
- Update destination:
mutation {
instanceAuditEventExternalDestinationUpdate(input: { id: destination_id, destinationUrl: "https://example.com/hello". verificationToken: "f4242Qadaf" }) {
errors
instanceAuditEventExternalDestination {
id
destinationUrl
verificationToken
}
}
}
- Destroy destination:
mutation {
instanceAuditEventExternalDestinationDestroy(input: { id: destination_id }) {
errors
}
}
Edited by Hitesh Raghuvanshi