Documentation ¶
Index ¶
- Constants
- func GetOpsGenieRegionalEndpoint(serviceRegion string) string
- type API
- type AlertDeliveryResponse
- type HTTPWrapper
- type HTTPWrapperiface
- type HTTPiface
- type Notification
- type OutputClient
- func (client *OutputClient) Asana(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) CustomWebhook(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Github(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Jira(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) MsTeams(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Opsgenie(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) PagerDuty(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Slack(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Sns(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- func (client *OutputClient) Sqs(ctx context.Context, alert *deliverymodel.Alert, ...) *AlertDeliveryResponse
- type PostInput
Constants ¶
const ( OpsgenieServiceRegionUS = "US" OpsgenieServiceRegionEU = "EU" )
const (
AuthorizationHTTPHeader = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
func GetOpsGenieRegionalEndpoint ¶ added in v1.13.0
Types ¶
type API ¶
type API interface { Slack(context.Context, *deliverymodel.Alert, *outputModels.SlackConfig) *AlertDeliveryResponse PagerDuty(context.Context, *deliverymodel.Alert, *outputModels.PagerDutyConfig) *AlertDeliveryResponse Github(context.Context, *deliverymodel.Alert, *outputModels.GithubConfig) *AlertDeliveryResponse Jira(context.Context, *deliverymodel.Alert, *outputModels.JiraConfig) *AlertDeliveryResponse Opsgenie(context.Context, *deliverymodel.Alert, *outputModels.OpsgenieConfig) *AlertDeliveryResponse MsTeams(context.Context, *deliverymodel.Alert, *outputModels.MsTeamsConfig) *AlertDeliveryResponse Sqs(context.Context, *deliverymodel.Alert, *outputModels.SqsConfig) *AlertDeliveryResponse Sns(context.Context, *deliverymodel.Alert, *outputModels.SnsConfig) *AlertDeliveryResponse Asana(context.Context, *deliverymodel.Alert, *outputModels.AsanaConfig) *AlertDeliveryResponse CustomWebhook(context.Context, *deliverymodel.Alert, *outputModels.CustomWebhookConfig) *AlertDeliveryResponse }
API is the interface for output delivery that can be used for mocks in tests.
type AlertDeliveryResponse ¶ added in v1.8.0
type AlertDeliveryResponse struct { // StatusCode is the http response status code StatusCode int // Message is our wrapped description of the problem: what went wrong. Message string // Permanent indicates whether the alert output should be retried. // For example, outputs which don't exist or errors creating the request are permanent failures. // But any error talking to the output itself can be retried by the Lambda function later. Permanent bool // Success is true if we determine the request executed successfully. False otherwise. Success bool }
AlertDeliveryResponse holds the response (success or failure) of an alert delivery request.
func (*AlertDeliveryResponse) Error ¶ added in v1.8.0
func (e *AlertDeliveryResponse) Error() string
type HTTPWrapper ¶
type HTTPWrapper struct {
// contains filtered or unexported fields
}
HTTPWrapper encapsulates the Golang's http client
type HTTPWrapperiface ¶
type HTTPWrapperiface interface {
// contains filtered or unexported methods
}
HTTPWrapperiface is the interface for our wrapper around Golang's http client
type Notification ¶ added in v1.5.0
type Notification struct { // [REQUIRED] The Policy or Rule ID ID string `json:"id"` // [REQUIRED] The timestamp (RFC3339) of the alert at creation. CreatedAt time.Time `json:"createdAt"` // [REQUIRED] The severity enum of the alert set in Panther UI. Will be one of INFO LOW MEDIUM HIGH CRITICAL. Severity string `json:"severity"` // [REQUIRED] The Type enum if an alert is for a rule or policy. Will be one of RULE POLICY. Type string `json:"type"` // [REQUIRED] Link to the alert in Panther UI Link string `json:"link"` // [REQUIRED] The title for this notification Title string `json:"title"` // [REQUIRED] The Name of the Rule or Policy Name *string `json:"name"` // An AlertID that was triggered by a Rule. It will be `null` in case of policies AlertID *string `json:"alertId"` // An AlertContext AlertContext map[string]interface{} `json:"alertContext"` // The Description of the rule set in Panther UI Description *string `json:"description"` // The Runbook is the user-provided triage information set in Panther UI Runbook *string `json:"runbook"` // Tags is the set of policy tags set in Panther UI Tags []string `json:"tags"` // Version is the S3 object version for the policy Version *string `json:"version"` }
The default payload delivered by all outputs to destinations Each destination can augment this with its own custom fields. This struct intentionally never uses the `omitempty` attribute as we want to keep the keys even if they have `null` fields. However, we need to ensure there are no `null` arrays or objects.
type OutputClient ¶
type OutputClient struct {
// contains filtered or unexported fields
}
OutputClient encapsulates the clients that allow sending alerts to multiple outputs
func New ¶
func New(sess *session.Session) *OutputClient
New creates a new client for alert delivery.
func (*OutputClient) Asana ¶ added in v0.2.0
func (client *OutputClient) Asana( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.AsanaConfig, ) *AlertDeliveryResponse
Asana creates a task in Asana projects
func (*OutputClient) CustomWebhook ¶ added in v1.5.0
func (client *OutputClient) CustomWebhook( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.CustomWebhookConfig) *AlertDeliveryResponse
CustomWebhook alert send an alert.
func (*OutputClient) Github ¶
func (client *OutputClient) Github( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.GithubConfig) *AlertDeliveryResponse
Github alert send an issue.
func (*OutputClient) Jira ¶
func (client *OutputClient) Jira( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.JiraConfig) *AlertDeliveryResponse
Jira alert send an issue.
func (*OutputClient) MsTeams ¶
func (client *OutputClient) MsTeams( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.MsTeamsConfig) *AlertDeliveryResponse
MsTeams alert send an alert.
func (*OutputClient) Opsgenie ¶
func (client *OutputClient) Opsgenie( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.OpsgenieConfig) *AlertDeliveryResponse
Opsgenie alert send an alert.
func (*OutputClient) PagerDuty ¶
func (client *OutputClient) PagerDuty( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.PagerDutyConfig, ) *AlertDeliveryResponse
PagerDuty sends an alert to a pager duty integration endpoint.
func (*OutputClient) Slack ¶
func (client *OutputClient) Slack( ctx context.Context, alert *deliverymodel.Alert, config *outputModels.SlackConfig, ) *AlertDeliveryResponse
Slack sends an alert to a slack channel.
func (*OutputClient) Sns ¶
func (client *OutputClient) Sns(ctx context.Context, alert *deliverymodel.Alert, config *outputModels.SnsConfig) *AlertDeliveryResponse
Sns sends an alert to an SNS Topic. nolint: dupl
func (*OutputClient) Sqs ¶
func (client *OutputClient) Sqs(ctx context.Context, alert *deliverymodel.Alert, config *outputModels.SqsConfig) *AlertDeliveryResponse
Sqs sends an alert to an SQS Queue. nolint: dupl