v2

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	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"
)
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 Client

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

func (*Client) CreateTeam

func (client *Client) CreateTeam(ctx context.Context, team Team) (Team, 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) 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) 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 WithToken

func WithToken(token string) ClientOption

func WithURL

func WithURL(url string) ClientOption

type Common

type Common interface {
	TeamInterface
}

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) 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 Requester added in v0.7.3

type Requester interface {
	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) 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 {
	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 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