v2

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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](body []byte) (T, error)

Types

type Client

type Client struct {
	DoRequest RequestFunc
	// 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 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 Monitor

type Monitor interface {
	Common
}

func NewMonitor

func NewMonitor(opts ...ClientOption) Monitor

type RequestFunc

type RequestFunc func(ctx context.Context, method string, url string, payload io.Reader) (*http.Response, error)

type Secure

type Secure interface {
	Common
}

func NewSecure

func NewSecure(opts ...ClientOption) Secure

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"`
	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 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