juju: github.com/juju/juju/worker/uniter/hook Index | Files

package hook

import "github.com/juju/juju/worker/uniter/hook"

Package hook provides types that define the hooks known to the Uniter

Index

Package Files

hook.go

Constants

const (
    LeaderElected         hooks.Kind = "leader-elected"
    LeaderDeposed         hooks.Kind = "leader-deposed"
    LeaderSettingsChanged hooks.Kind = "leader-settings-changed"
)

TODO(fwereade): move these definitions to juju/charm/hooks.

type Committer Uses

type Committer interface {
    CommitHook(Info) error
}

Committer is an interface that may be used to convey the fact that the specified hook has been successfully executed, and committed.

type Info Uses

type Info struct {
    Kind hooks.Kind `yaml:"kind"`

    // RelationId identifies the relation associated with the hook. It is
    // only set when Kind indicates a relation hook.
    RelationId int `yaml:"relation-id,omitempty"`

    // RemoteUnit is the name of the unit that triggered the hook. It is only
    // set when Kind indicates a relation hook other than relation-broken.
    RemoteUnit string `yaml:"remote-unit,omitempty"`

    // ChangeVersion identifies the most recent unit settings change
    // associated with RemoteUnit. It is only set when RemoteUnit is set.
    ChangeVersion int64 `yaml:"change-version,omitempty"`

    // StorageId is the ID of the storage instance relevant to the hook.
    StorageId string `yaml:"storage-id,omitempty"`
}

Info holds details required to execute a hook. Not all fields are relevant to all Kind values.

func (Info) Validate Uses

func (hi Info) Validate() error

Validate returns an error if the info is not valid.

type Validator Uses

type Validator interface {
    ValidateHook(Info) error
}

Validator is an interface that may be used to validate a hook execution request prior to executing it.

Package hook imports 3 packages (graph) and is imported by 304 packages. Updated 2019-10-19. Refresh now. Tools for package owners.