multiwatcher

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyJobNeedsState

func AnyJobNeedsState(jobs ...MachineJob) bool

AnyJobNeedsState returns true if any of the provided jobs require a state connection.

Types

type ActionInfo

type ActionInfo struct {
	ModelUUID  string                 `json:"model-uuid"`
	Id         string                 `json:"id"`
	Receiver   string                 `json:"receiver"`
	Name       string                 `json:"name"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	Status     string                 `json:"status"`
	Message    string                 `json:"message"`
	Results    map[string]interface{} `json:"results,omitempty"`
	Enqueued   time.Time              `json:"enqueued"`
	Started    time.Time              `json:"started"`
	Completed  time.Time              `json:"completed"`
}

ActionInfo holds the information about a action that is tracked by multiwatcherStore.

func (*ActionInfo) EntityId

func (i *ActionInfo) EntityId() EntityId

EntityId returns a unique identifier for an action across models.

type Address

type Address struct {
	Value           string `json:"value"`
	Type            string `json:"type"`
	Scope           string `json:"scope"`
	SpaceName       string `json:"space-name,omitempty"`
	SpaceProviderId string `json:"space-provider-id,omitempty"`
}

Address describes a network address.

type AnnotationInfo

type AnnotationInfo struct {
	ModelUUID   string            `json:"model-uuid"`
	Tag         string            `json:"tag"`
	Annotations map[string]string `json:"annotations"`
}

AnnotationInfo holds the information about an annotation that is tracked by multiwatcherStore.

func (*AnnotationInfo) EntityId

func (i *AnnotationInfo) EntityId() EntityId

EntityId returns a unique identifier for an annotation across models.

type ApplicationInfo

type ApplicationInfo struct {
	ModelUUID       string                 `json:"model-uuid"`
	Name            string                 `json:"name"`
	Exposed         bool                   `json:"exposed"`
	CharmURL        string                 `json:"charm-url"`
	OwnerTag        string                 `json:"owner-tag"`
	Life            Life                   `json:"life"`
	MinUnits        int                    `json:"min-units"`
	Constraints     constraints.Value      `json:"constraints"`
	Config          map[string]interface{} `json:"config,omitempty"`
	Subordinate     bool                   `json:"subordinate"`
	Status          StatusInfo             `json:"status"`
	WorkloadVersion string                 `json:"workload-version"`
}

ApplicationInfo holds the information about an application that is tracked by multiwatcherStore.

func (*ApplicationInfo) EntityId

func (i *ApplicationInfo) EntityId() EntityId

EntityId returns a unique identifier for an application across models.

type ApplicationOfferInfo

type ApplicationOfferInfo struct {
	ModelUUID            string `json:"model-uuid"`
	OfferName            string `json:"offer-name"`
	OfferUUID            string `json:"offer-uuid"`
	ApplicationName      string `json:"application-name"`
	CharmName            string `json:"charm-name"`
	TotalConnectedCount  int    `json:"total-connected-count"`
	ActiveConnectedCount int    `json:"active-connected-count"`
}

ApplicationOfferInfo holds the information about an application offer that is tracked by multiwatcherStore.

func (*ApplicationOfferInfo) EntityId

func (i *ApplicationOfferInfo) EntityId() EntityId

EntityId returns a unique identifier for an application offer across models.

type BlockInfo

type BlockInfo struct {
	ModelUUID string    `json:"model-uuid"`
	Id        string    `json:"id"`
	Type      BlockType `json:"type"`
	Message   string    `json:"message"`
	Tag       string    `json:"tag"`
}

BlockInfo holds the information about a block that is tracked by multiwatcherStore.

func (*BlockInfo) EntityId

func (i *BlockInfo) EntityId() EntityId

EntityId returns a unique identifier for a block across models.

type BlockType

type BlockType string

BlockType values define model block type.

const (
	// BlockDestroy type identifies destroy blocks.
	BlockDestroy BlockType = "BlockDestroy"

	// BlockRemove type identifies remove blocks.
	BlockRemove BlockType = "BlockRemove"

	// BlockChange type identifies change blocks.
	BlockChange BlockType = "BlockChange"
)

type CharmRelation

type CharmRelation struct {
	Name      string `json:"name"`
	Role      string `json:"role"`
	Interface string `json:"interface"`
	Optional  bool   `json:"optional"`
	Limit     int    `json:"limit"`
	Scope     string `json:"scope"`
}

CharmRelation is a mirror struct for charm.Relation.

func NewCharmRelation

func NewCharmRelation(cr charm.Relation) CharmRelation

NewCharmRelation creates a new local CharmRelation structure from the charm.Relation structure. NOTE: when we update the database to not store a charm.Relation directly in the database, this method should take the state structure type.

type Delta

type Delta struct {
	// If Removed is true, the entity has been removed;
	// otherwise it has been created or changed.
	Removed bool `json:"removed"`
	// Entity holds data about the entity that has changed.
	Entity EntityInfo `json:"entity"`
}

Delta holds details of a change to the model.

func (*Delta) MarshalJSON

func (d *Delta) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Delta) UnmarshalJSON

func (d *Delta) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Endpoint

type Endpoint struct {
	ApplicationName string        `json:"application-name"`
	Relation        CharmRelation `json:"relation"`
}

Endpoint holds an application-relation pair.

type EntityId

type EntityId struct {
	Kind      string `json:"kind"`
	ModelUUID string `json:"model-uuid"`
	Id        string `json:"id"`
}

EntityId uniquely identifies an entity being tracked by the multiwatcherStore.

type EntityInfo

type EntityInfo interface {
	// EntityId returns an identifier that will uniquely
	// identify the entity within its kind
	EntityId() EntityId
}

EntityInfo is implemented by all entity Info types.

type Life

type Life string

Life describes the lifecycle state of an entity ("alive", "dying" or "dead").

type MachineInfo

type MachineInfo struct {
	ModelUUID                string                            `json:"model-uuid"`
	Id                       string                            `json:"id"`
	InstanceId               string                            `json:"instance-id"`
	AgentStatus              StatusInfo                        `json:"agent-status"`
	InstanceStatus           StatusInfo                        `json:"instance-status"`
	Life                     Life                              `json:"life"`
	Config                   map[string]interface{}            `json:"config,omitempty"`
	Series                   string                            `json:"series"`
	SupportedContainers      []instance.ContainerType          `json:"supported-containers"`
	SupportedContainersKnown bool                              `json:"supported-containers-known"`
	HardwareCharacteristics  *instance.HardwareCharacteristics `json:"hardware-characteristics,omitempty"`
	Jobs                     []MachineJob                      `json:"jobs"`
	Addresses                []Address                         `json:"addresses"`
	HasVote                  bool                              `json:"has-vote"`
	WantsVote                bool                              `json:"wants-vote"`
}

MachineInfo holds the information about a machine that is tracked by multiwatcherStore.

func (*MachineInfo) EntityId

func (i *MachineInfo) EntityId() EntityId

EntityId returns a unique identifier for a machine across models.

type MachineJob

type MachineJob string

MachineJob values define responsibilities that machines may be expected to fulfil.

const (
	JobHostUnits   MachineJob = "JobHostUnits"
	JobManageModel MachineJob = "JobManageModel"
)

func (MachineJob) NeedsState

func (job MachineJob) NeedsState() bool

NeedsState returns true if the job requires a state connection.

type ModelInfo

type ModelInfo struct {
	ModelUUID      string                 `json:"model-uuid"`
	Name           string                 `json:"name"`
	Life           Life                   `json:"life"`
	Owner          string                 `json:"owner"`
	ControllerUUID string                 `json:"controller-uuid"`
	IsController   bool                   `json:"is-controller"`
	Config         map[string]interface{} `json:"config,omitempty"`
	Status         StatusInfo             `json:"status"`
	Constraints    constraints.Value      `json:"constraints"`
	SLA            ModelSLAInfo           `json:"sla"`
}

ModelInfo holds the information about an model that is tracked by multiwatcherStore.

func (*ModelInfo) EntityId

func (i *ModelInfo) EntityId() EntityId

EntityId returns a unique identifier for an model.

type ModelSLAInfo

type ModelSLAInfo struct {
	Level string `json:"level"`
	Owner string `json:"owner"`
}

ModelSLAInfo describes the SLA info for a model. Note: this replicates the type of the same name in the params package.

type Port

type Port struct {
	Protocol string `json:"protocol"`
	Number   int    `json:"number"`
}

Port identifies a network port number for a particular protocol.

type PortRange

type PortRange struct {
	FromPort int    `json:"from-port"`
	ToPort   int    `json:"to-port"`
	Protocol string `json:"protocol"`
}

PortRange represents a single range of ports.

type RelationInfo

type RelationInfo struct {
	ModelUUID string     `json:"model-uuid"`
	Key       string     `json:"key"`
	Id        int        `json:"id"`
	Endpoints []Endpoint `json:"endpoints"`
}

RelationInfo holds the information about a relation that is tracked by multiwatcherStore.

func (*RelationInfo) EntityId

func (i *RelationInfo) EntityId() EntityId

EntityId returns a unique identifier for a relation across models.

type RemoteApplicationInfo

type RemoteApplicationInfo struct {
	ModelUUID string     `json:"model-uuid"`
	Name      string     `json:"name"`
	OfferUUID string     `json:"offer-uuid"`
	OfferURL  string     `json:"offer-url"`
	Life      Life       `json:"life"`
	Status    StatusInfo `json:"status"`
}

RemoteApplicationInfo holds the information about a remote application that is tracked by multiwatcherStore.

func (*RemoteApplicationInfo) EntityId

func (i *RemoteApplicationInfo) EntityId() EntityId

EntityId returns a unique identifier for a remote application across models.

type StatusInfo

type StatusInfo struct {
	Err     error                  `json:"err,omitempty"`
	Current status.Status          `json:"current"`
	Message string                 `json:"message"`
	Since   *time.Time             `json:"since,omitempty"`
	Version string                 `json:"version"`
	Data    map[string]interface{} `json:"data,omitempty"`
}

StatusInfo holds the unit and machine status information. It is used by ApplicationInfo and UnitInfo.

func NewStatusInfo

func NewStatusInfo(s status.StatusInfo, err error) StatusInfo

NewStatusInfo return a new multiwatcher StatusInfo from a status StatusInfo.

type UnitInfo

type UnitInfo struct {
	ModelUUID      string      `json:"model-uuid"`
	Name           string      `json:"name"`
	Application    string      `json:"application"`
	Series         string      `json:"series"`
	CharmURL       string      `json:"charm-url"`
	PublicAddress  string      `json:"public-address"`
	PrivateAddress string      `json:"private-address"`
	MachineId      string      `json:"machine-id"`
	Ports          []Port      `json:"ports"`
	PortRanges     []PortRange `json:"port-ranges"`
	Subordinate    bool        `json:"subordinate"`
	// Workload and agent state are modelled separately.
	WorkloadStatus StatusInfo `json:"workload-status"`
	AgentStatus    StatusInfo `json:"agent-status"`
}

UnitInfo holds the information about a unit that is tracked by multiwatcherStore.

func (*UnitInfo) EntityId

func (i *UnitInfo) EntityId() EntityId

EntityId returns a unique identifier for a unit across models.

Jump to

Keyboard shortcuts

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