api

package
v2.8.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2015 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSource

func GetSource() string

GetSource gets the source name for the CoScale agent.

func IsAuthenticationError

func IsAuthenticationError(err error) bool

Checks if an error is a AuthenticationError.

func IsDisabled

func IsDisabled(err error) bool

Check if an error indicates that the feature was disabled.

func IsDuplicate

func IsDuplicate(err error) (bool, int64)

Check if the error is a duplicate error, if true, this also returns the duplicate id.

func IsNotFoundError

func IsNotFoundError(err error) bool

Checks if an error is an NotFoundError.

func IsRequestError

func IsRequestError(err error) bool

Checks if an error is a RequestError.

Types

type Alert

type Alert struct {
	ID                int64
	Name              string
	Description       string
	Handle            string
	BackupSeconds     int
	BackupHandle      string
	EscalationSeconds int
	EscalationHandle  string
	Version           int64
	Source            string
}

func (Alert) GetId

func (e Alert) GetId() int64

type Api

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

func NewApi

func NewApi(baseUrl string, accessToken string, appID string, rawOutput bool) *Api

NewApi creates a new Api connector using an email and a password.

func (*Api) AddObjectToGroup

func (api *Api) AddObjectToGroup(objectName string, object Object, group Object) error

AddObjectToGroup adds a object (metric, event, etc) to a group of objects.

func (*Api) AlertSolution

func (api *Api) AlertSolution(alert *Alert, solutionType string) (string, error)

AlertSolution will be used to acknowledge/ resolve a alert

func (*Api) CreateEvent

func (api *Api) CreateEvent(name, description, attributeDescriptions, source, typeString string) (string, error)

func (*Api) CreateMetric

func (api *Api) CreateMetric(name, description, datatype, unit, subject, source string, period int) (string, error)

func (*Api) CreateMetricGroup

func (api *Api) CreateMetricGroup(name, description, Type, state, subject, source string) (string, error)

CreateMetricGroup creates a new metric group.

func (*Api) CreateServer

func (api *Api) CreateServer(name string, description string, serverType, source string) (string, error)

CreateServer creates a new server.

func (*Api) CreateServerGroup

func (api *Api) CreateServerGroup(name, description, Type, state, source string) (string, error)

CreateServerGroup creates a new server group.

func (*Api) DeleteEvent

func (api *Api) DeleteEvent(event *Event) error

func (*Api) DeleteObject

func (api *Api) DeleteObject(objectName string, object *Object) error

DeleteObject will delete a object

func (*Api) DeleteObjectFromGroup

func (api *Api) DeleteObjectFromGroup(objectName string, object Object, group Object) error

AddObjectToGroup remove a object (metric, event, etc) from a group of objects.

func (*Api) GetAlertsBy

func (api *Api) GetAlertsBy(query string) (string, error)

GetAlertsBy will use a custom query to get a alert by unresolved/unacknowledged

func (*Api) GetData

func (api *Api) GetData(start, stop int, metricId int64, subjectIds, aggregator string, aggregateSubjects bool) (string, error)

func (*Api) GetEventData

func (api *Api) GetEventData(id int64) (string, error)

func (*Api) GetMetricsByGroup

func (api *Api) GetMetricsByGroup(metricGroup *MetricGroup) (string, error)

GetMetricsByGroup will return all the metrics from a metricgroup

func (*Api) GetObejctRefByName

func (api *Api) GetObejctRefByName(objectName string, name string, result Object) error

GetObejctRefByName will put in result a reference to the oject specified by objectName and name

func (*Api) GetObject

func (api *Api) GetObject(objectName string, id int64) (string, error)

GetObject will return the object (json) specified by objectName that have a certain id

func (*Api) GetObjectByName

func (api *Api) GetObjectByName(objectName string, name string) (string, error)

GetObjectByName will return the object (json) specified by objectName and name

func (*Api) GetObjectRef

func (api *Api) GetObjectRef(objectName string, id int64, result Object) error

GetObjectRef will put in result a reference to a object specified by objectName and that have a certain id

func (*Api) GetObjects

func (api *Api) GetObjects(objectName string) (string, error)

GetObjects will get all the objects (json) specified by objectName. eg: all the metrics or all the servers

func (*Api) InsertData

func (api *Api) InsertData(data *ApiData) (string, error)

InsertData inserts a batch of data. Returns the number of pending actions.

func (*Api) InsertEventData

func (api *Api) InsertEventData(id int64, message, subject, attribute string, timestamp, stopTime int64) (string, error)

func (*Api) Login

func (api *Api) Login() error

Login to the Api, returns the token and an error.

func (*Api) UpdateEvent

func (api *Api) UpdateEvent(event *Event) (string, error)

func (*Api) UpdateMetric

func (api *Api) UpdateMetric(metric *Metric) (string, error)

func (*Api) UpdateMetricGroup

func (api *Api) UpdateMetricGroup(metricGroup *MetricGroup) (string, error)

UpdateMetricGroup updates the name of the metricgroup.

func (*Api) UpdateServer

func (api *Api) UpdateServer(server *Server) (string, error)

func (*Api) UpdateServerGroup

func (api *Api) UpdateServerGroup(serverGroup *ServerGroup) (string, error)

UpdateServerGroup updates the name of the servergroup.

type ApiConfiguration

type ApiConfiguration struct {
	BaseUrl     string
	AccessToken string
	AppId       string
	TemplateId  int64
	Certificate string
}

ApiConfiguration contains all information to connect with the api.

func ReadApiConfiguration

func ReadApiConfiguration(filename string) (*ApiConfiguration, error)

ReadApiConfiguration reads the api configuration from a file.

type ApiData

type ApiData struct {
	MetricID  int64
	SubjectID string
	Data      []DataPoint
}

func ParseDataPoint

func ParseDataPoint(dataPoint string) (*ApiData, error)

dataPoint is provided by user on the command line the format is this:

M2:S100:60:1000,10,0,10,20,30,40,50,60,70,80,90,95,99,100
<SAMPLES>,<PERCENTILE WIDTH>,<PERCENTILE DATA>

func (*ApiData) String

func (data *ApiData) String() string

type AuthenticationError

type AuthenticationError string

func (AuthenticationError) Error

func (ue AuthenticationError) Error() string

type DataPoint

type DataPoint struct {
	SecondsAgo int
	Data       string
}

func (*DataPoint) String

func (data *DataPoint) String() string

type Disabled

type Disabled string

func (Disabled) Error

func (d Disabled) Error() string

type Duplicate

type Duplicate int64

func (Duplicate) Error

func (d Duplicate) Error() string

type Event

type Event struct {
	ID                    int64
	Name                  string
	Description           string
	AttributeDescriptions string
	Type                  string
	Source                string
	State                 string
	Version               int64
}

func (Event) GetId

func (e Event) GetId() int64

type LoginData

type LoginData struct {
	Token string
}

type Metric

type Metric struct {
	ID          int64
	Name        string
	Description string
	DataType    string
	Period      int
	Unit        string
	Source      string
	State       string
	Version     int64
}

func (Metric) GetId

func (e Metric) GetId() int64

type MetricGroup

type MetricGroup struct {
	ID           int64
	Name         string
	Description  string
	Type         string
	MetricGroups []*MetricGroup
	Source       string
	State        string
	Subject      string
	Version      int64
}

func (MetricGroup) GetId

func (e MetricGroup) GetId() int64

type NotFoundError

type NotFoundError string

func (NotFoundError) Error

func (nfe NotFoundError) Error() string

type Object

type Object interface {
	GetId() int64
}

type RequestError

type RequestError string

func (RequestError) Error

func (re RequestError) Error() string

type RequestErrorResponse

type RequestErrorResponse struct {
	Msg  string
	Type string
	ID   int64
}

RequestErrorResponse is response in case of a RequestError.

type Server

type Server struct {
	ID          int64
	Name        string
	Description string
	Type        string
	Source      string
	Attributes  []*ServerAttribute
	State       string
	Version     int64
	Children    map[string]*Server
}

func (Server) GetId

func (e Server) GetId() int64

type ServerAttribute

type ServerAttribute struct {
	ID     int64
	Key    string
	Value  string
	Source string
}

type ServerGroup

type ServerGroup struct {
	ID          int64
	Name        string
	Description string
	Type        string
	Source      string
	State       string
	Version     int64
}

func (ServerGroup) GetId

func (e ServerGroup) GetId() int64

type UnauthorizedError

type UnauthorizedError string

func (UnauthorizedError) Error

func (ue UnauthorizedError) Error() string

Jump to

Keyboard shortcuts

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