client

package
v0.0.0-...-7d4f5d4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICaller

type APICaller interface {
	CreateUserToken(email string, expiration time.Time) (string, error)
	DeleteTarget(string) (int, error)
	GetTargetByID(id string, includeChildren bool) (types.TargetRef, error)
	Init(string)
	InsertOrUpdateMonitor(*types.Monitor) error
	InsertOrUpdateTarget(target *types.Target, forceStatusUpdate bool) error
	InsertRole(*types.Role) error
	ListMonitors(int, int) ([]*types.Monitor, error)
	ListRoles(pageIndex, pageSize int) ([]*types.Role, error)
	ListTargets(string, int, int) ([]*types.Target, error)
	ListUsers(pageIndex, pageSize int) ([]*types.User, error)
	Login(string, string) (string, error)
	UpdateRole(role string, usersAdd, usersRemove []string) error
	UpdateTargetStatus(string, int, string) error
}

APICaller interface

func Create

func Create(log *logr.Logger) APICaller

Create API client.

type APIClient

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

APIClient for calling Spyglass API.

func (*APIClient) CreateUserToken

func (c *APIClient) CreateUserToken(email string, expiration time.Time) (string, error)

func (*APIClient) DeleteTarget

func (c *APIClient) DeleteTarget(id string) (int, error)

func (*APIClient) GetTargetByID

func (c *APIClient) GetTargetByID(id string, includeChildren bool) (types.TargetRef, error)

UpdateTargetStatus operation

func (*APIClient) Init

func (c *APIClient) Init(url string)

Init -ialize the client with the url.

func (*APIClient) InsertOrUpdateMonitor

func (c *APIClient) InsertOrUpdateMonitor(monitor *types.Monitor) error

InsertOrUpdateMonitor operation.

func (*APIClient) InsertOrUpdateTarget

func (c *APIClient) InsertOrUpdateTarget(target *types.Target, forceStatusUpdate bool) error

InsertOrUpdateTarget operation.

func (*APIClient) InsertRole

func (c *APIClient) InsertRole(role *types.Role) error

func (*APIClient) ListMonitors

func (c *APIClient) ListMonitors(pageIndex int, pageSize int) ([]*types.Monitor, error)

ListMonitors operation

func (*APIClient) ListRoles

func (c *APIClient) ListRoles(pageIndex, pageSize int) ([]*types.Role, error)

func (*APIClient) ListTargets

func (c *APIClient) ListTargets(filter string, pageIndex int, pageSize int) ([]*types.Target, error)

ListTargets operation

func (*APIClient) ListUsers

func (c *APIClient) ListUsers(pageIndex, pageSize int) ([]*types.User, error)

func (*APIClient) Login

func (c *APIClient) Login(email string, password string) (string, error)

func (*APIClient) UpdateRole

func (c *APIClient) UpdateRole(role string, usersAdd, usersRemove []string) error

func (*APIClient) UpdateTargetStatus

func (c *APIClient) UpdateTargetStatus(id string, status int, statusDescription string) error

UpdateTargetStatus operation

type CallerMock

type CallerMock struct {
	mock.Mock
}

CallerMock API client mock

func (*CallerMock) GetTargetByID

func (c *CallerMock) GetTargetByID(id string, includeChildren bool) (types.TargetRef, error)

func (*CallerMock) Init

func (c *CallerMock) Init(url string)

Initialize mock.

func (*CallerMock) InsertOrUpdateMonitor

func (c *CallerMock) InsertOrUpdateMonitor(monitor *types.Monitor) error

InsertOrUpdateMonitor operation.

func (*CallerMock) InsertOrUpdateTarget

func (c *CallerMock) InsertOrUpdateTarget(target *types.Target, forceStatusUpdate bool) error

InsertOrUpdateTarget operation.

func (*CallerMock) ListTargets

func (c *CallerMock) ListTargets(filter string, pageIndex int, pageSize int) ([]*types.Target, error)

ListTargets operation

func (*CallerMock) Login

func (c *CallerMock) Login(email string, password string) (string, error)

func (*CallerMock) UpdateTargetStatus

func (c *CallerMock) UpdateTargetStatus(id string, status int, statusDescription string) error

UpdateTargetStatus operation

Jump to

Keyboard shortcuts

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