insightops

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package insight_goclient provides a insight client which allows the interaction with insight rest API via the seamless resource interfaces exposed. Examples include: - Logsets - Logs - Tags - Labels

Index

Constants

View Source
const (
	ACTIONS_PATH = "/management/actions"
)
View Source
const INSIGHTOPS_API = "https://%s.rest.logs.insight.rapid7.com"
View Source
const (
	LABELS_PATH = "/management/labels"
)
View Source
const (
	LOGSETS_PATH = "/management/logsets"
)
View Source
const (
	LOGS_PATH = "/management/logs"
)
View Source
const (
	TAGS_PATH = "/management/tags"
)
View Source
const (
	TARGETS_PATH = "/management/targets"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Id               string    `json:"id,omitempty"`
	MinMatchesCount  int       `json:"min_matches_count,omitempty"`
	MinReportCount   int       `json:"min_report_count,omitempty"`
	MinMatchesPeriod string    `json:"min_matches_period,omitempty"`
	MinReportPeriod  string    `json:"min_report_period,omitempty"`
	Targets          []*Target `json:"targets,omitempty"`
	Enabled          bool      `json:"enabled,omitempty"`
	Type             string    `json:"type,omitempty"`
}

Action represents the entity used to get an existing action from the InsightOps API

type ActionRequest

type ActionRequest struct {
	Action *Action `json:"action"`
}

type Actions

type Actions struct {
	Actions []*Action `json:"actions"`
}

type Info

type Info struct {
	Id    string  `json:"id,omitempty"`
	Name  string  `json:"name,omitempty"`
	Links []*Link `json:"links,omitempty"`
}

LogsetInfo represent information about the logset

type InsightOpsClient

type InsightOpsClient struct {
	InsightOpsUrl string
	ApiKey        string
	HttpClient    *http.Client
}

func NewInsightOpsClient

func NewInsightOpsClient(apiKey, region string) (*InsightOpsClient, error)

NewInsightOpsClient creates a InsightOps client which exposes an interface with CRUD operations for each of the resources provided by InsightOps rest API

func (*InsightOpsClient) DeleteAction

func (client *InsightOpsClient) DeleteAction(actionId string) error

DeleteTag deletes a specific Action from an account.

func (*InsightOpsClient) DeleteLabel

func (client *InsightOpsClient) DeleteLabel(labelId string) error

DeleteTag deletes a specific Label from an account.

func (*InsightOpsClient) DeleteLog

func (client *InsightOpsClient) DeleteLog(logId string) error

DeleteTag deletes a specific Log from an account.

func (*InsightOpsClient) DeleteLogset

func (client *InsightOpsClient) DeleteLogset(logsetId string) error

DeleteTag deletes a specific Logset from an account.

func (*InsightOpsClient) DeleteTag

func (client *InsightOpsClient) DeleteTag(tagId string) error

DeleteTag deletes a specific Tag from an account.

func (*InsightOpsClient) DeleteTarget

func (client *InsightOpsClient) DeleteTarget(targetId string) error

DeleteTag deletes a specific Target from an account.

func (*InsightOpsClient) GetAction

func (client *InsightOpsClient) GetAction(actionId string) (*Action, error)

GetAction gets a specific Action from an account

func (*InsightOpsClient) GetActions

func (client *InsightOpsClient) GetActions() ([]*Action, error)

GetActions gets details of a list of all Actions

func (*InsightOpsClient) GetLabel

func (client *InsightOpsClient) GetLabel(labelId string) (*Label, error)

GetLabel gets a specific Label from an account

func (*InsightOpsClient) GetLabels

func (client *InsightOpsClient) GetLabels() ([]*Label, error)

GetLabels gets details of a list of all Labels

func (*InsightOpsClient) GetLabelsByName

func (client *InsightOpsClient) GetLabelsByName(name, color string) ([]*Label, error)

GetLabel gets a specific Label from an account by name

func (*InsightOpsClient) GetLog

func (client *InsightOpsClient) GetLog(logId string) (*Log, error)

GetLog gets a specific Log from an account

func (*InsightOpsClient) GetLogToken

func (client *InsightOpsClient) GetLogToken(logsetName, logName string) (string, string, error)

func (*InsightOpsClient) GetLogs

func (client *InsightOpsClient) GetLogs() ([]*Log, error)

GetLogs lists all Logs for an account

func (*InsightOpsClient) GetLogset

func (client *InsightOpsClient) GetLogset(logsetId string) (*Logset, error)

GetLogsets gets details of an existing Log Set

func (*InsightOpsClient) GetLogsetByName

func (client *InsightOpsClient) GetLogsetByName(name string) (*Logset, error)

func (*InsightOpsClient) GetLogsets

func (client *InsightOpsClient) GetLogsets() ([]*Logset, error)

GetLogset gets details of a list of all Log Sets

func (*InsightOpsClient) GetTag

func (client *InsightOpsClient) GetTag(tagId string) (*Tag, error)

GetTag gets details of a list of all Tags and Alerts

func (*InsightOpsClient) GetTags

func (client *InsightOpsClient) GetTags() ([]*Tag, error)

GetTags gets details of an existing Tag and Alert

func (*InsightOpsClient) GetTarget

func (client *InsightOpsClient) GetTarget(targetId string) (*Target, error)

GetTarget gets a specific Target from an account

func (*InsightOpsClient) GetTargets

func (client *InsightOpsClient) GetTargets() ([]*Target, error)

GetTargets gets details of a list of all Targets

func (*InsightOpsClient) GetTargetsByName

func (client *InsightOpsClient) GetTargetsByName(name string) ([]*Target, error)

GetTarget gets a specific Target from an account by name

func (*InsightOpsClient) PostAction

func (client *InsightOpsClient) PostAction(action *Action) error

PostTag creates a new Action

func (*InsightOpsClient) PostLabel

func (client *InsightOpsClient) PostLabel(label *Label) error

PostTag creates a new Label

func (*InsightOpsClient) PostLog

func (client *InsightOpsClient) PostLog(log *Log) error

PostTag creates a new Log

func (*InsightOpsClient) PostLogset

func (client *InsightOpsClient) PostLogset(logset *Logset) error

PostLogset creates a new LogSet

func (*InsightOpsClient) PostTag

func (client *InsightOpsClient) PostTag(tag *Tag) error

PostTag creates a new Tag and Alert

func (*InsightOpsClient) PostTarget

func (client *InsightOpsClient) PostTarget(target *Target) error

PostTag creates a new Target

func (*InsightOpsClient) PutAction

func (client *InsightOpsClient) PutAction(action *Action) error

PutTag updates an existing Action

func (*InsightOpsClient) PutLabel

func (client *InsightOpsClient) PutLabel(label *Label) error

PutTag updates an existing Label

func (*InsightOpsClient) PutLog

func (client *InsightOpsClient) PutLog(log *Log) error

PutTag updates an existing Log

func (*InsightOpsClient) PutLogset

func (client *InsightOpsClient) PutLogset(logset *Logset) error

PutTag updates an existing Logset

func (*InsightOpsClient) PutTag

func (client *InsightOpsClient) PutTag(tag *Tag) error

PutTag updates an existing Tag and Alert

func (*InsightOpsClient) PutTarget

func (client *InsightOpsClient) PutTarget(target *Target) error

PutTag updates an existing Target

type Label

type Label struct {
	Id       string `json:"id,omitempty"`
	SN       int    `json:"sn,omitempty"`
	Name     string `json:"name,omitempty"`
	Color    string `json:"color,omitempty"`
	Reserved bool   `json:"reserved,omitempty"`
}

Label represents the entity used to get an existing label from the InsightOps API

type LabelRequest

type LabelRequest struct {
	Label *Label `json:"label"`
}

type Labels

type Labels struct {
	Labels []*Label `json:"labels"`
}
type Link struct {
	Rel  string `json:"rel,omitempty"`
	Href string `json:"href,omitempty"`
}

type Log

type Log struct {
	Id              string       `json:"id,omitempty"`
	Name            string       `json:"name"`
	LogsetsInfo     []*Info      `json:"logsets_info,omitempty"`
	UserData        *LogUserData `json:"user_data"`
	Tokens          []string     `json:"tokens,omitempty"`
	SourceType      string       `json:"source_type,omitempty"`
	TokenSeed       string       `json:"token_seed,omitempty"`
	Structures      []string     `json:"structures,omitempty"`
	RetentionPeriod string       `json:"retention_period,omitempty"`
	Links           []*Link      `json:"links,omitempty"`
}

Log represents the entity used to get an existing log from the InsightOps API

type LogRequest

type LogRequest struct {
	Log *Log `json:"log"`
}

type LogUserData

type LogUserData struct {
	AgentFileName string     `json:"le_agent_filename"`
	AgentFollow   StringBool `json:"le_agent_follow"`
}

LogUserData represents user metadata

type Logs

type Logs struct {
	Logs []*Log `json:"logs"`
}

type Logset

type Logset struct {
	Id          string            `json:"id,omitempty"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	LogsInfo    []*Info           `json:"logs_info,omitempty"`
	UserData    map[string]string `json:"user_data,omitempty"`
}

PostLogset represents the entity used to create a new logset to the InsightOps API

type LogsetRequest

type LogsetRequest struct {
	Logset *Logset `json:"logset"`
}

type Logsets

type Logsets struct {
	Logsets []*Logset `json:"logsets"`
}

type Source

type Source struct {
	Id              string `json:"id"`
	Name            string `json:"name,omitempty"`
	RetentionPeriod string `json:"retention_period,omitempty"`
	StoredDays      []int  `json:"stored_days,omitempty"`
}

source represents the source log associated with the Tag

type StringBool

type StringBool bool

func (StringBool) MarshalJSON

func (c StringBool) MarshalJSON() ([]byte, error)

func (*StringBool) UnmarshalJSON

func (c *StringBool) UnmarshalJSON(in []byte) error

type Tag

type Tag struct {
	Id          string            `json:"id,omitempty"`
	Type        string            `json:"type"`
	Description string            `json:"description"`
	Name        string            `json:"name"`
	Sources     []*Source         `json:"sources"`
	Actions     []*Action         `json:"actions"`
	Patterns    []string          `json:"patterns"`
	Labels      []*Label          `json:"labels,omitempty"`
	UserData    map[string]string `json:"user_data"`
}

Tag represents the entity used to get an existing tag from the InsightOps API

type TagRequest

type TagRequest struct {
	Tag *Tag `json:"tag"`
}

type Tags

type Tags struct {
	Tags []*Tag `json:"tags"`
}

type Target

type Target struct {
	Id              string                 `json:"id,omitempty"`
	Type            string                 `json:"type,omitempty"`
	Name            string                 `json:"name,omitempty"`
	ParameterSet    *TargetParameterSet    `json:"params_set,omitempty"`
	UserData        map[string]string      `json:"user_data"`
	AlertContentSet *TargetAlertContentSet `json:"alert_content_set,omitempty"`
}

Target represents the entity used to get an existing target from the InsightOps API

type TargetAlertContentSet

type TargetAlertContentSet struct {
	LogLink StringBool `json:"le_log_link"`
	Context StringBool `json:"le_context"`
}

type TargetParameterSet

type TargetParameterSet struct {
	Url         string `json:"url,omitempty"`
	ServiceKey  string `json:"service_key,omitempty"`
	Direct      string `json:"direct,omitempty"`
	Teams       string `json:"teams,omitempty"`
	Users       string `json:"users,omitempty"`
	Description string `json:"description"`
}

type TargetRequest

type TargetRequest struct {
	Target *Target `json:"target"`
}

type Targets

type Targets struct {
	Targets []*Target `json:"targets"`
}

Jump to

Keyboard shortcuts

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