client

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Source = "pessimism"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertAPIResponse added in v1.0.0

type AlertAPIResponse struct {
	Status  core.AlertStatus
	Message string
}

AlertAPIResponse ... A standardized response for alert clients

type AlertClient added in v1.0.0

type AlertClient interface {
	PostEvent(ctx context.Context, data *AlertEventTrigger) (*AlertAPIResponse, error)
	GetName() string
}

AlertClient ... An interface for alert clients to implement

type AlertEventTrigger added in v1.0.0

type AlertEventTrigger struct {
	Message  string
	Severity core.Severity
	DedupKey core.PUUID
}

AlertEventTrigger ... A standardized event trigger for alert clients

func (*AlertEventTrigger) ToPagerdutyEvent added in v1.0.0

func (a *AlertEventTrigger) ToPagerdutyEvent() *PagerDutyEventTrigger

ToPagerdutyEvent ... Converts an AlertEventTrigger to a PagerDutyEventTrigger

type EthClient

type EthClient interface {
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

	BalanceAt(ctx context.Context, account common.Address, number *big.Int) (*big.Int, error)
	FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery,
		ch chan<- types.Log) (ethereum.Subscription, error)
}

EthClient ... Provides interface wrapper for ethClient functions Useful for mocking go-ethereum json rpc client logic

func FromContext

func FromContext(ctx context.Context, layer core.Network) (EthClient, error)

FromContext ... Retrieves EthClient from context

func NewEthClient

func NewEthClient(ctx context.Context, rawURL string) (EthClient, error)

NewEthClient ... Initializer

type GethClient

type GethClient interface {
	GetProof(ctx context.Context, account common.Address, keys []string,
		blockNumber *big.Int) (*gethclient.AccountResult, error)
}

GethClient ... Provides interface wrapper for gethClient functions

func L2GethFromContext

func L2GethFromContext(ctx context.Context) (GethClient, error)

func NewGethClient

func NewGethClient(rawURL string) (GethClient, error)

NewGethClient ... Initializer

type PagerDutyAPIResponse added in v1.0.0

type PagerDutyAPIResponse struct {
	Status   core.AlertStatus `json:"status"`
	Message  string           `json:"message"`
	DedupKey string           `json:"dedup_key"`
}

PagerDutyAPIResponse ... Represents the structure of a PagerDuty API response

func (*PagerDutyAPIResponse) ToAlertResponse added in v1.0.0

func (p *PagerDutyAPIResponse) ToAlertResponse() *AlertAPIResponse

ToAlertResponse ... Converts a PagerDuty API response to an AlertAPIResponse

type PagerDutyAction added in v1.0.0

type PagerDutyAction string
const (
	Trigger PagerDutyAction = "trigger"
)

type PagerDutyClient added in v1.0.0

type PagerDutyClient interface {
	AlertClient
}

func NewPagerDutyClient added in v1.0.0

func NewPagerDutyClient(cfg *PagerDutyConfig, name string) PagerDutyClient

NewPagerDutyClient ... Initializer for PagerDuty client

type PagerDutyConfig added in v1.0.0

type PagerDutyConfig struct {
	IntegrationKey  string
	ChangeEventsURL string
	AlertEventsURL  string
}

PagerDutyConfig ... Represents the configuration vars for a PagerDuty client

type PagerDutyEventTrigger added in v1.0.0

type PagerDutyEventTrigger struct {
	Message  string
	Severity core.PagerDutySeverity
	DedupKey string
}

PagerDutyEventTrigger ... Represents caller specified fields for a PagerDuty event

type PagerDutyPayload added in v1.0.0

type PagerDutyPayload struct {
	Summary   string                 `json:"summary"`
	Source    string                 `json:"source"`
	Severity  core.PagerDutySeverity `json:"severity"`
	Timestamp time.Time              `json:"timestamp"`
}

PagerDutyPayload ... Represents the payload of a PagerDuty event

type PagerDutyRequest added in v1.0.0

type PagerDutyRequest struct {
	RoutingKey  string           `json:"routing_key"`
	DedupKey    string           `json:"dedup_key"`
	Payload     PagerDutyPayload `json:"payload"`
	EventAction PagerDutyAction  `json:"event_action"`
}

PagerDutyRequest ... Used to construct a PagerDuty api request

type SlackAPIResponse

type SlackAPIResponse struct {
	Message string `json:"message"`
	Err     string `json:"error"`
}

SlackAPIResponse ... represents the structure of a slack API response

func (*SlackAPIResponse) ToAlertResponse added in v1.0.0

func (a *SlackAPIResponse) ToAlertResponse() *AlertAPIResponse

ToAlertResponse ... Converts a slack API response to an alert API response

type SlackClient

type SlackClient interface {
	AlertClient
}

func NewSlackClient

func NewSlackClient(cfg *SlackConfig, name string) SlackClient

NewSlackClient ... Initializer

type SlackConfig added in v1.0.0

type SlackConfig struct {
	Channel  string
	URL      string
	Priority string
}

type SlackPayload

type SlackPayload struct {
	Text    interface{} `json:"text"`
	Channel string      `json:"channel"`
}

SlackPayload represents the structure of a slack alert

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL