juju: github.com/juju/juju/worker/uniter/runner/jujuc Index | Files | Directories

package jujuc

import "github.com/juju/juju/worker/uniter/runner/jujuc"

The worker/uniter/runner/jujuc package implements the server side of the jujuc proxy tool, which forwards command invocations to the unit agent process so that they can be executed against specific state.

Index

Package Files

action-fail.go action-get.go action-log.go action-set.go add-metric.go application-version-set.go commands.go config-get.go context.go credential-get.go errors.go goal-state.go is-leader.go juju-log.go leader-get.go leader-set.go network-get.go opened-ports.go pod-spec-get.go pod-spec-set.go ports.go reboot.go relation-get.go relation-ids.go relation-list.go relation-set.go restricted.go server.go status-get.go status-set.go storage-add.go storage-get.go storage-id.go storage-list.go unit-get.go

Constants

const CmdSuffix = cmdSuffix

CmdSuffix is the filename suffix to use for executables.

Variables

var ErrNoStdin = errors.New("hook tool requires stdin, none supplied")

ErrNoStdin is returned by Jujuc.Main if the hook tool requests stdin, and none is supplied.

var ErrRestrictedContext = errors.NotImplementedf("not implemented for restricted context")

ErrRestrictedContext indicates a method is not implemented in the given context.

var LookupHost resolver = net.LookupHost
var StorageAddDoc = "" /* 305 byte string literal not displayed */[1:]

func CommandNames Uses

func CommandNames() (names []string)

CommandNames returns the names of all jujuc commands.

func IsNotAvailable Uses

func IsNotAvailable(err error) bool

IsNotAvailable reports whether err was creates with NotAvailable().

func NewActionFailCommand Uses

func NewActionFailCommand(ctx Context, name string) (cmd.Command, error)

NewActionFailCommand returns a new ActionFailCommand with the given context.

func NewActionGetCommand Uses

func NewActionGetCommand(ctx Context, name string) (cmd.Command, error)

NewActionGetCommand returns an ActionGetCommand for use with the given context.

func NewActionLogCommand Uses

func NewActionLogCommand(ctx Context, name string) (cmd.Command, error)

func NewActionSetCommand Uses

func NewActionSetCommand(ctx Context, name string) (cmd.Command, error)

NewActionSetCommand returns a new ActionSetCommand with the given context.

func NewAddMetricCommand Uses

func NewAddMetricCommand(ctx Context) (cmd.Command, error)

NewAddMetricCommand generates a new AddMetricCommand.

func NewApplicationVersionSetCommand Uses

func NewApplicationVersionSetCommand(ctx Context) (cmd.Command, error)

NewApplicationVersionSetCommand creates an application-version-set command.

func NewClosePortCommand Uses

func NewClosePortCommand(ctx Context) (cmd.Command, error)

func NewCommand Uses

func NewCommand(ctx Context, name string) (cmd.Command, error)

NewCommand returns an instance of the named Command, initialized to execute against the supplied Context.

func NewConfigGetCommand Uses

func NewConfigGetCommand(ctx Context) (cmd.Command, error)

func NewCredentialGetCommand Uses

func NewCredentialGetCommand(ctx Context) (cmd.Command, error)

NewCredentialGetCommand returns a new CredentialGetCommand with the given context.

func NewGoalStateCommand Uses

func NewGoalStateCommand(ctx Context) (cmd.Command, error)

func NewIsLeaderCommand Uses

func NewIsLeaderCommand(ctx Context) (cmd.Command, error)

NewIsLeaderCommand returns a new isLeaderCommand with the given context.

func NewJujuLogCommand Uses

func NewJujuLogCommand(ctx Context) (cmd.Command, error)

func NewJujuRebootCommand Uses

func NewJujuRebootCommand(ctx Context) (cmd.Command, error)

func NewLeaderGetCommand Uses

func NewLeaderGetCommand(ctx Context) (cmd.Command, error)

NewLeaderGetCommand returns a new leaderGetCommand with the given context.

func NewLeaderSetCommand Uses

func NewLeaderSetCommand(ctx Context) (cmd.Command, error)

NewLeaderSetCommand returns a new leaderSetCommand with the given context.

func NewNetworkGetCommand Uses

func NewNetworkGetCommand(ctx Context) (_ cmd.Command, err error)

func NewOpenPortCommand Uses

func NewOpenPortCommand(ctx Context) (cmd.Command, error)

func NewOpenedPortsCommand Uses

func NewOpenedPortsCommand(ctx Context) (cmd.Command, error)

func NewPodSpecGetCommand Uses

func NewPodSpecGetCommand(ctx Context) (cmd.Command, error)

NewPodSpecGetCommand makes a pod-spec-get command.

func NewPodSpecSetCommand Uses

func NewPodSpecSetCommand(ctx Context) (cmd.Command, error)

NewPodSpecSetCommand makes a pod-spec-set command.

func NewRelationGetCommand Uses

func NewRelationGetCommand(ctx Context) (cmd.Command, error)

func NewRelationIdValue Uses

func NewRelationIdValue(ctx Context, result *int) (*relationIdValue, error)

NewRelationIdValue returns a gnuflag.Value for convenient parsing of relation ids in ctx.

func NewRelationIdsCommand Uses

func NewRelationIdsCommand(ctx Context) (cmd.Command, error)

func NewRelationListCommand Uses

func NewRelationListCommand(ctx Context) (cmd.Command, error)

func NewRelationSetCommand Uses

func NewRelationSetCommand(ctx Context) (cmd.Command, error)

func NewStatusGetCommand Uses

func NewStatusGetCommand(ctx Context) (cmd.Command, error)

func NewStatusSetCommand Uses

func NewStatusSetCommand(ctx Context) (cmd.Command, error)

NewStatusSetCommand makes a jujuc status-set command.

func NewStorageAddCommand Uses

func NewStorageAddCommand(ctx Context) (cmd.Command, error)

NewStorageAddCommand makes a jujuc storage-add command.

func NewStorageGetCommand Uses

func NewStorageGetCommand(ctx Context) (cmd.Command, error)

func NewStorageListCommand Uses

func NewStorageListCommand(ctx Context) (cmd.Command, error)

func NewUnitGetCommand Uses

func NewUnitGetCommand(ctx Context) (cmd.Command, error)

func NotAvailable Uses

func NotAvailable(thing string) error

NotAvailable returns an error which satisfies IsNotAvailable.

func RegisterCommand Uses

func RegisterCommand(name string, f creator)

type ActionFailCommand Uses

type ActionFailCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

ActionFailCommand implements the action-fail/function-fail command.

func (*ActionFailCommand) Info Uses

func (c *ActionFailCommand) Info() *cmd.Info

Info returns the content for --help.

func (*ActionFailCommand) Init Uses

func (c *ActionFailCommand) Init(args []string) error

Init sets the fail message and checks for malformed invocations.

func (*ActionFailCommand) Run Uses

func (c *ActionFailCommand) Run(ctx *cmd.Context) error

Run sets the Action's fail state.

func (*ActionFailCommand) SetFlags Uses

func (c *ActionFailCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags handles any option flags, but there are none.

type ActionGetCommand Uses

type ActionGetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

ActionGetCommand implements the action-get command.

func (*ActionGetCommand) Info Uses

func (c *ActionGetCommand) Info() *cmd.Info

Info returns the content for --help.

func (*ActionGetCommand) Init Uses

func (c *ActionGetCommand) Init(args []string) error

Init makes sure there are no additional unknown arguments to action-get.

func (*ActionGetCommand) Run Uses

func (c *ActionGetCommand) Run(ctx *cmd.Context) error

Run recurses into the params map for the Action, given the list of keys into the map, and returns either the keyed value, or nothing. In the case of an empty keys list, the entire params map will be returned.

func (*ActionGetCommand) SetFlags Uses

func (c *ActionGetCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags handles known option flags; in this case, [--output={json|yaml}] and --help.

type ActionHookContext Uses

type ActionHookContext interface {
    HookContext
    // contains filtered or unexported methods
}

ActionHookContext is the context for an action hook.

type ActionLogCommand Uses

type ActionLogCommand struct {
    cmd.CommandBase

    Message string
    // contains filtered or unexported fields
}

ActionLogCommand implements the action-log command.

func (*ActionLogCommand) Info Uses

func (c *ActionLogCommand) Info() *cmd.Info

func (*ActionLogCommand) Init Uses

func (c *ActionLogCommand) Init(args []string) error

func (*ActionLogCommand) Run Uses

func (c *ActionLogCommand) Run(ctx *cmd.Context) error

type ActionSetCommand Uses

type ActionSetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

ActionSetCommand implements the action-set command.

func (*ActionSetCommand) Info Uses

func (c *ActionSetCommand) Info() *cmd.Info

Info returns the content for --help.

func (*ActionSetCommand) Init Uses

func (c *ActionSetCommand) Init(args []string) error

Init accepts maps in the form of key=value, key.key2.keyN....=value

func (*ActionSetCommand) Run Uses

func (c *ActionSetCommand) Run(ctx *cmd.Context) error

Run adds the given <key list>/<value> pairs, such as foo.bar=baz to the existing map of results for the Action.

func (*ActionSetCommand) SetFlags Uses

func (c *ActionSetCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags handles known option flags.

type AddMetricCommand Uses

type AddMetricCommand struct {
    cmd.CommandBase

    Labels  string
    Metrics []Metric
    // contains filtered or unexported fields
}

AddMetricCommand implements the add-metric command.

func (*AddMetricCommand) Info Uses

func (c *AddMetricCommand) Info() *cmd.Info

Info returns the command info structure for the add-metric command.

func (*AddMetricCommand) Init Uses

func (c *AddMetricCommand) Init(args []string) error

Init parses the command's parameters.

func (*AddMetricCommand) Run Uses

func (c *AddMetricCommand) Run(ctx *cmd.Context) (err error)

Run adds metrics to the hook context.

func (*AddMetricCommand) SetFlags Uses

func (c *AddMetricCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags implements Command.

type ApplicationStatusInfo Uses

type ApplicationStatusInfo struct {
    Application StatusInfo
    Units       []StatusInfo
}

ApplicationStatusInfo holds StatusInfo for an Application and all its Units.

type CmdGetter Uses

type CmdGetter func(contextId, cmdName string) (cmd.Command, error)

CmdGetter looks up a Command implementation connected to a particular Context.

type ConfigGetCommand Uses

type ConfigGetCommand struct {
    cmd.CommandBase

    Key string // The key to show. If empty, show all.
    All bool
    // contains filtered or unexported fields
}

ConfigGetCommand implements the config-get command.

func (*ConfigGetCommand) Info Uses

func (c *ConfigGetCommand) Info() *cmd.Info

func (*ConfigGetCommand) Init Uses

func (c *ConfigGetCommand) Init(args []string) error

func (*ConfigGetCommand) Run Uses

func (c *ConfigGetCommand) Run(ctx *cmd.Context) error

func (*ConfigGetCommand) SetFlags Uses

func (c *ConfigGetCommand) SetFlags(f *gnuflag.FlagSet)

type Context Uses

type Context interface {
    HookContext
    // contains filtered or unexported methods
}

Context is the interface that all hook helper commands depend on to interact with the rest of the system.

type ContextComponent Uses

type ContextComponent interface {
    // Flush pushes the component's data to Juju state.
    // In the Flush implementation, call your components API.
    Flush() error
}

ContextComponent is a single modular Juju component as it relates to the current unit and hook. Components should implement this interfaces in a type-safe way. Ensuring checked type-conversions are preformed on the result and value interfaces. You will use the runner.RegisterComponentFunc to register a your components concrete ContextComponent implementation.

See: process/context/context.go for an implementation example.

type ContextComponents Uses

type ContextComponents interface {
    // Component returns the ContextComponent with the supplied name if
    // it was found.
    Component(name string) (ContextComponent, error)
}

ContextComponents exposes modular Juju components as they relate to the unit in the context of the hook.

type ContextInstance Uses

type ContextInstance interface {
    // AvailabilityZone returns the executing unit's availability zone or an error
    // if it was not found (or is not available).
    AvailabilityZone() (string, error)

    // RequestReboot will set the reboot flag to true on the machine agent
    RequestReboot(prio RebootPriority) error
}

ContextInstance is the part of a hook context related to the unit's instance.

type ContextLeadership Uses

type ContextLeadership interface {
    // IsLeader returns true if the local unit is known to be leader for at
    // least the next 30s.
    IsLeader() (bool, error)

    // LeaderSettings returns the current leader settings. Once leader settings
    // have been read in a given context, they will not be updated other than
    // via successful calls to WriteLeaderSettings.
    LeaderSettings() (map[string]string, error)

    // WriteLeaderSettings writes the supplied settings directly to state, or
    // fails if the local unit is not the application's leader.
    WriteLeaderSettings(map[string]string) error
}

ContextLeadership is the part of a hook context related to the unit leadership.

type ContextMetrics Uses

type ContextMetrics interface {
    // AddMetric records a metric to return after hook execution.
    AddMetric(string, string, time.Time) error
    // AddMetricLabels records a metric with tags to return after hook execution.
    AddMetricLabels(string, string, time.Time, map[string]string) error
}

ContextMetrics is the part of a hook context related to metrics.

type ContextNetworking Uses

type ContextNetworking interface {
    // PublicAddress returns the executing unit's public address or an
    // error if it is not available.
    PublicAddress() (string, error)

    // PrivateAddress returns the executing unit's private address or an
    // error if it is not available.
    PrivateAddress() (string, error)

    // OpenPorts marks the supplied port range for opening when the
    // executing unit's application is exposed.
    OpenPorts(protocol string, fromPort, toPort int) error

    // ClosePorts ensures the supplied port range is closed even when
    // the executing unit's application is exposed (unless it is opened
    // separately by a co- located unit).
    ClosePorts(protocol string, fromPort, toPort int) error

    // OpenedPorts returns all port ranges currently opened by this
    // unit on its assigned machine. The result is sorted first by
    // protocol, then by number.
    OpenedPorts() []network.PortRange

    // NetworkInfo returns the network info for the given bindings on the given relation.
    NetworkInfo(bindingNames []string, relationId int) (map[string]params.NetworkInfoResult, error)
}

ContextNetworking is the part of a hook context related to network interface of the unit's instance.

type ContextRelation Uses

type ContextRelation interface {

    // Id returns an integer which uniquely identifies the relation.
    Id() int

    // Name returns the name the locally executing charm assigned to this relation.
    Name() string

    // FakeId returns a string of the form "relation-name:123", which uniquely
    // identifies the relation to the hook. In reality, the identification
    // of the relation is the integer following the colon, but the composed
    // name is useful to humans observing it.
    FakeId() string

    // Settings allows read/write access to the local unit's settings in
    // this relation.
    Settings() (Settings, error)

    // ApplicationSettings allows read/write access to the application settings in
    // this relation, but only if the current unit is leader.
    ApplicationSettings() (Settings, error)

    // UnitNames returns a list of the remote units in the relation.
    UnitNames() []string

    // ReadSettings returns the settings of any remote unit in the relation.
    ReadSettings(unit string) (params.Settings, error)

    // ReadApplicationSettings returns the application settings of any remote unit in the relation.
    ReadApplicationSettings(app string) (params.Settings, error)

    // Suspended returns true if the relation is suspended.
    Suspended() bool

    // SetStatus sets the relation's status.
    SetStatus(relation.Status) error
}

ContextRelation expresses the capabilities of a hook with respect to a relation. go:generate mockgen -package jujuc -destination context_mock_test.go github.com/juju/juju/worker/uniter/runner/jujuc ContextRelation

type ContextRelations Uses

type ContextRelations interface {
    // Relation returns the relation with the supplied id if it was found, and
    // an error if it was not found or is not available.
    Relation(id int) (ContextRelation, error)

    // RelationIds returns the ids of all relations the executing unit is
    // currently participating in or an error if they are not available.
    RelationIds() ([]int, error)
}

ContextRelations exposes the relations associated with the unit.

type ContextStatus Uses

type ContextStatus interface {
    // UnitStatus returns the executing unit's current status.
    UnitStatus() (*StatusInfo, error)

    // SetUnitStatus updates the unit's status.
    SetUnitStatus(StatusInfo) error

    // ApplicationStatus returns the executing unit's application status
    // (including all units).
    ApplicationStatus() (ApplicationStatusInfo, error)

    // SetApplicationStatus updates the status for the unit's application.
    SetApplicationStatus(StatusInfo) error
}

ContextStatus is the part of a hook context related to the unit's status.

type ContextStorage Uses

type ContextStorage interface {
    // StorageTags returns a list of tags for storage instances
    // attached to the unit or an error if they are not available.
    StorageTags() ([]names.StorageTag, error)

    // Storage returns the ContextStorageAttachment with the supplied
    // tag if it was found, and an error if it was not found or is not
    // available to the context.
    Storage(names.StorageTag) (ContextStorageAttachment, error)

    // HookStorage returns the storage attachment associated
    // the executing hook if it was found, and an error if it
    // was not found or is not available.
    HookStorage() (ContextStorageAttachment, error)

    // AddUnitStorage saves storage constraints in the context.
    AddUnitStorage(map[string]params.StorageConstraints) error
}

ContextStorage is the part of a hook context related to storage resources associated with the unit.

type ContextStorageAttachment Uses

type ContextStorageAttachment interface {

    // Tag returns a tag which uniquely identifies the storage attachment
    // in the context of the unit.
    Tag() names.StorageTag

    // Kind returns the kind of the storage.
    Kind() storage.StorageKind

    // Location returns the location of the storage: the mount point for
    // filesystem-kind stores, and the device path for block-kind stores.
    Location() string
}

ContextStorageAttachment expresses the capabilities of a hook with respect to a storage attachment.

type ContextUnit Uses

type ContextUnit interface {
    // UnitName returns the executing unit's name.
    UnitName() string

    // Config returns the current application configuration of the executing unit.
    ConfigSettings() (charm.Settings, error)

    // GoalState returns the goal state for the current unit.
    GoalState() (*application.GoalState, error)

    // SetPodSpec updates the yaml spec used to create a pod.
    SetPodSpec(specYaml string) error

    // GetPodSpec returns the yaml spec used to create a pod.
    GetPodSpec() (string, error)

    // CloudSpec returns the unit's cloud specification
    CloudSpec() (*params.CloudSpec, error)
}

ContextUnit is the part of a hook context related to the unit.

type ContextVersion Uses

type ContextVersion interface {

    // UnitWorkloadVersion returns the currently set workload version for
    // the unit.
    UnitWorkloadVersion() (string, error)

    // SetUnitWorkloadVersion updates the workload version for the unit.
    SetUnitWorkloadVersion(string) error
}

ContextVersion expresses the parts of a hook context related to reporting workload versions.

type CredentialGetCommand Uses

type CredentialGetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

CredentialGetCommand implements the leader-get command.

func (*CredentialGetCommand) Info Uses

func (c *CredentialGetCommand) Info() *cmd.Info

Info is part of the cmd.Command interface.

func (*CredentialGetCommand) Init Uses

func (c *CredentialGetCommand) Init(args []string) error

Init is part of the cmd.Command interface.

func (*CredentialGetCommand) Run Uses

func (c *CredentialGetCommand) Run(ctx *cmd.Context) error

Run is part of the cmd.Command interface.

func (*CredentialGetCommand) SetFlags Uses

func (c *CredentialGetCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags is part of the cmd.Command interface.

type GoalStateCommand Uses

type GoalStateCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

GoalStateCommand implements the config-get command.

func (*GoalStateCommand) Info Uses

func (c *GoalStateCommand) Info() *cmd.Info

func (*GoalStateCommand) Init Uses

func (c *GoalStateCommand) Init(args []string) error

func (*GoalStateCommand) Run Uses

func (c *GoalStateCommand) Run(ctx *cmd.Context) error

func (*GoalStateCommand) SetFlags Uses

func (c *GoalStateCommand) SetFlags(f *gnuflag.FlagSet)

type HookContext Uses

type HookContext interface {
    ContextUnit
    ContextStatus
    ContextInstance
    ContextNetworking
    ContextLeadership
    ContextMetrics
    ContextStorage
    ContextComponents
    ContextRelations
    ContextVersion
}

HookContext represents the information and functionality that is common to all charm hooks.

type JujuLogCommand Uses

type JujuLogCommand struct {
    cmd.CommandBase

    Message string
    Debug   bool
    Level   string
    // contains filtered or unexported fields
}

JujuLogCommand implements the juju-log command.

func (*JujuLogCommand) Info Uses

func (c *JujuLogCommand) Info() *cmd.Info

func (*JujuLogCommand) Init Uses

func (c *JujuLogCommand) Init(args []string) error

func (*JujuLogCommand) Run Uses

func (c *JujuLogCommand) Run(ctx *cmd.Context) error

func (*JujuLogCommand) SetFlags Uses

func (c *JujuLogCommand) SetFlags(f *gnuflag.FlagSet)

type JujuLogCommandLogger Uses

type JujuLogCommandLogger interface {
    Logf(level loggo.Level, message string, args ...interface{})
    Warningf(message string, args ...interface{})
}

JujuLogCommandLogger provides a Logger interface for the juju-log command. go:generate mockgen -package jujuc -destination juju-log_mock_test.go github.com/juju/juju/worker/uniter/runner/jujuc JujuLogCommandLogger,JujuLogCommandLoggerFactory,JujuLogContext

type JujuLogCommandLoggerFactory Uses

type JujuLogCommandLoggerFactory interface {
    GetLogger(name string) JujuLogCommandLogger
}

JujuLogCommandLoggerFactory is used to create new loggers (stickupkid) We should derive this from the context itself.

type JujuLogContext Uses

type JujuLogContext interface {
    UnitName() string
    HookRelation() (ContextRelation, error)
}

JujuLogContext is the Context for the JujuLogCommand

type JujuRebootCommand Uses

type JujuRebootCommand struct {
    cmd.CommandBase

    Now bool
    // contains filtered or unexported fields
}

JujuRebootCommand implements the juju-reboot command.

func (*JujuRebootCommand) Info Uses

func (c *JujuRebootCommand) Info() *cmd.Info

func (*JujuRebootCommand) Init Uses

func (c *JujuRebootCommand) Init(args []string) error

func (*JujuRebootCommand) Run Uses

func (c *JujuRebootCommand) Run(ctx *cmd.Context) error

func (*JujuRebootCommand) SetFlags Uses

func (c *JujuRebootCommand) SetFlags(f *gnuflag.FlagSet)

type Jujuc Uses

type Jujuc struct {
    // contains filtered or unexported fields
}

Jujuc implements the jujuc command in the form required by net/rpc.

func (*Jujuc) Main Uses

func (j *Jujuc) Main(req Request, resp *exec.ExecResponse) error

Main runs the Command specified by req, and fills in resp. A single command is run at a time.

type Metric Uses

type Metric struct {
    Key    string
    Value  string
    Time   time.Time
    Labels map[string]string `json:",omitempty"`
}

Metric represents a single metric set by the charm.

type NetworkGetCommand Uses

type NetworkGetCommand struct {
    cmd.CommandBase

    RelationId int
    // contains filtered or unexported fields
}

NetworkGetCommand implements the network-get command.

func (*NetworkGetCommand) Info Uses

func (c *NetworkGetCommand) Info() *cmd.Info

Info is part of the cmd.Command interface.

func (*NetworkGetCommand) Init Uses

func (c *NetworkGetCommand) Init(args []string) error

Init is part of the cmd.Command interface.

func (*NetworkGetCommand) Run Uses

func (c *NetworkGetCommand) Run(ctx *cmd.Context) error

func (*NetworkGetCommand) SetFlags Uses

func (c *NetworkGetCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags is part of the cmd.Command interface.

type OpenedPortsCommand Uses

type OpenedPortsCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

OpenedPortsCommand implements the opened-ports command.

func (*OpenedPortsCommand) Info Uses

func (c *OpenedPortsCommand) Info() *cmd.Info

func (*OpenedPortsCommand) Init Uses

func (c *OpenedPortsCommand) Init(args []string) error

func (*OpenedPortsCommand) Run Uses

func (c *OpenedPortsCommand) Run(ctx *cmd.Context) error

func (*OpenedPortsCommand) SetFlags Uses

func (c *OpenedPortsCommand) SetFlags(f *gnuflag.FlagSet)

type PodSpecGetCommand Uses

type PodSpecGetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

PodSpecGetCommand implements the pod-spec-get command.

func (*PodSpecGetCommand) Info Uses

func (c *PodSpecGetCommand) Info() *cmd.Info

func (*PodSpecGetCommand) Run Uses

func (c *PodSpecGetCommand) Run(ctx *cmd.Context) error

type PodSpecSetCommand Uses

type PodSpecSetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

PodSpecSetCommand implements the pod-spec-set command.

func (*PodSpecSetCommand) Info Uses

func (c *PodSpecSetCommand) Info() *cmd.Info

func (*PodSpecSetCommand) Init Uses

func (c *PodSpecSetCommand) Init(args []string) error

func (*PodSpecSetCommand) Run Uses

func (c *PodSpecSetCommand) Run(ctx *cmd.Context) error

func (*PodSpecSetCommand) SetFlags Uses

func (c *PodSpecSetCommand) SetFlags(f *gnuflag.FlagSet)

type RebootPriority Uses

type RebootPriority int

RebootPriority is the type used for reboot requests.

const (
    // RebootSkip is a noop.
    RebootSkip RebootPriority = iota
    // RebootAfterHook means wait for current hook to finish before
    // rebooting.
    RebootAfterHook
    // RebootNow means reboot immediately, killing and requeueing the
    // calling hook
    RebootNow
)

type RelationGetCommand Uses

type RelationGetCommand struct {
    cmd.CommandBase

    RelationId int

    Application bool

    Key           string
    UnitOrAppName string
    // contains filtered or unexported fields
}

RelationGetCommand implements the relation-get command.

func (*RelationGetCommand) Info Uses

func (c *RelationGetCommand) Info() *cmd.Info

Info is part of the cmd.Command interface.

func (*RelationGetCommand) Init Uses

func (c *RelationGetCommand) Init(args []string) error

Init is part of the cmd.Command interface.

func (*RelationGetCommand) Run Uses

func (c *RelationGetCommand) Run(ctx *cmd.Context) error

func (*RelationGetCommand) SetFlags Uses

func (c *RelationGetCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags is part of the cmd.Command interface.

type RelationHookContext Uses

type RelationHookContext interface {
    HookContext
    // contains filtered or unexported methods
}

RelationHookContext is the context for a relation hook.

type RelationIdsCommand Uses

type RelationIdsCommand struct {
    cmd.CommandBase

    Name string
    // contains filtered or unexported fields
}

RelationIdsCommand implements the relation-ids command.

func (*RelationIdsCommand) Info Uses

func (c *RelationIdsCommand) Info() *cmd.Info

func (*RelationIdsCommand) Init Uses

func (c *RelationIdsCommand) Init(args []string) error

func (*RelationIdsCommand) Run Uses

func (c *RelationIdsCommand) Run(ctx *cmd.Context) error

func (*RelationIdsCommand) SetFlags Uses

func (c *RelationIdsCommand) SetFlags(f *gnuflag.FlagSet)

type RelationListCommand Uses

type RelationListCommand struct {
    cmd.CommandBase

    RelationId int
    // contains filtered or unexported fields
}

RelationListCommand implements the relation-list command.

func (*RelationListCommand) Info Uses

func (c *RelationListCommand) Info() *cmd.Info

func (*RelationListCommand) Init Uses

func (c *RelationListCommand) Init(args []string) (err error)

func (*RelationListCommand) Run Uses

func (c *RelationListCommand) Run(ctx *cmd.Context) error

func (*RelationListCommand) SetFlags Uses

func (c *RelationListCommand) SetFlags(f *gnuflag.FlagSet)

type RelationSetCommand Uses

type RelationSetCommand struct {
    cmd.CommandBase

    RelationId int

    Settings map[string]string

    Application bool
    // contains filtered or unexported fields
}

RelationSetCommand implements the relation-set command.

func (*RelationSetCommand) Info Uses

func (c *RelationSetCommand) Info() *cmd.Info

func (*RelationSetCommand) Init Uses

func (c *RelationSetCommand) Init(args []string) error

func (*RelationSetCommand) Run Uses

func (c *RelationSetCommand) Run(ctx *cmd.Context) (err error)

func (*RelationSetCommand) SetFlags Uses

func (c *RelationSetCommand) SetFlags(f *gnuflag.FlagSet)

type Request Uses

type Request struct {
    ContextId   string
    Dir         string
    CommandName string
    Args        []string

    // StdinSet indicates whether or not the client supplied stdin. This is
    // necessary as Stdin will be nil if the client supplied stdin but it
    // is empty.
    StdinSet bool
    Stdin    []byte

    Token string
}

Request contains the information necessary to run a Command remotely.

type RestrictedContext Uses

type RestrictedContext struct{}

RestrictedContext is a base implementation for restricted contexts to embed, so that an error is returned for methods that are not explicitly implemented.

func (*RestrictedContext) ActionParams Uses

func (*RestrictedContext) ActionParams() (map[string]interface{}, error)

ActionParams implements hooks.Context.

func (*RestrictedContext) AddMetric Uses

func (*RestrictedContext) AddMetric(string, string, time.Time) error

AddMetric implements hooks.Context.

func (*RestrictedContext) AddMetricLabels Uses

func (*RestrictedContext) AddMetricLabels(string, string, time.Time, map[string]string) error

AddMetricLabels implements hooks.Context.

func (*RestrictedContext) AddUnitStorage Uses

func (*RestrictedContext) AddUnitStorage(map[string]params.StorageConstraints) error

AddUnitStorage implements hooks.Context.

func (*RestrictedContext) ApplicationStatus Uses

func (*RestrictedContext) ApplicationStatus() (ApplicationStatusInfo, error)

ApplicationStatus implements hooks.Context.

func (*RestrictedContext) AvailabilityZone Uses

func (*RestrictedContext) AvailabilityZone() (string, error)

AvailabilityZone implements hooks.Context.

func (*RestrictedContext) ClosePorts Uses

func (*RestrictedContext) ClosePorts(protocol string, fromPort, toPort int) error

ClosePorts implements hooks.Context.

func (*RestrictedContext) CloudSpec Uses

func (c *RestrictedContext) CloudSpec() (*params.CloudSpec, error)

func (*RestrictedContext) Component Uses

func (*RestrictedContext) Component(string) (ContextComponent, error)

Component implements jujc.Context.

func (*RestrictedContext) ConfigSettings Uses

func (*RestrictedContext) ConfigSettings() (charm.Settings, error)

ConfigSettings implements hooks.Context.

func (*RestrictedContext) GetPodSpec Uses

func (c *RestrictedContext) GetPodSpec() (string, error)

GetPodSpec implements hooks.Context.

func (*RestrictedContext) GoalState Uses

func (*RestrictedContext) GoalState() (*application.GoalState, error)

GoalState implements hooks.Context.

func (*RestrictedContext) HookRelation Uses

func (*RestrictedContext) HookRelation() (ContextRelation, error)

HookRelation implements hooks.Context.

func (*RestrictedContext) HookStorage Uses

func (*RestrictedContext) HookStorage() (ContextStorageAttachment, error)

HookStorage implements hooks.Context.

func (*RestrictedContext) IsLeader Uses

func (*RestrictedContext) IsLeader() (bool, error)

IsLeader implements hooks.Context.

func (*RestrictedContext) LeaderSettings Uses

func (*RestrictedContext) LeaderSettings() (map[string]string, error)

LeaderSettings implements hooks.Context.

func (*RestrictedContext) LogActionMessage Uses

func (*RestrictedContext) LogActionMessage(string) error

LogActionMessage implements hooks.Context.

func (*RestrictedContext) NetworkInfo Uses

func (*RestrictedContext) NetworkInfo(bindingNames []string, relationId int) (map[string]params.NetworkInfoResult, error)

NetworkInfo implements hooks.Context.

func (*RestrictedContext) OpenPorts Uses

func (*RestrictedContext) OpenPorts(protocol string, fromPort, toPort int) error

OpenPorts implements hooks.Context.

func (*RestrictedContext) OpenedPorts Uses

func (*RestrictedContext) OpenedPorts() []network.PortRange

OpenedPorts implements hooks.Context.

func (*RestrictedContext) PrivateAddress Uses

func (*RestrictedContext) PrivateAddress() (string, error)

PrivateAddress implements hooks.Context.

func (*RestrictedContext) PublicAddress Uses

func (*RestrictedContext) PublicAddress() (string, error)

PublicAddress implements hooks.Context.

func (*RestrictedContext) Relation Uses

func (*RestrictedContext) Relation(id int) (ContextRelation, error)

Relation implements hooks.Context.

func (*RestrictedContext) RelationIds Uses

func (*RestrictedContext) RelationIds() ([]int, error)

RelationIds implements hooks.Context.

func (*RestrictedContext) RemoteApplicationName Uses

func (*RestrictedContext) RemoteApplicationName() (string, error)

RemoteApplicationName implements hooks.Context.

func (*RestrictedContext) RemoteUnitName Uses

func (*RestrictedContext) RemoteUnitName() (string, error)

RemoteUnitName implements hooks.Context.

func (*RestrictedContext) RequestReboot Uses

func (*RestrictedContext) RequestReboot(prio RebootPriority) error

RequestReboot implements hooks.Context.

func (*RestrictedContext) SetActionFailed Uses

func (*RestrictedContext) SetActionFailed() error

SetActionFailed implements hooks.Context.

func (*RestrictedContext) SetActionMessage Uses

func (*RestrictedContext) SetActionMessage(string) error

SetActionMessage implements hooks.Context.

func (*RestrictedContext) SetApplicationStatus Uses

func (*RestrictedContext) SetApplicationStatus(StatusInfo) error

SetApplicationStatus implements hooks.Context.

func (*RestrictedContext) SetPodSpec Uses

func (c *RestrictedContext) SetPodSpec(specYaml string) error

SetPodSpec implements hooks.Context.

func (*RestrictedContext) SetUnitStatus Uses

func (*RestrictedContext) SetUnitStatus(StatusInfo) error

SetUnitStatus implements hooks.Context.

func (*RestrictedContext) SetUnitWorkloadVersion Uses

func (*RestrictedContext) SetUnitWorkloadVersion(string) error

SetUnitWorkloadVersion implements hooks.Context.

func (*RestrictedContext) Storage Uses

func (*RestrictedContext) Storage(names.StorageTag) (ContextStorageAttachment, error)

Storage implements hooks.Context.

func (*RestrictedContext) StorageTags Uses

func (*RestrictedContext) StorageTags() ([]names.StorageTag, error)

StorageTags implements hooks.Context.

func (*RestrictedContext) UnitStatus Uses

func (*RestrictedContext) UnitStatus() (*StatusInfo, error)

UnitStatus implements hooks.Context.

func (*RestrictedContext) UnitWorkloadVersion Uses

func (*RestrictedContext) UnitWorkloadVersion() (string, error)

UnitWorkloadVersion implements hooks.Context.

func (*RestrictedContext) UpdateActionResults Uses

func (*RestrictedContext) UpdateActionResults(keys []string, value string) error

UpdateActionResults implements hooks.Context.

func (*RestrictedContext) WriteLeaderSettings Uses

func (*RestrictedContext) WriteLeaderSettings(map[string]string) error

WriteLeaderSettings implements hooks.Context.

type Server Uses

type Server struct {
    // contains filtered or unexported fields
}

Server implements a server that serves command invocations via a unix domain socket.

func NewServer Uses

func NewServer(getCmd CmdGetter, socket sockets.Socket, token string) (*Server, error)

NewServer creates an RPC server bound to socketPath, which can execute remote command invocations against an appropriate Context. It will not actually do so until Run is called.

func (*Server) Close Uses

func (s *Server) Close()

Close immediately stops accepting connections, and blocks until all existing connections have been closed.

func (*Server) Run Uses

func (s *Server) Run() (err error)

Run accepts new connections until it encounters an error, or until Close is called, and then blocks until all existing connections have been closed.

type Settings Uses

type Settings interface {
    Map() params.Settings
    Set(string, string)
    Delete(string)
}

Settings is implemented by types that manipulate unit settings.

type StatusGetCommand Uses

type StatusGetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

StatusGetCommand implements the status-get command.

func (*StatusGetCommand) ApplicationStatus Uses

func (c *StatusGetCommand) ApplicationStatus(ctx *cmd.Context) error

func (*StatusGetCommand) Info Uses

func (c *StatusGetCommand) Info() *cmd.Info

func (*StatusGetCommand) Init Uses

func (c *StatusGetCommand) Init(args []string) error

func (*StatusGetCommand) Run Uses

func (c *StatusGetCommand) Run(ctx *cmd.Context) error

func (*StatusGetCommand) SetFlags Uses

func (c *StatusGetCommand) SetFlags(f *gnuflag.FlagSet)

type StatusInfo Uses

type StatusInfo struct {
    Tag    string
    Status string
    Info   string
    Data   map[string]interface{}
}

StatusInfo is a record of the status information for a application or a unit's workload.

type StatusSetCommand Uses

type StatusSetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

StatusSetCommand implements the status-set command.

func (*StatusSetCommand) Info Uses

func (c *StatusSetCommand) Info() *cmd.Info

func (*StatusSetCommand) Init Uses

func (c *StatusSetCommand) Init(args []string) error

func (*StatusSetCommand) Run Uses

func (c *StatusSetCommand) Run(ctx *cmd.Context) error

func (*StatusSetCommand) SetFlags Uses

func (c *StatusSetCommand) SetFlags(f *gnuflag.FlagSet)

type StorageAddCommand Uses

type StorageAddCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

StorageAddCommand implements the status-set command.

func (*StorageAddCommand) Info Uses

func (s *StorageAddCommand) Info() *cmd.Info

func (*StorageAddCommand) Init Uses

func (s *StorageAddCommand) Init(args []string) error

func (*StorageAddCommand) Run Uses

func (s *StorageAddCommand) Run(ctx *cmd.Context) error

type StorageGetCommand Uses

type StorageGetCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

StorageGetCommand implements the storage-get command.

func (*StorageGetCommand) Info Uses

func (c *StorageGetCommand) Info() *cmd.Info

func (*StorageGetCommand) Init Uses

func (c *StorageGetCommand) Init(args []string) error

func (*StorageGetCommand) Run Uses

func (c *StorageGetCommand) Run(ctx *cmd.Context) error

func (*StorageGetCommand) SetFlags Uses

func (c *StorageGetCommand) SetFlags(f *gnuflag.FlagSet)

type StorageListCommand Uses

type StorageListCommand struct {
    cmd.CommandBase
    // contains filtered or unexported fields
}

StorageListCommand implements the storage-list command.

StorageListCommand implements cmd.Command.

func (*StorageListCommand) Info Uses

func (c *StorageListCommand) Info() *cmd.Info

func (*StorageListCommand) Init Uses

func (c *StorageListCommand) Init(args []string) (err error)

func (*StorageListCommand) Run Uses

func (c *StorageListCommand) Run(ctx *cmd.Context) error

func (*StorageListCommand) SetFlags Uses

func (c *StorageListCommand) SetFlags(f *gnuflag.FlagSet)

type UnitGetCommand Uses

type UnitGetCommand struct {
    cmd.CommandBase

    Key string
    // contains filtered or unexported fields
}

UnitGetCommand implements the unit-get command.

func (*UnitGetCommand) Info Uses

func (c *UnitGetCommand) Info() *cmd.Info

func (*UnitGetCommand) Init Uses

func (c *UnitGetCommand) Init(args []string) error

func (*UnitGetCommand) Run Uses

func (c *UnitGetCommand) Run(ctx *cmd.Context) error

func (*UnitGetCommand) SetFlags Uses

func (c *UnitGetCommand) SetFlags(f *gnuflag.FlagSet)

type UnitHookContext Uses

type UnitHookContext interface {
    HookContext
}

UnitHookContext is the context for a unit hook.

Directories

PathSynopsis
jujuctesting

Package jujuc imports 32 packages (graph) and is imported by 367 packages. Updated 2019-12-05. Refresh now. Tools for package owners.