sysdig

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID string `json:"id"`
}

Agent is a Sysdig Agent. // TODO link to docs? What is the structure of this?

type AgentInstallParams

type AgentInstallParams struct {
	AccessKey        string `json:"accessKey"`
	CollectorAddress string `json:"collectorAddress"`
	CollectorPort    int    `json:"collectorPort"`
	CheckCertificate bool   `json:"checkCertificate"`
	SSLEnabled       bool   `json:"sslEnabled"`
}

AgentInstallParams are the agent installation parameters for a User.

type Alert

type Alert struct {
	ID                 int                     `json:"id,omitempty"`
	Version            int                     `json:"version,omitempty"`
	CreatedOn          MilliTime               `json:"createdOn,omitempty"`
	ModifiedOn         MilliTime               `json:"modifiedOn,omitempty"`
	Type               AlertType               `json:"type"`
	Name               string                  `json:"name"`
	Description        string                  `json:"description"`
	Enabled            bool                    `json:"enabled"`
	Criteria           AlertCriteria           `json:"criteria"`
	Severity           Severity                `json:"severity"`
	Timespan           MicroDuration           `json:"timespan"`
	CustomNotification AlertCustomNotification `json:"customNotification"`
	NotificationCount  int                     `json:"notificationCount"`
	TeamID             int                     `json:"teamId"`
	AutoCreated        bool                    `json:"autoCreated"`
	RateOfChange       bool                    `json:"rateOfChange"`
	ReNotifyMinutes    int                     `json:"reNotifyMinutes"`
	ReNotify           bool                    `json:"reNotify"`
	// TODO what is the format of this?
	InvalidMetrics []interface{} `json:"invalidMetrics"`
	GroupName      string        `json:"groupName"`
	Valid          bool          `json:"valid"`
	SeverityLabel  SeverityLabel `json:"severityLabel"`
	Condition      string        `json:"condition"`
	CustomerID     int           `json:"customerId"`
}

Alert defines a Sysdig Alert. See: https://docs.sysdig.com/en/docs/sysdig-monitor/alerts/manage-alerts/

type AlertCriteria

type AlertCriteria struct {
	Text     string      `json:"text"`
	Source   interface{} `json:"source"`
	Severity interface{} `json:"severity"`
	Query    interface{} `json:"query"`
	Scope    interface{} `json:"scope"`
}

AlertCriteria defines the Criteria for an Alert. TODO: What are the format of the unknown fields?

type AlertCustomNotification

type AlertCustomNotification struct {
	TitleTemplate  string `json:"titleTemplate"`
	UseNewTemplate bool   `json:"useNewTemplate"`
}

AlertCustomNotification is the structure for a Custom Notification on an Alert.

type AlertResponse

type AlertResponse struct {
	Alert Alert `json:"alert"`
}

AlertResponse is a container for an Alert returned by the Sysdig API.

type AlertService

type AlertService service

AlertService is the Service for communicating with the Sysdig Monitor Alert related API.

func (*AlertService) Delete

func (s *AlertService) Delete(ctx context.Context, alertID int) (*http.Response, error)

Delete deletes an Alert.

func (*AlertService) Get

func (s *AlertService) Get(ctx context.Context, alertID int) (*AlertResponse, *http.Response, error)

Get retrieves a Alert.

func (*AlertService) List

List lists all Alerts.

type AlertType

type AlertType string

AlertType defines the types of Alerts.

const (
	// AlertTypeEvent means the Alert is from an Event.
	AlertTypeEvent AlertType = "EVENT"
)

type AxesConfiguration

type AxesConfiguration struct {
	Bottom struct {
		Enabled bool `json:"enabled"`
	} `json:"bottom"`
	Left  Axis `json:"left"`
	Right Axis `json:"right"`
}

AxesConfiguration is the configuration for the axes of a Panel in a Dashboard.

type Axis

type Axis struct {
	Enabled        bool        `json:"enabled"`
	DisplayName    *string     `json:"displayName"`
	Unit           string      `json:"unit"`
	DisplayFormat  string      `json:"displayFormat"`
	Decimals       interface{} `json:"decimals"`
	MinValue       *float64    `json:"minValue"`
	MaxValue       *float64    `json:"maxValue"`
	MinInputFormat string      `json:"minInputFormat"`
	MaxInputFormat string      `json:"maxInputFormat"`
	Scale          string      `json:"scale"`
}

Axis is an axis configuration used in an AxesConfiguration for the axes of a Panel in a Dashboard.

type BasicQuery

type BasicQuery struct {
	Enabled      bool                   `json:"enabled"`
	DisplayInfo  BasicQueryDisplayInfo  `json:"displayInfo"`
	Format       BasicQueryFormat       `json:"format"`
	Scope        BasicQueryScope        `json:"scope"`
	CompareTo    BasicQueryCompareTo    `json:"compareTo"`
	Metrics      []BasicQueryMetric     `json:"metrics"`
	Segmentation BasicQuerySegmentation `json:"segmentation,omitempty"`
}

BasicQuery is a basic query type used in a Dashboard.

type BasicQueryCompareTo

type BasicQueryCompareTo struct {
	Enabled    bool   `json:"enabled"`
	Delta      int    `json:"delta"`
	TimeFormat string `json:"timeFormat"`
}

BasicQueryCompareTo is used in a BasicQuery on a Dashboard.

type BasicQueryDisplayInfo

type BasicQueryDisplayInfo struct {
	DisplayName                   string `json:"displayName"`
	TimeSeriesDisplayNameTemplate string `json:"timeSeriesDisplayNameTemplate"`
	Type                          string `json:"type"`
}

BasicQueryDisplayInfo is the display info used in a BasicQuery on a Dashboard.

type BasicQueryFormat

type BasicQueryFormat struct {
	Unit                 string `json:"unit"`
	InputFormat          string `json:"inputFormat"`
	DisplayFormat        string `json:"displayFormat"`
	Decimals             *int   `json:"decimals"`
	YAxis                string `json:"yAxis"`
	NullValueDisplayMode string `json:"nullValueDisplayMode"`
}

BasicQueryFormat is the metric format used in a BasicQuery on a Dashboard.

type BasicQueryMetric

type BasicQueryMetric struct {
	ID               string      `json:"id"`
	TimeAggregation  string      `json:"timeAggregation"`
	GroupAggregation string      `json:"groupAggregation"`
	Descriptor       *string     `json:"descriptor,omitempty"`
	Sorting          interface{} `json:"sorting"`
}

BasicQueryMetric is a metric used in a BasicQuery on a Dashboard.

type BasicQueryScope

type BasicQueryScope struct {
	Expressions           []string `json:"expressions"`
	ExtendsDashboardScope bool     `json:"extendsDashboardScope"`
}

BasicQueryScope is a scope used in a BasicQuery on a Dashboard.

type BasicQuerySegmentation

type BasicQuerySegmentation struct {
	Labels    []BasicQuerySegmentationLabel `json:"labels"`
	Limit     int                           `json:"limit"`
	Direction string                        `json:"direction"`
}

BasicQuerySegmentation is the segmentation used in a BasicQuery on a Dashboard.

type BasicQuerySegmentationLabel

type BasicQuerySegmentationLabel struct {
	ID          string  `json:"id"`
	Descriptor  *string `json:"descriptor,omitempty"`
	DisplayName *string `json:"displayName,omitempty"`
	Sorting     *string `json:"sorting,omitempty"`
}

BasicQuerySegmentationLabel is a segmentation label used in a BasicQuerySegmentation of a BasicQuery on a Dashboard.

type Categories

type Categories []Category

Categories is a type encapsulating a slice of Category to allow for easy marshalling into the proper JSON field.

type Category

type Category string

Category is an event category. Can be used as a filter in EventsService.List.

const (
	// CategoryAlert are Events coming from Alerts.
	CategoryAlert Category = "ALERT"
	// CategoryCustom are custom events sent by the user.
	CategoryCustom Category = "CUSTOM"
	// CategoryDocker are events emitted by Docker.
	CategoryDocker Category = "DOCKER"
	// CategoryContainerd are events emitted by containerd.
	CategoryContainerd Category = "CONTAINERD"
	// CategoryKubernetes are events emitted by Kubernetes.
	CategoryKubernetes Category = "KUBERNETES"
)

type Client

type Client struct {
	// Base URL for API requests. Defaults to the public Sysdig API, but can be
	// set to a domain endpoint to use with IBM or on-premise. BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL
	// User agent used when communicating with the Sysdig API.
	UserAgent string

	// Services used for talking to different parts of the Sysdig API.
	Events               *EventsService
	Users                *UsersService
	NotificationChannels *NotificationChannelsService
	Alerts               *AlertService
	Dashboards           *DashboardService
	Teams                *TeamsService

	// PrometheusClient implements a Prometheus HTTP API Client using the Sysdig Client as a base.
	// Delegates to the implementation in Prometheus' client library.
	// Note: Sysdig provides a limited Prometheus HTTP API, some calls will fail.
	// Known working:
	// - Query
	// - QueryRange
	// - Alerts.
	Prometheus v1.API
	// contains filtered or unexported fields
}

Client manages communication with the Sysdig API.

func NewClient

func NewClient(authenticator authentication.Authenticator, options ...ClientOption) (*Client, error)

NewClient creates a new Sysdig Client and applies all provided ClientOption.

func (*Client) BareDo

func (c *Client) BareDo(ctx context.Context, req *http.Request) (*http.Response, error)

BareDo sends an API request and lets you handle the api response. If an error or API Error occurs, the error will contain more information. Otherwise, you are supposed to read and close the response's Body.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) CheckResponse

func (c *Client) CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have response body, and a JSON response body that maps to ErrorResponse.

func (*Client) Client

func (c *Client) Client() *http.Client

Client returns the http.Client used by this Sysdig client.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If v is nil, and no error happens, the response is returned as is.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) SetLogger

func (c *Client) SetLogger(l Logger)

SetLogger sets the logger to be used by this Sysdig client.

type ClientOption

type ClientOption func(*Client) error

ClientOption defines the options for a Sysdig Client.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL sets the Client.BaseURL to the provided URL. BaseURLs should have a trailing slash.

func WithDebug

func WithDebug(debug bool) ClientOption

WithDebug sets whether to print debug information about requests and responses.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient sets the HTTP client for the Sysdig client.

func WithIBMBaseURL

func WithIBMBaseURL(ibmRegion Region, privateEndpoint bool) ClientOption

WithIBMBaseURL sets the Client.BaseURL to the BaseURL associated with the provided IBM Region and network.

func WithLogger

func WithLogger(l Logger) ClientOption

WithLogger sets the default logger for the Client.

func WithResponseCompression

func WithResponseCompression(shouldCompressResponse bool) ClientOption

WithResponseCompression sets whether to set compression headers in requests to Sysdig.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

WithUserAgent sets the User Agent to be sent to Sysdig.

type ConnectedAgentsResponse

type ConnectedAgentsResponse struct {
	Total  int     `json:"total"`
	Agents []Agent `json:"agents"`
}

ConnectedAgentsResponse describes the response for UsersService.ConnectedAgents.

type Customer

type Customer struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	AccessKey   string    `json:"accessKey"`
	ExternalID  string    `json:"externalId"`
	DateCreated MilliTime `json:"dateCreated"`
}

Customer is the customer information for a User.

type CustomerSettings

type CustomerSettings struct {
	Sysdig      UserSysdigSettings `json:"sysdig"`
	Plan        Plan               `json:"plan"`
	Environment interface{}        `json:"environment"` // TODO What is the format of this...
}

CustomerSettings are the customer related settings for a user.

type Dashboard

type Dashboard struct {
	ID                   int                  `json:"id,omitempty"`
	TeamID               int                  `json:"teamId"`
	UserID               int                  `json:"userId,omitempty"`
	Name                 string               `json:"name"`
	Panels               []Panel              `json:"panels"`
	EventDisplaySettings EventDisplaySettings `json:"eventDisplaySettings"`
	Shared               bool                 `json:"shared"`
	Public               bool                 `json:"public"`
	Version              int                  `json:"version,omitempty"`
	CreatedOn            MilliTime            `json:"createdOn"`
	ModifiedOn           MilliTime            `json:"modifiedOn"`
	Description          string               `json:"description"`
	Layout               []Layout             `json:"layout"`
	SharingSettings      []SharingSetting     `json:"sharingSettings"`
	PublicNotation       bool                 `json:"publicNotation"`
	PublicToken          string               `json:"publicToken"`
	Favorite             bool                 `json:"favorite"`
	Schema               int                  `json:"schema"`
	Username             string               `json:"username"`
	Permissions          []string             `json:"permissions"`
	ScopeExpressionList  []ScopeExpression    `json:"scopeExpressionList,omitempty"`
}

Dashboard is the structure for a Sysdig Dashboard. See: https://docs.sysdig.com/en/docs/sysdig-monitor/dashboards/

func NewDashboard

func NewDashboard(name string) *Dashboard

NewDashboard constructs an empty Dashboard with the given name.

type DashboardResponse

type DashboardResponse struct {
	Dashboard Dashboard `json:"dashboard"`
}

DashboardResponse is a container for a Dashboard returned by the DashboardService API.

type DashboardService

type DashboardService service

DashboardService is the Service for communicating with the Sysdig Monitor Dashboard related API.

func (*DashboardService) Create

Create creates a new Dashboard.

func (*DashboardService) Delete

Delete deletes a Dashboard.

func (*DashboardService) Favorite

func (s *DashboardService) Favorite(ctx context.Context, id int, favorite bool) (*DashboardResponse, *http.Response, error)

Favorite favorites or unfavorites a Dashboard.

func (*DashboardService) Get

func (s *DashboardService) Get(ctx context.Context, dashboardID int) (*DashboardResponse, *http.Response, error)

Get retrieves a Dashboard.

func (*DashboardService) List

List lists all Dashboards.

func (*DashboardService) Transfer

func (s *DashboardService) Transfer(
	ctx context.Context,
	ownerID, targetOwnerID int,
	simulate bool,
	dashboardIDs ...int) (*DashboardTransferResponse, *http.Response, error)

Transfer transfers the ownership of a set of dashboards to another user.

func (*DashboardService) Update

Update updates a Dashboard.

type DashboardTransferResponse

type DashboardTransferResponse struct {
	Results DashboardTransferResults `json:"results"`
}

DashboardTransferResponse is a container for a DashboardTransferResults for the DashboardService.Transfer API.

type DashboardTransferResults

type DashboardTransferResults struct {
	ID              int              `json:"id"`
	Name            string           `json:"name"`
	Private         bool             `json:"privateDashboard"`
	TargetTeamID    int              `json:"targetTeamId"`
	TargetTeamName  string           `json:"targetTeamName"`
	Excluded        []SharingSetting `json:"sharingSettingsExcluded"`
	Kept            []SharingSetting `json:"sharingSettingsKept"`
	CurrentTeamID   int              `json:"currentTeamId"`
	CurrentTeamName string           `json:"currentTeamName"`
}

DashboardTransferResults is the response structure for the DashboardService.Transfer API.

type Direction

type Direction string

Direction defines the ordering of a list of events. (?) TODO figure out what this parameter actually does

const (
	// DirectionBefore will order a list of events by oldest age first (?).
	DirectionBefore Direction = "before"
	// DirectionAfter will order a list of events by newest age first (?).
	DirectionAfter Direction = "after"
)

type Error

type Error struct {
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

Error contains a further explanation for the reason of an error..

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Message  string  `json:"message,omitempty"`
	Errors   []Error `json:"errors,omitempty"`
}

ErrorResponse reports one or more errors caused by an API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error implements the error interface for ErrorResponse.

type Event

type Event struct {
	ID          string            `json:"id"`
	Version     int               `json:"version"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Severity    SeverityLabel     `json:"severity"`
	Scope       string            `json:"scope"`
	Timestamp   MilliTime         `json:"timestamp"`
	CreatedOn   MilliTime         `json:"createdOn"`
	ScopeLabels map[string]string `json:"scopeLabels"`
	Tags        map[string]string `json:"tags"`
	Type        Category          `json:"type"`
}

Event describes an event from the Sysdig API.

type EventDisplaySettings

type EventDisplaySettings struct {
	Enabled     bool                            `json:"enabled"`
	QueryParams EventDisplaySettingsQueryParams `json:"queryParams"`
}

EventDisplaySettings are the event display settings for a Dashboard.

type EventDisplaySettingsQueryParams

type EventDisplaySettingsQueryParams struct {
	Severities    []Severity `json:"severities"`
	AlertStatuses []Status   `json:"alertStatuses"`
	Categories    []Category `json:"categories"`
	Filter        *string    `json:"filter"`
	TeamScope     bool       `json:"teamScope"`
}

EventDisplaySettingsQueryParams are the query parameters used in an EventDisplaySettings for a Dashboard.

type EventOptions

type EventOptions struct {
	// Name is the name of the event.
	Name string `json:"name"`
	// Description is a description of the event.
	Description string `json:"description,omitempty"`
	// Timestamp is the MilliTime an event occurred.
	Timestamp MilliTime `json:"timestamp,omitempty"`
	// Severity is the Severity to the associated with the event.
	Severity SeverityLabel `json:"severity,omitempty"`
	// Scope defines the scope of the event. Only ScopeSelectionIs ScopeSelections allowed during creation.
	Scope string `json:"scope,omitempty"`
	// Tags are optional tags to be added to the event.
	Tags map[string]string `json:"tags,omitempty"`
}

EventOptions are the parameters that make up an Event. To be used with EventsService.Create.

type EventResponse

type EventResponse struct {
	Event Event `json:"event"`
}

EventResponse describes an EventResponse returned from the Sysdig API.

type EventsService

type EventsService service

EventsService is the Service for communicating with the Sysdig Events API.

func (*EventsService) Create

Create creates an event.

func (*EventsService) Delete

func (s *EventsService) Delete(ctx context.Context, eventID string) (*http.Response, error)

Delete deletes an event.

func (*EventsService) Get

func (s *EventsService) Get(ctx context.Context, eventID string) (*EventResponse, *http.Response, error)

Get retrieves an Event.

func (*EventsService) List

List lists events with the given ListEventOptions.

type Infrastructure

type Infrastructure struct {
	HostCount        int `json:"hostCount"`
	ContainerCount   int `json:"containerCount"`
	UnresolvedEvents int `json:"unresolvedEvents"`
	// TODO figure out the structure of these things
	Orchestrations      []interface{}                      `json:"orchestrations"`
	Platforms           []interface{}                      `json:"platforms"`
	ContainerTypes      []interface{}                      `json:"containerTypes"`
	MetricCount         InfrastructureMetricCount          `json:"metricCount"`
	OnPremOverview      OnPremOverview                     `json:"onPremOverview"`
	AgentMetricOverview InfrastructureAgentMetricOverviews `json:"agentMetricOverview"`
}

Infrastructure is metrics about the infrastructure monitored by Sysdig for this team.

type InfrastructureAgentMetricOverviews

type InfrastructureAgentMetricOverviews struct {
	ExceedingLimitCount int     `json:"exceedingLimitCount"`
	TotalAgents         int     `json:"totalAgents"`
	ExceedingLimitPct   float64 `json:"exceedingLimitPct"`
}

InfrastructureAgentMetricOverviews is an overview for Sysdig agents in an TeamsService.Infrastructure response.

type InfrastructureMetricCount

type InfrastructureMetricCount struct {
	Total    int `json:"total"`
	JMX      int `json:"jmx"`
	StatsD   int `json:"statsD"`
	AppCheck int `json:"appCheck"`
}

InfrastructureMetricCount is overview of infrastructure metrics in an TeamsService.Infrastructure response.

type InfrastructureResponse

type InfrastructureResponse struct {
	Infrastructure Infrastructure `json:"infrastructure"`
}

InfrastructureResponse is an Infrastructure container for the TeamsService.Infrastructure API.

type Layout

type Layout struct {
	PanelID int `json:"panelId"`
	X       int `json:"x"`
	Y       int `json:"y"`
	W       int `json:"w"`
	H       int `json:"h"`
}

Layout defines the Layout of Panels a Dashboard.

type LegacyLimits

type LegacyLimits struct {
	JMX                      int     `json:"jmx"`
	Statsd                   int     `json:"statsd"`
	AppCheck                 int     `json:"appCheck"`
	Prometheus               int     `json:"prometheus"`
	PrometheusPerProcess     int     `json:"prometheusPerProcess"`
	Connections              int     `json:"connections"`
	ProgAggregationCount     int     `json:"progAggregationCount"`
	AppCheckAggregationCount int     `json:"appCheckAggregationCount"`
	PromMetricsWeight        float64 `json:"promMetricsWeight"`
	TopFilesCount            int     `json:"topFilesCount"`
	TopDevicesCount          int     `json:"topDevicesCount"`
	HostServerPorts          int     `json:"hostServerPorts"`
	ContainerServerPorts     int     `json:"containerServerPorts"`
	LimitKubernetesResources bool    `json:"limitKubernetesResources"`
	KubernetesPods           int     `json:"kubernetesPods"`
	KubernetesJobs           int     `json:"kubernetesJobs"`
	ContainerDensity         int     `json:"containerDensity"`
	MeerkatSuited            bool    `json:"meerkatSuited"`
}

LegacyLimits are legacy limits for a User.

type LegendConfiguration

type LegendConfiguration struct {
	Enabled     bool     `json:"enabled"`
	Position    string   `json:"position"`
	Layout      string   `json:"layout"`
	ShowCurrent bool     `json:"showCurrent"`
	Width       *float64 `json:"width"`
	Height      *float64 `json:"height"`
}

LegendConfiguration is the configuration for a legend on a Panel in a Dashboard.

type Limits

type Limits struct {
	JMX                      int     `json:"jmx"`
	Statsd                   int     `json:"statsd"`
	AppCheck                 int     `json:"appCheck"`
	Prometheus               int     `json:"prometheus"`
	PrometheusPerProcess     int     `json:"prometheusPerProcess"`
	Connections              int     `json:"connections"`
	ProgAggregationCount     int     `json:"progAggregationCount"`
	AppCheckAggregationCount int     `json:"appCheckAggregationCount"`
	PromMetricsWeight        float64 `json:"promMetricsWeight"`
	TopFilesCount            int     `json:"topFilesCount"`
	TopDevicesCount          int     `json:"topDevicesCount"`
	HostServerPorts          int     `json:"hostServerPorts"`
	ContainerServerPorts     int     `json:"containerServerPorts"`
	LimitKubernetesResources bool    `json:"limitKubernetesResources"`
	KubernetesPods           int     `json:"kubernetesPods"`
	KubernetesJobs           int     `json:"kubernetesJobs"`
	ContainerDensity         int     `json:"containerDensity"`
	MeerkatSuited            bool    `json:"meerkatSuited"`
}

Limits are limits for a User.

type ListAlertConfigurationsResponse

type ListAlertConfigurationsResponse struct {
	Alerts []Alert `json:"alerts"`
}

ListAlertConfigurationsResponse describes the response for AlertsService.List.

type ListDashboardsResponse

type ListDashboardsResponse struct {
	Dashboards []Dashboard `json:"dashboards"`
}

ListDashboardsResponse is a container for Dashboards returned by the DashboardService.List API.

type ListEventOptions

type ListEventOptions struct {
	// Filter can filter events by name.
	Filter string
	// AlertStatus filters events to the matching Status.
	AlertStatus Status
	// Categories filters events to the matching Categories.
	Categories Categories
	// Direction orders the list of events.
	Direction Direction
	// Scope filters events based on the Scope
	Scope string
	// Limit limits the number of events to retrieve, default 100.
	Limit int
	// Pivot is the Event ID to be used as a pivot.
	Pivot string
	// From is the timestamp for the beginning of the events to retrieve.
	From MilliTime
	// To is the timestamp for the end of the events to retrieve.
	To MilliTime
	// IncludeTotal determines whether the return the total count of events and not just the matched events.
	IncludeTotal bool
}

ListEventOptions defines the search parameters for EventsService.List.

type ListEventsResponse

type ListEventsResponse struct {
	Total   int     `json:"total"`
	Matched int     `json:"matched"`
	Events  []Event `json:"events"`
}

ListEventsResponse describes a response returned from the Sysdig List API.

type ListNotificationChannelsResponse

type ListNotificationChannelsResponse struct {
	NotificationChannels []NotificationChannel `json:"notificationChannels"`
}

ListNotificationChannelsResponse describes the response for NotificationChannelsService.List.

type ListTeamsResponse

type ListTeamsResponse struct {
	Teams []Team `json:"teams"`
}

ListTeamsResponse is a container of Teams for the TeamsService.List API.

type ListUsersResponse

type ListUsersResponse struct {
	Offset int    `json:"offset"`
	Total  int    `json:"total"`
	Users  []User `json:"users"`
}

ListUsersResponse is a container for User returned by the TeamsService.ListUsers API.

type Logger

type Logger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})
}

Logger is the interface for logging used by the Client.

type MeResponse

type MeResponse struct {
	User User `json:"user"`
}

MeResponse describes the response for UsersService.Me

type MetricsSettings

type MetricsSettings struct {
	Enforce                       bool         `json:"enforce"`
	ShowExperimentals             bool         `json:"showExperimentals"`
	Limits                        Limits       `json:"limits"`
	LegacyLimits                  LegacyLimits `json:"legacyLimits"`
	EnforceAgentAggregation       bool         `json:"enforceAgentAggregation"`
	EnablePromCalculatedIngestion bool         `json:"enablePromCalculatedIngestion"`
}

MetricsSettings are the metrics settings for a User.

type MicroDuration

type MicroDuration struct {
	time.Duration
}

MicroDuration is a custom time.Duration which implements transforming between time.Duration's default representation and Sysdig's expected Microsecond duration format for timespans.

func NewMicroDuration

func NewMicroDuration(t time.Duration) MicroDuration

NewMicroDuration creates a new MicroDuration with the provided time.Duration.

func (MicroDuration) MarshalJSON

func (t MicroDuration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for MilliTime.

func (*MicroDuration) UnmarshalJSON

func (t *MicroDuration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for MilliTime.

type MilliTime

type MilliTime struct {
	time.Time
}

MilliTime is a custom time.Time which implements transforming between time.Time's default representation and Sysdig's expected time.UnixMillis representation.

func NewMilliTime

func NewMilliTime(t time.Time) MilliTime

NewMilliTime creates a new MilliTime with the provided time.Time.

func UnixMilli

func UnixMilli(msec int64) MilliTime

UnixMilli returns the local MilliTime corresponding to the given Unix time,

func (MilliTime) MarshalJSON

func (t MilliTime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for MilliTime.

func (*MilliTime) UnixMilli

func (t *MilliTime) UnixMilli() int64

UnixMilli converts the time to Unix milliseconds for Sysdig.

func (*MilliTime) UnmarshalJSON

func (t *MilliTime) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for MilliTime.

type NotificationChannel

type NotificationChannel struct {
	Type    NotificationChannelType    `json:"type"`
	Name    string                     `json:"name"`
	Enabled bool                       `json:"enabled"`
	Options NotificationChannelOptions `json:"options"`

	ID         string     `json:"id,omitempty"`
	Version    int        `json:"version,omitempty"`
	CreatedOn  *MilliTime `json:"createdOn,omitempty"`
	ModifiedOn *MilliTime `json:"modifiedOn,omitempty"`
}

NotificationChannel describes a Sysdig notification channel. Used to direct alerts or notifications.

type NotificationChannelOptions

type NotificationChannelOptions struct {
	NotifyOnOK      bool     `json:"notifyOnOk"`
	NotifyOnResolve bool     `json:"notifyOnResolve"`
	ResolveOnOK     bool     `json:"resolveOnOk"`
	Channel         string   `json:"channel"`
	EmailRecipients []string `json:"emailRecipients"`
	URL             string   `json:"url"`
	APIKey          string   `json:"apiKey"`
	RoutingKey      string   `json:"routingKey"`
	Account         string   `json:"account"`
	ServiceKey      string   `json:"serviceKey"`
	ServiceName     string   `json:"serviceName"`
}

NotificationChannelOptions describes the options for a NotificationChannel. See: https://cloud.ibm.com/docs/monitoring?topic=monitoring-notifications_api#notifications-api-parm

type NotificationChannelResponse

type NotificationChannelResponse struct {
	NotificationChannel NotificationChannel `json:"notificationChannel"`
}

NotificationChannelResponse describes the response for a NotificationChannel from the NotificationChannelsService API.

type NotificationChannelType

type NotificationChannelType string

NotificationChannelType is a type of Sysdig notification channel.

const (
	// NotificationChannelTypeEmail is a notification channel which sends to email.
	NotificationChannelTypeEmail NotificationChannelType = "EMAIL"
	// NotificationChannelTypeSNS is a notification channel which sends to Amazon SNS.
	NotificationChannelTypeSNS NotificationChannelType = "SNS"
	// NotificationChannelTypePagerDuty is a notification channel which sends to Pagerduty.
	NotificationChannelTypePagerDuty NotificationChannelType = "PAGER_DUTY"
	// NotificationChannelTypeSlack is a notification channel which sends to Slack.
	NotificationChannelTypeSlack NotificationChannelType = "SLACK"
	// NotificationChannelTypeOpsGenie is a notification channel which sends to OpsGenie.
	NotificationChannelTypeOpsGenie NotificationChannelType = "OPSGENIE"
	// NotificationChannelTypeVictorOps is a notification channel which sends to VictorOps.
	NotificationChannelTypeVictorOps NotificationChannelType = "VICTOROPS"
	// NotificationChannelTypeWebhook is a notification channel which sends to a webhook.
	NotificationChannelTypeWebhook NotificationChannelType = "WEBHOOK"
)

type NotificationChannelsService

type NotificationChannelsService service

NotificationChannelsService is the Service for communicating with the Sysdig Monitor Notification Channel related API.

func (*NotificationChannelsService) Create

Create creates a new NotificationChannel.

func (*NotificationChannelsService) Delete

func (s *NotificationChannelsService) Delete(ctx context.Context, notificationChannelID string) (*http.Response, error)

Delete deletes a NotificationChannel.

func (*NotificationChannelsService) Get

Get retrieves a NotificationChannel.

func (*NotificationChannelsService) List

List lists all NotificationChannels.

type OnPremOverview

type OnPremOverview struct {
	LatestVersion   string `json:"latestVersion"`
	CustomerVersion string `json:"customerVersion"`
	ShowPlanInfo    bool   `json:"showPlanInfo"`
}

OnPremOverview is information about the on-premises installation of Sysdig in an TeamsService.Infrastructure response.

type Panel

type Panel struct {
	ID                     int                 `json:"id"`
	Type                   string              `json:"type"`
	Name                   string              `json:"name"`
	Description            string              `json:"description"`
	NullValueDisplayText   *string             `json:"nullValueDisplayText"`
	BasicQueries           []BasicQuery        `json:"basicQueries,omitempty"`
	NumberThresholds       Thresholds          `json:"numberThresholds,omitempty"`
	ApplyScopeToAll        bool                `json:"applyScopeToAll,omitempty"`
	ApplySegmentationToAll bool                `json:"applySegmentationToAll,omitempty"`
	LegendConfiguration    LegendConfiguration `json:"legendConfiguration,omitempty"`
	AxesConfiguration      AxesConfiguration   `json:"axesConfiguration,omitempty"`
	MarkdownSource         string              `json:"markdownSource,omitempty"`
	TransparentBackground  bool                `json:"transparentBackground,omitempty"`
	PanelTitleVisible      bool                `json:"panelTitleVisible,omitempty"`
	TextAutosized          bool                `json:"textAutosized,omitempty"`
}

Panel is the structure of a Panel in a Dashboard.

type PaymentsIntegrationID

type PaymentsIntegrationID struct {
	ID  string `json:"id"`
	TTL TTL    `json:"ttl"`
}

PaymentsIntegrationID is the ID of the payment integration for this User.

type Plan

type Plan struct {
	MaxAgents                 int                   `json:"maxAgents"`
	OnDemandAgents            int                   `json:"onDemandAgents"`
	MaxTeams                  int                   `json:"maxTeams"`
	Timelines                 []Timeline            `json:"timelines"`
	MetricsSettings           MetricsSettings       `json:"metricsSettings"`
	SecureEnabled             bool                  `json:"secureEnabled"`
	MonitorEnabled            bool                  `json:"monitorEnabled"`
	AllocatedAgentsCount      int                   `json:"allocatedAgentsCount"`
	PaymentsIntegrationID     PaymentsIntegrationID `json:"paymentsIntegrationId"`
	PricingPlan               string                `json:"pricingPlan"`
	IndirectCustomer          bool                  `json:"indirectCustomer"`
	TrialPlanName             string                `json:"trialPlanName"`
	Partner                   string                `json:"partner"`
	MigratedToV2Direct        bool                  `json:"migratedToV2Direct"`
	OverageAssessmentEligible bool                  `json:"overageAssessmentEligible"`
}

Plan is the plan for a User.

type ProductType

type ProductType string

ProductType defines the Sysdig product types. Valid options are `SDC` for Sysdig Monitor and "SDS" for Sysdig Secure.

const (
	// ProductTypeMonitor is the product code for Sysdig Monitor.
	ProductTypeMonitor ProductType = "SDC"
	// ProductTypeSecure is the product code for Sysdig Secure.
	ProductTypeSecure ProductType = "SDS"
	// ProductTypeAny is an empty product code to allow for searching across all products.
	ProductTypeAny ProductType = ""
)

type Region

type Region string

Region is a type for defining available IBM regions for Sysdig.

const (
	// RegionUSSouth is the IBM region us-south, located in Dallas.
	RegionUSSouth Region = "us-south"
	// RegionEUDE is the IBM region eu-de, located in Frankfurt.
	RegionEUDE Region = "eu-de"
	// RegionJPOSA is the IBM region jp-osa, located in Osaka.
	RegionJPOSA Region = "jp-osa"
	// RegionJPTOK is the IBM region jp-tok, located in Tokyo.
	RegionJPTOK Region = "jp-tok"
	// RegionUSEast is the IBM region us-east, located in Washington, DC.
	RegionUSEast Region = "us-east"
	// RegionAUSYD is the IBM region au-syd, located in Sydney.
	RegionAUSYD Region = "au-syd"
	// RegionCATOR is the IBM region ca-tor, located in Toronto.
	RegionCATOR Region = "ca-tor"
	// RegionBRSAO is the IBM region br-sao, located in São Paulo.
	RegionBRSAO Region = "br-sao"
)

type ScopeExpression

type ScopeExpression struct {
	Operand     string   `json:"operand"`
	Operator    string   `json:"operator"`
	DisplayName string   `json:"displayName"`
	Value       []string `json:"value"`
	Descriptor  *string  `json:"descriptor,omitempty"`
	Variable    bool     `json:"variable"`
	IsVariable  bool     `json:"isVariable"`
}

ScopeExpression is a scope expression used in a Dashboard.

type Severity

type Severity int

Severity is the severity level for the Event. The severity is in syslog style and ranges from 0 (high) to 7 (low).

const (
	// SeverityEmergency is a "panic" condition - notify all tech staff
	// on call? (Earthquake? Tornado?) - affects multiple apps/servers/sites.
	SeverityEmergency Severity = iota
	// SeverityAlert should be corrected immediately - notify staff who can fix
	// the problem - example is loss of backup ISP connection.
	SeverityAlert
	// SeverityCritical should be corrected immediately, but indicates failure
	// in a primary system - fix CRITICAL problems before ALERT - example is loss
	// of primary ISP connection.
	SeverityCritical
	// SeverityError is a non-urgent failure - these should be relayed to
	// developers or admins; each item must be resolved within a given time.
	SeverityError
	// SeverityWarning are warning messages - not an error, but indication that
	// an error will occur if action is not taken, e.g. file system 85% full -
	// each item must be resolved within a given time.
	SeverityWarning
	// SeverityNotice are events that are unusual but not error conditions -
	// might be summarized in an email to developers or admins to spot potential
	// problems - no immediate action required.
	SeverityNotice
	// SeverityInformational are normal operational messages - may be harvested
	// for reporting, measuring throughput, etc. - no action required.
	SeverityInformational
	// SeverityDebug is info useful to developers for debugging the app, not
	// useful during operations.
	SeverityDebug
)

type SeverityLabel

type SeverityLabel string

SeverityLabel is the severity level label for an Event.

const (
	// SeverityHigh is a high severity alert. It should be corrected immediately.
	SeverityHigh SeverityLabel = "HIGH"
	// SeverityMedium is a medium severity alert. It should be corrected immediately, but indicates failure
	// in a primary system - fix SeverityHigh problems before SeverityMedium.
	SeverityMedium SeverityLabel = "MEDIUM"
	// SeverityLow is a low severity alert. It is a non-urgent failure - these should be relayed to
	// developers or admins; each item must be resolved within a given time.
	SeverityLow SeverityLabel = "LOW"
	// SeverityInfo are normal operational messages - may be harvested
	// for reporting, measuring throughput, etc. - no action required.
	SeverityInfo SeverityLabel = "INFO"
	// SeverityNone is an event without any specified SeverityLabel.
	SeverityNone SeverityLabel = "NONE"
)

type SharingMember

type SharingMember struct {
	Type      string `json:"type"`
	ID        int    `json:"id"`
	Name      string `json:"name"`
	TeamTheme string `json:"teamTheme"`
}

SharingMember defines a sharing member for a Dashboard.

type SharingSetting

type SharingSetting struct {
	Role   string        `json:"role"`
	Member SharingMember `json:"member"`
}

SharingSetting defines a sharing setting for a Dashboard.

type Status

type Status string

Status is an event status. Can be used as a filter in EventsService.List.

const (
	// StatusTriggered is an event status indicating the event has not
	// been acknowledged.
	StatusTriggered Status = "triggered"
	// StatusResolved is an event status indicating that the event has
	// been resolved.
	StatusResolved Status = "resolved"
	// StatusAcknowledged is an event status indicating that the event
	// has been acknowledged by the user.
	StatusAcknowledged Status = "acknowledged"
	// StatusUnacknowledged is an event status indicating that the event
	// has been unacknowledged by the user.
	StatusUnacknowledged Status = "unacknowledged"
)

type TTL

type TTL struct {
	TTL int `json:"ttl"`
}

TTL is the PaymentsIntegrationID TTL.

type Team

type Team struct {
	Version     int       `json:"version"`
	Description string    `json:"description"`
	Origin      string    `json:"origin"`
	LastUpdated MilliTime `json:"lastUpdated"`
	DateCreated MilliTime `json:"dateCreated"`
	// TODO what is this structure?
	NamespaceFilters    interface{}    `json:"namespaceFilters"`
	CustomerID          int            `json:"customerId"`
	Show                string         `json:"show"`
	Products            []string       `json:"products"`
	Theme               string         `json:"theme"`
	EntryPoint          TeamEntryPoint `json:"entryPoint"`
	DefaultTeamRole     string         `json:"defaultTeamRole"`
	Immutable           bool           `json:"immutable"`
	CanUseSysdigCapture bool           `json:"canUseSysdigCapture"`
	CanUseAgentCli      bool           `json:"canUseAgentCli"`
	CanUseCustomEvents  bool           `json:"canUseCustomEvents"`
	CanUseAwsMetrics    bool           `json:"canUseAwsMetrics"`
	CanUseBeaconMetrics bool           `json:"canUseBeaconMetrics"`
	CanUseRapidResponse bool           `json:"canUseRapidResponse"`
	UserCount           int            `json:"userCount"`
	Name                string         `json:"name"`
	// TODO what is this structure?
	Properties interface{} `json:"properties"`
	ID         int         `json:"id"`
	Default    bool        `json:"default"`
}

Team is the structure for a Sysdig Team. See: https://docs.sysdig.com/en/docs/administration/administration-settings/user-and-team-administration/manage-teams-and-roles/

type TeamEntryPoint

type TeamEntryPoint struct {
	Module string `json:"module"`
}

TeamEntryPoint is the entrypoint for this Team.

type TeamResponse

type TeamResponse struct {
	Team Team `json:"team"`
}

TeamResponse is a container for a Team in the TeamsService.Get API.

type TeamRole

type TeamRole struct {
	TeamID    int    `json:"teamId"`
	TeamName  string `json:"teamName"`
	TeamTheme string `json:"teamTheme"`
	UserID    int    `json:"userId"`
	UserName  string `json:"userName"`
	Role      string `json:"role"`
	Admin     bool   `json:"admin"`
}

TeamRole is the role for a User in a Team.

type TeamsService

type TeamsService service

TeamsService is the Service for communicating with the Sysdig Monitor Team related API.

func (*TeamsService) Delete

func (s *TeamsService) Delete(ctx context.Context, teamID int) (*http.Response, error)

Delete deletes a Team.

func (*TeamsService) Get

func (s *TeamsService) Get(ctx context.Context, teamID int) (*TeamResponse, *http.Response, error)

Get gets a Team.

func (*TeamsService) Infrastructure

func (s *TeamsService) Infrastructure(ctx context.Context) (*InfrastructureResponse, *http.Response, error)

Infrastructure returns metrics about the infrastructure monitored by Sysdig for this team.

func (*TeamsService) List

List returns the list of Teams for the given ProductType.

func (*TeamsService) ListUsers

func (s *TeamsService) ListUsers(ctx context.Context, teamID int) (*ListUsersResponse, *http.Response, error)

ListUsers returns the list of Users for the given Team.

type ThresholdBase

type ThresholdBase struct {
	Severity    string `json:"severity"`
	DisplayText string `json:"displayText"`
}

ThresholdBase is a threshold base for a Thresholds on a Panel in a Dashboard.

type ThresholdValue

type ThresholdValue struct {
	Severity    string  `json:"severity"`
	Value       float64 `json:"value"`
	InputFormat string  `json:"inputFormat"`
	DisplayText string  `json:"displayText"`
}

ThresholdValue is a threshold value for a Thresholds on a Panel in a Dashboard.

type Thresholds

type Thresholds struct {
	Values      []ThresholdValue `json:"values"`
	Base        ThresholdBase    `json:"base"`
	UseDefaults *bool            `json:"useDefaults"`
}

Thresholds are the threshold for a Panel on a Dashboard.

type Timeline

type Timeline struct {
	From     *MilliTime `json:"from"`
	To       *MilliTime `json:"to"`
	Sampling int64      `json:"sampling"`
}

Timeline are the sampling timelines for a Plan.

type Token

type Token struct {
	Key string `json:"key"`
}

Token is a Sysdig token.

type TokenResponse

type TokenResponse struct {
	Token Token `json:"token"`
}

TokenResponse describes the response for UsersService.Token.

type User

type User struct {
	TermsAndConditions   bool               `json:"termsAndConditions"`
	Timezone             string             `json:"timezone"`
	PictureURL           string             `json:"pictureUrl"`
	CustomerSettings     CustomerSettings   `json:"customerSettings"`
	Customer             Customer           `json:"customer"`
	Oauth                bool               `json:"oauth"`
	AgentInstallParams   AgentInstallParams `json:"agentInstallParams"`
	Properties           UserProperties     `json:"properties"`
	ResetPassword        bool               `json:"resetPassword"`
	AdditionalRoles      []interface{}      `json:"additionalRoles"` // TODO What is the format of this...
	TeamRoles            []TeamRole         `json:"teamRoles"`
	LastUpdated          MilliTime          `json:"lastUpdated"`
	AccessKey            string             `json:"accessKey"`
	IntercomUserIDHash   string             `json:"intercomUserIdHash"`
	UniqueIntercomUserID string             `json:"uniqueIntercomUserId"`
	CurrentTeam          int                `json:"currentTeam"`
	Enabled              bool               `json:"enabled"`
	Version              int                `json:"version"`
	DateCreated          MilliTime          `json:"dateCreated"`
	Status               string             `json:"status"`
	Products             []string           `json:"products"`
	FirstName            string             `json:"firstName"`
	LastName             string             `json:"lastName"`
	SystemRole           string             `json:"systemRole"`
	Username             string             `json:"username"`
	LastSeen             int64              `json:"lastSeen"`
	Name                 string             `json:"name"`
	ID                   int                `json:"id"`
}

User defines a Sysdig User.

type UserProperties

type UserProperties struct {
	ResetPassword          bool   `json:"resetPassword"`
	OpenIDConnectProfileID string `json:"OpenID Connect profile id"`
	IAMID                  string `json:"iamId"`
	OpenID                 bool   `json:"openid"`
	UserEmailAlias         string `json:"user_email_alias"`
	HasBeenInvited         bool   `json:"has_been_invited"`
}

UserProperties are the properties for a User.

type UserSysdigSettings

type UserSysdigSettings struct {
	Enabled    bool          `json:"enabled"`
	EnabledSSE bool          `json:"enabledSSE"`
	Buckets    []interface{} `json:"buckets"` // TODO What is the format of this...
}

UserSysdigSettings are the Sysdig settings for a user.

type UsersService

type UsersService service

UsersService is the Service for communicating with the Sysdig Monitor User related API.

func (*UsersService) ConnectedAgents

func (s *UsersService) ConnectedAgents(ctx context.Context) (*ConnectedAgentsResponse, *http.Response, error)

ConnectedAgents lists the connected agents for the user.

func (*UsersService) Me

Me returns information about the current User.

func (*UsersService) Token

Token fetches the API token for this User.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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