model

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

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

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

	FixedDelay   = "fixed"
	BackoffDelay = "backoff"

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

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

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

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

	// DefaultSchedulerPrefix is the etcd default prefix for scheduler
	DefaultSchedulerPrefix = "/schedulers"

	// DefaultSilencePrefix is default etcd prefix for Silences
	DefaultSilencePrefix             = "/silences"
	DefaultSilenceValidationInterval = "30s"
	DefaultSyncSilencesInterval      = "60s"
	DefaultSyncedSilenceName         = "Auto sync silence from Alertmanger"
	DefaultSyncSilencePrefix         = "[faythe]"

	// DefaultUserPrefix is default etcd prefix for Users
	DefaultUsersPrefix = "/users"

	// DefaultPoliciesPrefix is default etcd prefix for policies
	// This prefix is a bit different than others, it doesn't start with a slash '/'
	DefaultPoliciesPrefix = "policies"
)
View Source
const (
	// DefaultClusterPrefix is the etcd default prefix for cluster
	DefaultClusterPrefix string = "/cluster"
)
View Source
const DefaultMaxNumberOfInstances int = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Type string `json:"type"`
}

Action represents an action

type ActionHTTP

type ActionHTTP struct {
	Action
	URL            URL               `json:"url"`
	CloudAuthToken bool              `json:"cloud_auth_token"`
	Method         string            `json:"method,omitempty"`
	Attempts       uint              `json:"attempts,omitempty"`
	Delay          string            `json:"delay,omitempty"`
	DelayType      string            `json:"delay_type,omitempty"`
	Header         map[string]string `json:"header,omitempty"`
	Body           interface{}       `json:"body,omitempty"`
}

ActionHTTP represents a HTTP request with retry logic.

func (*ActionHTTP) InfoLog

func (a *ActionHTTP) InfoLog() []string

InfoLog returns type, url & method information.

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
	// InfoLog returns a list which is used in logging.
	InfoLog() []string
}

type ActionMail

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

ActionMail represents a Mail object.

func (*ActionMail) InfoLog

func (a *ActionMail) InfoLog() []string

InfoLog returns type & receivers information.

func (*ActionMail) Validate

func (a *ActionMail) Validate() error

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

type ActionMistral

type ActionMistral struct {
	Action
	WorkflowID string                 `json:"workflow_id"`
	Input      map[string]interface{} `json:"-"`
}

ActionMistral is the special action contains OpenStack Mistral workflow information.

func (*ActionMistral) InfoLog

func (a *ActionMistral) InfoLog() []string

InfoLog returns Mistral workflow ID information

func (*ActionMistral) Validate

func (a *ActionMistral) Validate() error

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

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"`
	Tags      []string       `json:"tags"`
	CreatedBy string         `json:"created_by"`
}

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

func (*Cloud) Validate

func (cl *Cloud) Validate() error

Validate cloud information

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"`
	CreatedBy       string                     `json:"created_by"`
	SyncSilences    bool                       `json:"sync_silences"`
}

Healer represents a Healer instance

func (*Healer) Validate

func (h *Healer) Validate() error

Validate healer 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 common.FernetString `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) BaseClient

func (op *OpenStack) BaseClient() (*gophercloud.ProviderClient, error)

func (*OpenStack) NewWorkflowClient

func (op *OpenStack) NewWorkflowClient() (*gophercloud.ServiceClient, error)

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 common.FernetString `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 Polices

type Polices []Policy

type Policy

type Policy struct {
	Path   string `json:"path"`
	Method string `json:"method"`
}

func (Policy) Validate

func (p Policy) Validate() error

type Receivers

type Receivers []string

Receivers is the list of Mail receivers.

type Scaler

type Scaler struct {
	Query       string                     `json:"query"`
	Duration    string                     `json:"duration"`
	Description string                     `json:"description"`
	Interval    string                     `json:"interval"`
	Actions     map[string]ActionInterface `json:"ractions"`
	ActionsRaw  map[string]json.RawMessage `json:"actions"`
	Tags        []string                   `json:"tags"`
	Active      bool                       `json:"active"`
	ID          string                     `json:"id,omitempty"`
	Alert       *Alert                     `json:"alert,omitempty"`
	Cooldown    string                     `json:"cooldown"`
	CloudID     string                     `json:"cloudid"`
	CreatedBy   string                     `json:"created_by"`
}

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 Scheduler

type Scheduler struct {
	Description    string                     `json:"description"`
	Actions        map[string]ActionInterface `json:"ractions"`
	ActionsRaw     map[string]json.RawMessage `json:"actions"`
	Tags           []string                   `json:"tags"`
	Active         bool                       `json:"active"`
	ID             string                     `json:"id,omitempty"`
	CloudID        string                     `json:"cloudid"`
	CreatedBy      string                     `json:"created_by"`
	FromDate       string                     `json:"from_date"`
	ToDate         string                     `json:"to_date"`
	FromCronSlices string                     `json:"from_cron_slices"`
	ToCronSlices   string                     `json:"to_cron_slices"`
	FromDateTime   time.Time                  `json:"from_date_time,omitempty"`
	ToDateTime     time.Time                  `json:"to_date_time,omitempty"`
	FromNextExec   time.Time                  `json:"from_next_exec,omitempty"`
	ToNextExec     time.Time                  `json:"to_next_exec,omitempty"`
}

Scheduler represents a Scheduler object

func (*Scheduler) ForwardFromNextExec

func (s *Scheduler) ForwardFromNextExec()

func (*Scheduler) ForwardToNextExec

func (s *Scheduler) ForwardToNextExec()

func (*Scheduler) IsActive

func (s *Scheduler) IsActive() bool

func (*Scheduler) IsExpired

func (s *Scheduler) IsExpired() bool

func (*Scheduler) Validate

func (s *Scheduler) Validate() error

Validate returns nil if all fields of the Scheduler 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"`
	CreatedBy    string         `json:"created_by"`
}

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

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	ID       string `json:"id,omitempty"`
}

User represents an Faythe user

func (*User) Validate

func (u *User) Validate() error

Validate returns nil if all fields of the User have valid values. Nothing to check, just generate to UUID.

Jump to

Keyboard shortcuts

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