Documentation ¶
Overview ¶
Package v1 implements the v1 of the k6's REST API
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(cs *ControlSurface) http.Handler
NewHandler returns the top handler for the v1 REST APIs
Types ¶
type Check ¶
type ControlSurface ¶
type ControlSurface struct { RunCtx context.Context Samples chan metrics.SampleContainer MetricsEngine *engine.MetricsEngine Scheduler *execution.Scheduler RunState *lib.TestRunState }
ControlSurface includes the methods the REST API can use to control and communicate with the rest of k6.
type Error ¶
type Error struct { Status string `json:"status,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` }
Error is an api error
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse is a struct wrapper around multiple errors
type Group ¶
type Group struct { ID string `json:"-" yaml:"id"` Path string `json:"path" yaml:"path"` Name string `json:"name" yaml:"name"` Checks []Check `json:"checks" yaml:"checks"` Parent *Group `json:"-" yaml:"-"` ParentID string `json:"-" yaml:"parent-id"` Groups []*Group `json:"-" yaml:"-"` GroupIDs []string `json:"-" yaml:"group-ids"` }
func FlattenGroup ¶
func (*Group) SetToManyReferenceIDs ¶
func (*Group) SetToOneReferenceID ¶
type Metric ¶
type Metric struct { Name string `json:"-" yaml:"name"` Type NullMetricType `json:"type" yaml:"type"` Contains NullValueType `json:"contains" yaml:"contains"` Tainted null.Bool `json:"tainted" yaml:"tainted"` Sample map[string]float64 `json:"sample" yaml:"sample"` }
type MetricsJSONAPI ¶
type MetricsJSONAPI struct {
Data []metricData `json:"data"`
}
MetricsJSONAPI is JSON API envelop for metrics
func (MetricsJSONAPI) Metrics ¶
func (m MetricsJSONAPI) Metrics() []Metric
Metrics extract the []v1.Metric from the JSON API envelop
type NullMetricType ¶
type NullMetricType struct { Type metrics.MetricType Valid bool }
func (NullMetricType) MarshalJSON ¶
func (t NullMetricType) MarshalJSON() ([]byte, error)
func (*NullMetricType) UnmarshalJSON ¶
func (t *NullMetricType) UnmarshalJSON(data []byte) error
type NullSetupData ¶
type NullSetupData struct { SetupData Data interface{} `json:"data,omitempty" yaml:"data"` }
NullSetupData is wrapper around null to satisfy jsonapi
type NullValueType ¶
func (NullValueType) MarshalJSON ¶
func (t NullValueType) MarshalJSON() ([]byte, error)
func (*NullValueType) UnmarshalJSON ¶
func (t *NullValueType) UnmarshalJSON(data []byte) error
type SetupData ¶
type SetupData struct {
Data interface{} `json:"data" yaml:"data"`
}
SetupData is just a simple wrapper to satisfy jsonapi
type Status ¶
type Status struct { Status lib.ExecutionStatus `json:"status" yaml:"status"` Paused null.Bool `json:"paused" yaml:"paused"` VUs null.Int `json:"vus" yaml:"vus"` VUsMax null.Int `json:"vus-max" yaml:"vus-max"` Stopped bool `json:"stopped" yaml:"stopped"` Running bool `json:"running" yaml:"running"` Tainted bool `json:"tainted" yaml:"tainted"` }
type StatusJSONAPI ¶
type StatusJSONAPI struct {
Data statusData `json:"data"`
}
StatusJSONAPI is JSON API envelop for metrics
func NewStatusJSONAPI ¶
func NewStatusJSONAPI(s Status) StatusJSONAPI
NewStatusJSONAPI creates the JSON API status envelop
func (StatusJSONAPI) Status ¶
func (s StatusJSONAPI) Status() Status
Status extract the v1.Status from the JSON API envelop