goptrail

package module
v0.0.0-...-ed59e96 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2018 License: MIT Imports: 10 Imported by: 0

README

goptrail

go client for papertrail settings api

Documentation

Index

Constants

View Source
const PesterRetries = 50

Variables

This section is empty.

Functions

func MakeRestClient

func MakeRestClient() *pester.Client

Types

type Client

type Client interface {
	ListUsers() ([]User, error)
	InviteUser(User) error
	UpdateUser(User) error
	DeleteUser(User) error

	ListLogDestinations() ([]LogDestination, error)
	RegisterSystem(s InputSystem) (OutputSystem, error)
	GetSystem(id string) (*OutputSystem, error)
	ListSystems() ([]OutputSystem, error)
	UpdateSystem(s InputSystem) error
	UnregisterSystem(id string) error
	AddSystemToGroup(sID, gID string) error
	RemoveSystemFromGroup(sID, gID string) error

	CreateGroup(g Group) (Group, error)
	GetGroup(id string) (Group, error)
	ListGroups() ([]Group, error)
	UpdateGroup(g Group) error
	DeleteGroup(id string) error

	CreateSearch(s Search) (Search, error)
	GetSearch(id string) (Search, error)
	ListSearch() ([]Search, error)
	UpdateSearch(s Search) error
	DeleteSearch(id string) error
}

func NewClient

func NewClient(token string) Client

type DefaultClient

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

func (*DefaultClient) AddSystemToGroup

func (c *DefaultClient) AddSystemToGroup(sID, gID string) error

func (*DefaultClient) CreateGroup

func (c *DefaultClient) CreateGroup(g Group) (Group, error)

func (*DefaultClient) CreateSearch

func (c *DefaultClient) CreateSearch(s Search) (Search, error)

func (*DefaultClient) DeleteGroup

func (c *DefaultClient) DeleteGroup(id string) error

func (*DefaultClient) DeleteSearch

func (c *DefaultClient) DeleteSearch(id string) error

func (*DefaultClient) DeleteUser

func (c *DefaultClient) DeleteUser(u User) error

func (*DefaultClient) GetGroup

func (c *DefaultClient) GetGroup(id string) (Group, error)

func (*DefaultClient) GetSearch

func (c *DefaultClient) GetSearch(id string) (Search, error)

func (*DefaultClient) GetSystem

func (c *DefaultClient) GetSystem(id string) (*OutputSystem, error)

func (*DefaultClient) InviteUser

func (c *DefaultClient) InviteUser(u User) error

func (*DefaultClient) ListGroups

func (c *DefaultClient) ListGroups() ([]Group, error)

func (*DefaultClient) ListLogDestinations

func (c *DefaultClient) ListLogDestinations() ([]LogDestination, error)

func (*DefaultClient) ListSearch

func (c *DefaultClient) ListSearch() ([]Search, error)

func (*DefaultClient) ListSystems

func (c *DefaultClient) ListSystems() ([]OutputSystem, error)

func (*DefaultClient) ListUsers

func (c *DefaultClient) ListUsers() ([]User, error)

func (*DefaultClient) RegisterSystem

func (c *DefaultClient) RegisterSystem(s InputSystem) (OutputSystem, error)

func (*DefaultClient) RemoveSystemFromGroup

func (c *DefaultClient) RemoveSystemFromGroup(sID, gID string) error

func (*DefaultClient) UnregisterSystem

func (c *DefaultClient) UnregisterSystem(id string) error

func (*DefaultClient) UpdateGroup

func (c *DefaultClient) UpdateGroup(g Group) error

func (*DefaultClient) UpdateSearch

func (c *DefaultClient) UpdateSearch(s Search) error

func (*DefaultClient) UpdateSystem

func (c *DefaultClient) UpdateSystem(s InputSystem) error

func (*DefaultClient) UpdateUser

func (c *DefaultClient) UpdateUser(u User) error

type Group

type Group struct {
	ID             int            `json:"id"`
	Name           string         `json:"name"`
	SystemWildcard string         `json:"system_wildcard"`
	Systems        []OutputSystem `json:"systems"`
}

type InputSystem

type InputSystem struct {
	ID              int    `json:"id"`
	Name            string `json:"name"`
	IpAddress       string `json:"ip_address"`
	Hostname        string `json:"hostname"`
	DestinationID   int    `json:"destination_id"`
	DestinationPort int    `json:"destination_port"`
	Description     string `json:"description"`
}

type LogDestination

type LogDestination struct {
	ID     int    `json:"id"`
	Syslog SysLog `json:"syslog"`
}

type OutputSystem

type OutputSystem struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	IpAddress   net.IP `json:"ip_address"`
	Hostname    string `json:"hostname"`
	LastEventAt string `json:"last_event_at"`
	Syslog      SysLog `json:"syslog"`
}
type Search struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Query string `json:"query"`
	Group Group  `json:"group"`
}

type SysLog

type SysLog struct {
	Hostname    string `json:"hostname"`
	Port        int    `json:"port"`
	Description string `json:"description"`
}

type User

type User struct {
	Email              string `json:"email"`
	ID                 int    `json:"id"`
	ReadOnly           int    `json:"read_only"`
	ManageMembers      int    `json:"manage_members"`
	ManageBilling      int    `json:"manage_billing"`
	PurgeLogs          int    `json:"purge_logs"`
	CanAccessAllGroups int    `json:"can_access_all_groups"`
	GroupIDs           []int  `json:"group_ids"`
}

Jump to

Keyboard shortcuts

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