hook

package
v0.0.0-...-a753888 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 4 Imported by: 67

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecretHookRequiresRevision

func SecretHookRequiresRevision(kind hooks.Kind) bool

SecretHookRequiresRevision returns true if the hook context needs a secret revision.

Types

type Committer

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

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-created or relation-broken.
	RemoteUnit string `yaml:"remote-unit,omitempty"`

	// RemoteApplication is always set if either an app or a unit triggers
	// the hook. If the app triggers the hook, then RemoteUnit will be empty.
	RemoteApplication string `yaml:"remote-application,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"`

	// DepartingUnit is the name of the unit that goes away. It is only set
	// when Kind indicates a relation-departed hook.
	DepartingUnit string `yaml:"departee,omitempty"`

	// WorkloadName is the name of the sidecar container or workload relevant to the hook.
	WorkloadName string `yaml:"workload-name,omitempty"`

	// NoticeID is the Pebble notice ID associated with the hook.
	NoticeID string `yaml:"notice-id,omitempty"`

	// NoticeType is the Pebble notice type associated with the hook.
	NoticeType string `yaml:"notice-type,omitempty"`

	// NoticeKey is the Pebble notice key associated with the hook.
	NoticeKey string `yaml:"notice-key,omitempty"`

	// MachineUpgradeTarget is the base that the unit's machine is to be
	// updated to when Juju is issued the `upgrade-machine` command.
	// It is only set for the pre-series-upgrade hook.
	MachineUpgradeTarget string `yaml:"series-upgrade-target,omitempty"`

	// SecretURI is the secret URI relevant to the hook.
	SecretURI string `yaml:"secret-uri,omitempty"`

	// SecretRevision is the secret revision relevant to the hook.
	SecretRevision int `yaml:"secret-revision,omitempty"`

	// SecretLabel is the secret label to expose to the hook.
	SecretLabel string `yaml:"secret-label,omitempty"`
}

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

func (Info) Validate

func (hi Info) Validate() error

Validate returns an error if the info is not valid.

type Validator

type Validator interface {
	ValidateHook(Info) error
}

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

Jump to

Keyboard shortcuts

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