elk

package
v0.0.0-...-d221b79 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALERTING_TRUE  = 1
	ALERTING_FALSE = 0
	POWER_STANDBY  = "standby"
	POWER_ON       = "on"
)

Variables

View Source
var (
	APIAddr = os.Getenv("ELK_DIRECT_ADDRESS") // or should this be ELK_ADDR?

)

Functions

func BulkForward

func BulkForward(caller, url, user, pass string, toSend []ElkBulkUpdateItem)

BulkForward preps a bulk request and forwards it. Leave user and pass blank to use the env variables defined above.

func GetRoomsBulk

func GetRoomsBulk(rooms []string) ([]statedefinition.StaticRoom, *nerr.E)

func MakeELKRequest

func MakeELKRequest(method, endpoint string, body interface{}) ([]byte, *nerr.E)

MakeELKRequest .

func MakeGenericELKRequest

func MakeGenericELKRequest(addr, method string, body interface{}, user, pass string) ([]byte, *nerr.E)

MakeGenericELLKRequest .

Types

type Alert

type Alert struct {
	Message   string `json:"message,omitempty"`
	AlertSent string `json:"alert-sent,omitempty"`
	Alerting  bool   `json:"alerting,omitempty"`
	Suppress  bool   `json:"Suppress,omitempty"`
}

type AllQuery

type AllQuery struct {
	Query struct {
		MatchAll map[string]interface{} `json:"match_all"`
	} `json:"query"`
	Size int `json:"size"`
}

type BulkUpdateResponse

type BulkUpdateResponse struct {
	Errors bool `json:"errors"`
}

there are other types, but we don't worry about them, since we don't really do any smart parsing at this time.

type DeviceUpdateInfo

type DeviceUpdateInfo struct {
	Info string `json:"Info"`
	Name string `json:"Name"`
}

type ElkBulkUpdateItem

type ElkBulkUpdateItem struct {
	Index  ElkUpdateHeader
	Delete ElkDeleteHeader
	Doc    interface{}
}

type ElkDeleteHeader

type ElkDeleteHeader struct {
	Header HeaderIndex `json:"delete"`
}

type ElkUpdateHeader

type ElkUpdateHeader struct {
	Header HeaderIndex `json:"index"`
}

type GenericQuery

type GenericQuery struct {
	Query map[string]interface{} `json:"query,omitempty"`
	From  int                    `json:"from,omitempty"`
	Size  int                    `json:"size,omitempty"`
}

type HeaderIndex

type HeaderIndex struct {
	Index string `json:"_index"`
	Type  string `json:"_type"`
	ID    string `json:"_id,omitempty"`
}

type IDQuery

type IDQuery struct {
	Query struct {
		IDS struct {
			Type   string   `json:"type"`
			Values []string `json:"values"`
		} `json:"ids"`
	} `json:"query"`
}

type MatchQuery

type MatchQuery struct {
	Query struct {
		Match map[string]interface{} `json:"match"`
	} `json:"query"`
	Size int `json:"size"`
}

type RoomIssueQueryResponse

type RoomIssueQueryResponse struct {
	Hits struct {
		Wrappers []struct {
			ID    string            `json:"_id"`
			Alert structs.RoomIssue `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

type StaticDeviceQueryResponse

type StaticDeviceQueryResponse struct {
	Hits struct {
		Wrappers []struct {
			ID     string                       `json:"_id"`
			Device statedefinition.StaticDevice `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

type StaticRoomQueryResponse

type StaticRoomQueryResponse struct {
	Hits struct {
		Wrappers []struct {
			ID   string                     `json:"_id"`
			Room statedefinition.StaticRoom `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

type UpdateBody

type UpdateBody struct {
	Doc    map[string]interface{} `json:"doc"`
	Upsert bool                   `json:"doc_as_upsert"`
}

type UpdateHeader

type UpdateHeader struct {
	ID    string `json:"_id,omitempty"`
	Type  string `json:"_type,omitemtpy"`
	Index string `json:"_index,omitempty"`
}

Jump to

Keyboard shortcuts

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