model

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpenStackType represents a OpenStack type
	OpenStackType string = "openstack"

	// PrometheusType is a Prometheus backend
	PrometheusType string = "prometheus"

	FixedDelay   string = "fixed"
	BackoffDelay string = "backoff"

	// DefaultCloudPrefix is the default etcd prefix for Cloud data
	DefaultCloudPrefix string = "/clouds"

	DefaultHealerPrefix         string = "/healers"
	DefaultHealerQuery          string = "up{job=~\".*compute-cadvisor.*|.*compute-node.*\"} < 1"
	DefaultHealerInterval       string = "18s"
	DefaultHealerDuration       string = "3m"
	DefaultMaxNumberOfInstances int    = 3

	DefaultNResolverPrefix   string = "/nresolvers"
	DefaultNResolverQuery    string = "node_uname_info"
	DefaultNResolverInterval string = "30s"

	// DefaultScalerPrefix is the etcd default prefix for scaler
	DefaultScalerPrefix string = "/scalers"

	// DefaultSilencePrefix is default etcd prefix for Silences
	DefaultSilencePrefix             string = "/silences"
	DefaultSilenceValidationInterval        = "30s"
)
View Source
const (
	// DefaultClusterPrefix is the etcd default prefix for cluster
	DefaultClusterPrefix string = "/cluster"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ATEngine added in v0.2.0

type ATEngine struct {
	Backend  string            `json:"backend"`
	Address  URL               `json:"address"`
	Metadata map[string]string `json:"metadata"`
	Username string            `json:"username,omitempty"`
	Password string            `json:"password,omitempty"`
	APIKey   string            `json:"apikey,omitempty"`
}

func (ATEngine) Validate added in v0.2.0

func (at ATEngine) Validate() error

type Action

type Action struct {
	Type      string `json:"type"`
	Attempts  uint   `json:"attempts,omitempty"`
	Delay     string `json:"delay,omitempty"`
	DelayType string `json:"delay_type,omitempty"`
}

Action represents an scale action

type ActionHTTP

type ActionHTTP struct {
	Action
	URL    URL    `json:"url"`
	Method string `json:"method,omitempty"`
}

func (*ActionHTTP) Validate

func (a *ActionHTTP) Validate() error

Validate returns nil if all fields of the Action have valid values.

type ActionInterface

type ActionInterface interface {
	Validate() error
}

type ActionMail

type ActionMail struct {
	Action
	Receivers Receivers `json:"-"`
	Subject   string    `json:"subject"`
	Body      string    `json:"body"`
}

func (*ActionMail) Validate

func (a *ActionMail) Validate() error

type Alert

type Alert struct {
	Active    bool      `json:"active"`
	StartedAt time.Time `json:"started_at"`
	FiredAt   time.Time `json:"fired_at"`
}

type Cloud

type Cloud struct {
	// The cloud provider type. OpenStack is the only provider supported by now
	Provider  string         `json:"provider"`
	ID        string         `json:"id,omitempty"`
	Endpoints map[string]URL `json:"endpoints"`
	Monitor   Monitor        `json:"monitor"`
	ATEngine  ATEngine       `json:"atengine"`
	Tags      []string       `json:"tags"`
}

Cloud represents Cloud information. Other cloud provider models have to inherited this struct

func (*Cloud) Validate

func (cl *Cloud) Validate() error

type Healer

type Healer struct {
	Actions         map[string]ActionInterface `json:"ractions"`
	ActionsRaw      map[string]json.RawMessage `json:"actions"`
	Active          bool                       `json:"active"`
	Alert           Alert                      `json:"alert,omitempty"`
	CloudID         string                     `json:"cloudid"`
	Description     string                     `json:"description"`
	Duration        string                     `json:"duration"`
	EvaluationLevel int                        `json:"evaluation_level"`
	ID              string                     `json:"id,omitempty"`
	Interval        string                     `json:"interval"`
	Receivers       Receivers                  `json:"receivers"`
	Query           string                     `json:"query"`
	Tags            []string                   `json:"tags"`
}

Healer represents a Healer instance

func (*Healer) Validate

func (h *Healer) Validate() error

Validate healher model

type Member

type Member struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	Address string `json:"address"`
}

Member is the logical node

func (*Member) Validate

func (m *Member) Validate() error

Validate returns nil if all fields of the member have valid values.

type Monitor

type Monitor struct {
	Backend  string            `json:"backend"`
	Address  URL               `json:"address"`
	Metadata map[string]string `json:"metadata"`
	Username string            `json:"username,omitempty"`
	Password string            `json:"password,omitempty"`
}

Monitor represents a monitor backend

type NResolver

type NResolver struct {
	Monitor  Monitor `json:"address"`
	ID       string  `json:"ID"`
	Interval string  `json:"interval"`
	CloudID  string  `json:"cloudid"`
}

func (*NResolver) Validate

func (nr *NResolver) Validate() error

type OpenStack

type OpenStack struct {
	Cloud
	Auth OpenStackAuth `json:"auth"`
}

OpenStack represents OpenStack information.

func (*OpenStack) Validate

func (op *OpenStack) Validate() error

Validate returns nil if all fields of the OpenStack have valid values.

type OpenStackAuth

type OpenStackAuth struct {
	// AuthURL specifies the HTTP endpoint that is required to work with
	// the Identity API of the appropriate version. While it's ultimately needed by
	// all of the identity services, it will often be populated by a provider-level
	// function.
	AuthURL    string `json:"auth_url"`
	RegionName string `json:"region_name"`

	// Username is required if using Identity V2 API. Consult with your provider's
	// control panel to discover your account's username. In Identity V3, either
	// UserID or a combination of Username and DomainID or DomainName are needed.
	Username string `json:"username"`
	UserID   string `json:"userid"`

	Password string `json:"password"`

	// At most one of DomainID and DomainName must be provided if using Username
	// with Identity V3. Otherwise, either are optional.
	DomainName string `json:"domain_name"`
	DomainID   string `json:"domain_id"`

	// The ProjectID and ProjectName fields are optional for the Identity V2 API.
	// The same fields are known as project_id and project_name in the Identity
	// V3 API, but are collected as ProjectID and ProjectName here in both cases.
	// Some providers allow you to specify a ProjectName instead of the ProjectId.
	// Some require both. Your provider's authentication policies will determine
	// how these fields influence authentication.
	// If DomainID or DomainName are provided, they will also apply to ProjectName.
	// It is not currently possible to authenticate with Username and a Domain
	// and scope to a Project in a different Domain by using ProjectName. To
	// accomplish that, the ProjectID will need to be provided as the ProjectID
	// option.
	ProjectName string `json:"project_name"`
	ProjectID   string `json:"project_id"`
}

OpenStackAuth stores information needed to authenticate to an OpenStack Cloud.

type Receivers

type Receivers []string

type Scaler

type Scaler struct {
	Query       string                 `json:"query"`
	Duration    string                 `json:"duration"`
	Description string                 `json:"description"`
	Interval    string                 `json:"interval"`
	Actions     map[string]*ActionHTTP `json:"actions"`
	Tags        []string               `json:"tags"`
	Active      bool                   `json:"active"`
	ID          string                 `json:"id,omitempty"`
	Alert       *Alert                 `json:"alert,omitempty"`
	Cooldown    string                 `json:"cooldown"`
}

Scaler represents a Scaler object

func (*Scaler) Validate

func (s *Scaler) Validate() error

Validate returns nil if all fields of the Scaler have valid values.

type Silence

type Silence struct {
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Pattern      string         `json:"pattern"`
	RegexPattern *regexp.Regexp `json:"-"`
	TTL          string         `json:"ttl"`
	Tags         []string       `json:"tags"`
	Description  string         `json:"description"`
	CreatedAt    time.Time      `json:"created_at"`
	ExpiredAt    time.Time      `json:"expired_at"`
}

func (*Silence) Validate

func (s *Silence) Validate() error

type State

type State int

State is the state that a scaler is in.

const (
	StateNone State = iota
	StateStopping
	StateStopped
	StateFailed
	StateActive
)

func (State) String

func (s State) String() string

type URL

type URL string

URL represents HTTP URL as string

func (URL) String

func (u URL) String() string

func (URL) Validate

func (u URL) Validate() error

Validate validates the raw url is the valid net.URL

Jump to

Keyboard shortcuts

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