kolide

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxRetriesExceeded = errors.New("max retries exceeded")

Functions

func DeviceEventStreamer

func DeviceEventStreamer(ctx context.Context, log *logrus.Entry, grpcAddress, grpcToken string, grpcSecure bool, stream chan<- *kolidepb.DeviceEvent) error

func New

func New(token string, log logrus.FieldLogger, opts ...ClientOption) *client

Types

type Cache

type Cache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, bool)

func (*Cache[K, V]) Len

func (c *Cache[K, V]) Len() int

func (*Cache[K, V]) MarshalJSON

func (c *Cache[K, V]) MarshalJSON() ([]byte, error)

func (*Cache[K, V]) Replace

func (c *Cache[K, V]) Replace(cache map[K]V)

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, value V)

type Check

type Check struct {
	ID          int64    `json:"id"`
	Tags        []string `json:"tags"`
	DisplayName string   `json:"display_name"`
	Description string   `json:"description"`
}

type Client

type Client interface {
	GetIssues(ctx context.Context) ([]*DeviceFailure, error)
	GetDeviceIssues(ctx context.Context, deviceID string) ([]*DeviceFailure, error)
	GetChecks(ctx context.Context) ([]*Check, error)
	GetDevices(ctx context.Context) ([]*Device, error)
}

type ClientInterceptor

type ClientInterceptor struct {
	RequireTLS bool
	Token      string
}

func (*ClientInterceptor) GetRequestMetadata

func (c *ClientInterceptor) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error)

func (*ClientInterceptor) RequireTransportSecurity

func (c *ClientInterceptor) RequireTransportSecurity() bool

type ClientOption

type ClientOption func(*client)

func WithBaseUrl

func WithBaseUrl(baseUrl string) ClientOption

type Device

type Device struct {
	ID              int64           `json:"id"`
	Name            string          `json:"name"`
	OwnedBy         string          `json:"owned_by"`
	Platform        string          `json:"platform"`
	LastSeenAt      *time.Time      `json:"last_seen_at"`
	FailureCount    int             `json:"failure_count"`
	PrimaryUserName string          `json:"primary_user_name"`
	Serial          string          `json:"serial"`
	AssignedOwner   DeviceOwner     `json:"assigned_owner"`
	Failures        []DeviceFailure `json:"failures"`
}

type DeviceFailure

type DeviceFailure struct {
	ID          int64                  `json:"id"`
	CheckID     int64                  `json:"check_id"`
	Value       map[string]interface{} `json:"value"`
	Title       string                 `json:"title"`
	Timestamp   *time.Time             `json:"timestamp"`
	ResolvedAt  *time.Time             `json:"resolved_at"`
	LastUpdated time.Time              `json:"-"`
	Ignored     bool                   `json:"ignored"`
	Check       Check                  `json:"check"`
	Device      Device                 `json:"device"`
}

type DeviceOwner

type DeviceOwner struct {
	Email string `json:"email"`
}

type FakeClient

type FakeClient struct {
	Devices []Device
}

func (*FakeClient) Build

func (f *FakeClient) Build() Client

func (*FakeClient) GetChecks

func (f *FakeClient) GetChecks(ctx context.Context) ([]*Check, error)

GetChecks implements Client.

func (*FakeClient) GetDeviceIssues

func (f *FakeClient) GetDeviceIssues(ctx context.Context, deviceID string) ([]*DeviceFailure, error)

GetDeviceIssues implements Client.

func (*FakeClient) GetDevices

func (f *FakeClient) GetDevices(ctx context.Context) ([]*Device, error)

GetDevices implements Client.

func (*FakeClient) GetIssues

func (f *FakeClient) GetIssues(ctx context.Context) ([]*DeviceFailure, error)

GetIssues implements Client.

type PaginatedResponse

type PaginatedResponse struct {
	Data       []json.RawMessage `json:"data"`
	Pagination Pagination        `json:"pagination"`
}

type Pagination

type Pagination struct {
	Next          string `json:"next"`
	NextCursor    string `json:"next_cursor"`
	CurrentCursor string `json:"current_cursor"`
	Count         int    `json:"count"`
}

type Transport

type Transport struct {
	Token             string
	Transport         http.RoundTripper
	DefaultRetryAfter time.Duration
	MaxHttpRetries    int
}

func NewTransport

func NewTransport(token string) *Transport

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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