v2

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetMePath                 = "/api/users/me"
	AuthorizationHeader       = "Authorization"
	ContentTypeHeader         = "Content-Type"
	ContentTypeJSON           = "application/json"
	ContentTypeFormURLEncoded = "x-www-form-urlencoded"
)
View Source
const (
	IBMInstanceIDHeader   = "IBMInstanceID"
	IBMIAMPath            = "/identity/token"
	IBMGrantTypeFormValue = "grant_type"
	IBMApiKeyFormValue    = "apikey"
	IBMAPIKeyGrantType    = "urn:ibm:params:oauth:grant-type:apikey"
	SysdigTeamIDHeader    = "SysdigTeamID"
	GetTeamByNamePath     = "/api/v2/teams/light/name/"
)
View Source
const (
	GetNotificationChannels = "%s/api/notificationChannels"
	GetNotificationChannel  = "%s/api/notificationChannels/%d"
)
View Source
const (
	GetUsersPath = "%s/api/users/light"
	GetTeamsPath = "%s/api/teams"
	GetTeamPath  = "%s/api/teams/%d"
)

Variables

This section is empty.

Functions

func Marshal

func Marshal[T any](data T) (io.Reader, error)

func Unmarshal

func Unmarshal[T any](data io.ReadCloser) (T, error)

Types

type Base added in v1.3.0

type Base interface {
	CurrentTeamID(ctx context.Context) (int, error)
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) CreateNotificationChannel added in v1.2.0

func (client *Client) CreateNotificationChannel(ctx context.Context, channel NotificationChannel) (NotificationChannel, error)

func (*Client) CreateTeam

func (client *Client) CreateTeam(ctx context.Context, team Team) (Team, error)

func (*Client) CurrentTeamID added in v1.3.0

func (client *Client) CurrentTeamID(ctx context.Context) (int, error)

func (*Client) DeleteNotificationChannel added in v1.2.0

func (client *Client) DeleteNotificationChannel(ctx context.Context, id int) error

func (*Client) DeleteTeam

func (client *Client) DeleteTeam(ctx context.Context, id int) error

func (*Client) ErrorFromResponse

func (client *Client) ErrorFromResponse(response *http.Response) error

func (*Client) GetNotificationChannelById added in v1.2.0

func (client *Client) GetNotificationChannelById(ctx context.Context, id int) (NotificationChannel, error)

func (*Client) GetNotificationChannelByName added in v1.2.0

func (client *Client) GetNotificationChannelByName(ctx context.Context, name string) (NotificationChannel, error)

func (*Client) GetNotificationChannelUrl added in v1.2.0

func (client *Client) GetNotificationChannelUrl(id int) string

func (*Client) GetNotificationChannelsUrl added in v1.2.0

func (client *Client) GetNotificationChannelsUrl() string

func (*Client) GetTeamById

func (client *Client) GetTeamById(ctx context.Context, id int) (Team, error)

func (*Client) GetTeamURL

func (client *Client) GetTeamURL(id int) string

func (*Client) GetTeamsURL

func (client *Client) GetTeamsURL() string

func (*Client) GetUserIDByEmail

func (client *Client) GetUserIDByEmail(ctx context.Context, userRoles []UserRoles) ([]UserRoles, error)

func (*Client) GetUsersLightURL

func (client *Client) GetUsersLightURL() string

func (*Client) UpdateNotificationChannel added in v1.2.0

func (client *Client) UpdateNotificationChannel(ctx context.Context, channel NotificationChannel) (NotificationChannel, error)

func (*Client) UpdateTeam

func (client *Client) UpdateTeam(ctx context.Context, team Team) (Team, error)

type ClientOption

type ClientOption func(c *config)

func WithExtraHeaders

func WithExtraHeaders(headers map[string]string) ClientOption

func WithIBMAPIKey added in v1.1.0

func WithIBMAPIKey(key string) ClientOption

func WithIBMIamURL added in v1.1.0

func WithIBMIamURL(url string) ClientOption

func WithIBMInstanceID added in v1.1.0

func WithIBMInstanceID(instanceID string) ClientOption

func WithInsecure

func WithInsecure(insecure bool) ClientOption

func WithSysdigTeamID added in v1.3.0

func WithSysdigTeamID(teamID *int) ClientOption

func WithSysdigTeamName added in v1.3.0

func WithSysdigTeamName(teamName string) ClientOption

func WithToken

func WithToken(token string) ClientOption

func WithURL

func WithURL(url string) ClientOption

type Common

type Common interface {
	TeamInterface
	NotificationChannelInterface
}

type EntryPoint

type EntryPoint struct {
	Module    string `json:"module"`
	Selection string `json:"selection,omitempty"`
}

type IAMTokenResponse added in v1.1.0

type IAMTokenResponse struct {
	AccessToken string `json:"access_token"`
	Expiration  int64  `json:"expiration"`
}

type IBMAccessToken added in v1.1.0

type IBMAccessToken string

type IBMCommon added in v1.1.0

type IBMCommon interface {
	Common
}

type IBMMonitor added in v1.1.0

type IBMMonitor interface {
	IBMCommon
}

func NewIBMMonitor added in v1.1.0

func NewIBMMonitor(opts ...ClientOption) IBMMonitor

type IBMRequest added in v1.1.0

type IBMRequest struct {
	// contains filtered or unexported fields
}

func (*IBMRequest) CurrentTeamID added in v1.3.0

func (ir *IBMRequest) CurrentTeamID(ctx context.Context) (int, error)

func (*IBMRequest) Request added in v1.1.0

func (ir *IBMRequest) Request(ctx context.Context, method string, url string, payload io.Reader) (*http.Response, error)

type NamespaceFilters added in v1.1.0

type NamespaceFilters struct {
	IBMPlatformMetrics *string `json:"ibmPlatformMetrics"`
}

type NotificationChannel added in v1.2.0

type NotificationChannel struct {
	ID      int                        `json:"id,omitempty"`
	Version int                        `json:"version,omitempty"`
	Type    string                     `json:"type"`
	Name    string                     `json:"name"`
	Enabled bool                       `json:"enabled"`
	TeamID  *int                       `json:"teamId,omitempty"`
	Options NotificationChannelOptions `json:"options"`
}

type NotificationChannelInterface added in v1.2.0

type NotificationChannelInterface interface {
	Base
	GetNotificationChannelById(ctx context.Context, id int) (NotificationChannel, error)
	GetNotificationChannelByName(ctx context.Context, name string) (NotificationChannel, error)
	CreateNotificationChannel(ctx context.Context, channel NotificationChannel) (NotificationChannel, error)
	UpdateNotificationChannel(ctx context.Context, channel NotificationChannel) (NotificationChannel, error)
	DeleteNotificationChannel(ctx context.Context, id int) error
}

type NotificationChannelOptions added in v1.2.0

type NotificationChannelOptions struct {
	EmailRecipients   []string               `json:"emailRecipients,omitempty"`   // Type: email
	SnsTopicARNs      []string               `json:"snsTopicARNs,omitempty"`      // Type: SNS
	APIKey            string                 `json:"apiKey,omitempty"`            // Type: VictorOps
	RoutingKey        string                 `json:"routingKey,omitempty"`        // Type: VictorOps
	Url               string                 `json:"url,omitempty"`               // Type: OpsGenie, Webhook and Slack
	Channel           string                 `json:"channel,omitempty"`           // Type: Slack
	Account           string                 `json:"account,omitempty"`           // Type: PagerDuty
	ServiceKey        string                 `json:"serviceKey,omitempty"`        // Type: PagerDuty
	ServiceName       string                 `json:"serviceName,omitempty"`       // Type: PagerDuty
	AdditionalHeaders map[string]interface{} `json:"additionalHeaders,omitempty"` // Type: Webhook
	Region            string                 `json:"region,omitempty"`            // Type: OpsGenie

	NotifyOnOk           bool `json:"notifyOnOk"`
	NotifyOnResolve      bool `json:"notifyOnResolve"`
	SendTestNotification bool `json:"sendTestNotification"`
}

type Requester added in v0.7.3

type Requester interface {
	CurrentTeamID(ctx context.Context) (int, error)
	Request(ctx context.Context, method string, url string, payload io.Reader) (*http.Response, error)
}

type SysdigCommon added in v1.1.0

type SysdigCommon interface {
	Common
}

type SysdigMonitor added in v1.1.0

type SysdigMonitor interface {
	SysdigCommon
}

func NewSysdigMonitor added in v1.1.0

func NewSysdigMonitor(opts ...ClientOption) SysdigMonitor

type SysdigRequest added in v0.7.3

type SysdigRequest struct {
	// contains filtered or unexported fields
}

func (*SysdigRequest) CurrentTeamID added in v1.3.0

func (sr *SysdigRequest) CurrentTeamID(ctx context.Context) (int, error)

func (*SysdigRequest) Request added in v0.7.3

func (sr *SysdigRequest) Request(ctx context.Context, method string, url string, payload io.Reader) (*http.Response, error)

type SysdigSecure added in v1.1.0

type SysdigSecure interface {
	SysdigCommon
}

func NewSysdigSecure added in v1.1.0

func NewSysdigSecure(opts ...ClientOption) SysdigSecure

type Team

type Team struct {
	UserRoles           []UserRoles       `json:"userRoles,omitempty"`
	Description         string            `json:"description"`
	Name                string            `json:"name"`
	ID                  int               `json:"id,omitempty"`
	Version             int               `json:"version,omitempty"`
	Origin              string            `json:"origin,omitempty"`
	LastUpdated         int64             `json:"lastUpdated,omitempty"`
	EntryPoint          *EntryPoint       `json:"entryPoint,omitempty"`
	Theme               string            `json:"theme"`
	CustomerID          int               `json:"customerId,omitempty"`
	DateCreated         int64             `json:"dateCreated,omitempty"`
	Products            []string          `json:"products,omitempty"`
	Show                string            `json:"show,omitempty"`
	Immutable           bool              `json:"immutable,omitempty"`
	CanUseSysdigCapture *bool             `json:"canUseSysdigCapture,omitempty"`
	CanUseCustomEvents  *bool             `json:"canUseCustomEvents,omitempty"`
	CanUseAwsMetrics    *bool             `json:"canUseAwsMetrics,omitempty"`
	CanUseBeaconMetrics *bool             `json:"canUseBeaconMetrics,omitempty"`
	UserCount           int               `json:"userCount,omitempty"`
	Filter              string            `json:"filter,omitempty"`
	NamespaceFilters    *NamespaceFilters `json:"namespaceFilters,omitempty"`
	DefaultTeam         bool              `json:"default,omitempty"`
}

type TeamInterface

type TeamInterface interface {
	Base
	GetUserIDByEmail(ctx context.Context, userRoles []UserRoles) ([]UserRoles, error)
	GetTeamById(ctx context.Context, id int) (t Team, err error)
	CreateTeam(ctx context.Context, tRequest Team) (t Team, err error)
	UpdateTeam(ctx context.Context, tRequest Team) (t Team, err error)
	DeleteTeam(ctx context.Context, id int) error
}

type UnixTimestamp added in v1.1.0

type UnixTimestamp int64

type User added in v1.3.0

type User struct {
	ID          int `json:"id"`
	CurrentTeam int `json:"currentTeam"`
}

type UserRoles

type UserRoles struct {
	UserId int    `json:"userId"`
	Email  string `json:"userName,omitempty"`
	Role   string `json:"role"`
	Admin  bool   `json:"admin,omitempty"`
}

type UsersList

type UsersList struct {
	ID    int    `json:"id"`
	Email string `json:"username"`
}

Jump to

Keyboard shortcuts

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