Documentation ¶
Index ¶
- func EntryPoint(ctx context.Context, m *pubsub.Message) error
- func NewSlackWebhookMessageForCompute(projectID string, zone string, timestamp string, instanceName string, ...) *slack.WebhookMessage
- type ComputeAPILog
- func (l ComputeAPILog) GetInstanceName() string
- func (l ComputeAPILog) GetLogName() string
- func (l ComputeAPILog) GetMessage() string
- func (l ComputeAPILog) GetMethodName() string
- func (l ComputeAPILog) GetProjectID() string
- func (l ComputeAPILog) GetTimeStamp() string
- func (l ComputeAPILog) GetZone() string
- type ComputeLog
- type ComputeStartupScriptLog
- func (l ComputeStartupScriptLog) GetInstanceName() string
- func (l ComputeStartupScriptLog) GetLogName() string
- func (l ComputeStartupScriptLog) GetMessage() string
- func (l ComputeStartupScriptLog) GetMethodName() string
- func (l ComputeStartupScriptLog) GetProjectID() string
- func (l ComputeStartupScriptLog) GetTimeStamp() string
- func (l ComputeStartupScriptLog) GetZone() string
- type Config
- type JSONPayload
- type Labels
- type Operation
- type ProtoPayload
- type Resource
- type Rule
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntryPoint ¶
EntryPoint consumes a Pub/Sub message to send notification via Slack
func NewSlackWebhookMessageForCompute ¶
func NewSlackWebhookMessageForCompute( projectID string, zone string, timestamp string, instanceName string, message string, color string, ) *slack.WebhookMessage
NewSlackWebhookMessageForCompute gets message for Slack WebHook
Types ¶
type ComputeAPILog ¶
type ComputeAPILog struct { ProtoPayload ProtoPayload `json:"protoPayload"` Operation Operation `json:"operation"` // contains filtered or unexported fields }
ComputeAPILog is a JSON-style log from Compute Engine API
func NewComputeAPILog ¶
func NewComputeAPILog(jsonPayload []byte) (*ComputeAPILog, error)
NewComputeAPILog parses JSON log from Compute Engine API and creates ComputeAPILog
func (ComputeAPILog) GetInstanceName ¶
func (l ComputeAPILog) GetInstanceName() string
GetInstanceName returns Compute Engine instance name
func (ComputeAPILog) GetLogName ¶
func (l ComputeAPILog) GetLogName() string
GetLogName returns name of log
func (ComputeAPILog) GetMessage ¶
func (l ComputeAPILog) GetMessage() string
GetMessage returns Compute Engine log message
func (ComputeAPILog) GetMethodName ¶
func (l ComputeAPILog) GetMethodName() string
GetMethodName returns Compute Engine method name
func (ComputeAPILog) GetProjectID ¶
func (l ComputeAPILog) GetProjectID() string
GetProjectID returns GCP project ID
func (ComputeAPILog) GetTimeStamp ¶
func (l ComputeAPILog) GetTimeStamp() string
GetTimeStamp returns timestamp of log
type ComputeLog ¶
type ComputeLog interface { GetInstanceName() string GetMethodName() string GetMessage() string GetProjectID() string GetZone() string GetTimeStamp() string }
ComputeLog is a JSON-style log from Compute Engine
func NewComputeLog ¶
func NewComputeLog(jsonPayload []byte) (ComputeLog, error)
NewComputeLog parses JSON log from any Compute Engine and creates slack webhook message
type ComputeStartupScriptLog ¶
type ComputeStartupScriptLog struct { JSONPayload JSONPayload `json:"jsonPayload"` // contains filtered or unexported fields }
ComputeStartupScriptLog is a JSON-style message of Compute Engine startup script on Cloud Logging
func NewComputeStartupScriptLog ¶
func NewComputeStartupScriptLog(jsonPayload []byte) (*ComputeStartupScriptLog, error)
NewComputeStartupScriptLog parses JSON log from Compute Engine startup script and creates ComputeStartupScriptLog
func (ComputeStartupScriptLog) GetInstanceName ¶
func (l ComputeStartupScriptLog) GetInstanceName() string
GetInstanceName returns Compute Engine instance name
func (ComputeStartupScriptLog) GetLogName ¶
func (l ComputeStartupScriptLog) GetLogName() string
GetLogName returns name of log
func (ComputeStartupScriptLog) GetMessage ¶
func (l ComputeStartupScriptLog) GetMessage() string
GetMessage returns Compute Engine log message
func (ComputeStartupScriptLog) GetMethodName ¶
func (l ComputeStartupScriptLog) GetMethodName() string
GetMethodName returns Compute Engine method name
func (ComputeStartupScriptLog) GetProjectID ¶
func (l ComputeStartupScriptLog) GetProjectID() string
GetProjectID returns GCP project ID
func (ComputeStartupScriptLog) GetTimeStamp ¶
func (l ComputeStartupScriptLog) GetTimeStamp() string
GetTimeStamp returns timestamp of log
type Config ¶
type Config struct { Teams map[string]string `yaml:"teams"` Severity []Severity `yaml:"severity"` Rules []Rule `yaml:"rules"` }
Config is a Slack notifier
func (Config) FindColorByMessage ¶
FindColorByMessage returns color by maching regex with message
func (Config) FindTeamsByInstanceName ¶
FindTeamsByInstanceName returns matched URLs of target teams
type JSONPayload ¶
JSONPayload is a nested field of MessageBody
type Operation ¶
type Operation struct {
Last bool `json:"last"`
}
Operation is a nested field of Operation
type ProtoPayload ¶
type ProtoPayload struct { MethodName string `json:"methodName"` ResourceName string `json:"resourceName"` }
ProtoPayload is a nested field of ProtoPayload