statesettings

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Update(c *gin.Context)
	List(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
) API

type AggregationResult

type AggregationResult struct {
	Data       []StateSetting `bson:"data" json:"data"`
	TotalCount int64          `bson:"total_count" json:"total_count"`
}

func (*AggregationResult) GetData

func (r *AggregationResult) GetData() interface{}

func (*AggregationResult) GetTotal

func (r *AggregationResult) GetTotal() int64

type JUnitThresholds

type JUnitThresholds struct {
	Skipped  StateThresholds `json:"skipped" bson:"skipped" binding:"required"`
	Errors   StateThresholds `json:"errors" bson:"errors" binding:"required"`
	Failures StateThresholds `json:"failures" bson:"failures" binding:"required"`
}

type StateSetting

type StateSetting struct {
	ID              string           `json:"_id" bson:"_id"`
	Method          string           `json:"method" bson:"method"`
	Type            string           `json:"type" bson:"type"`
	JunitThresholds *JUnitThresholds `json:"junit_thresholds,omitempty" bson:"junit_thresholds,omitempty"`
}

type StateSettingRequest

type StateSettingRequest struct {
	ID              string           `json:"-" bson:"-"`
	Method          string           `json:"method" bson:"method" binding:"required"`
	Type            string           `json:"type" bson:"type" binding:"required"`
	JunitThresholds *JUnitThresholds `json:"junit_thresholds,omitempty" bson:"junit_thresholds,omitempty"`
}

type StateThresholds

type StateThresholds struct {
	Minor    float64 `json:"minor" bson:"minor" binding:"required,numeric,gte=0,lte=100,ltefield=Major,ltefield=Critical"`
	Major    float64 `json:"major" bson:"major" binding:"required,numeric,gte=0,lte=100,ltefield=Critical"`
	Critical float64 `json:"critical" bson:"critical" binding:"required,numeric,gte=0,lte=100"`
	Type     *int    `json:"type" bson:"type" binding:"required"`
}

type Store

type Store interface {
	Find(query pagination.Query) (AggregationResult, error)
	Update(request StateSettingRequest) (*StateSetting, error)
}

func NewStore

func NewStore(
	dbClient mongo.DbClient,
) Store

type Validator

type Validator interface {
	ValidateStateSettingRequest(sl validator.StructLevel)
	ValidateStateThresholds(sl validator.StructLevel)
}

func NewValidator

func NewValidator() Validator

Jump to

Keyboard shortcuts

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