block

package
v0.0.0-...-a002913 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OperationFromType = func(blockType string) string {
	return blockTypes[blockType]
}

OperationFromType translates given block type as defined in multiwatcher into the operation such as destroy-environment.

View Source
var TypeFromOperation = func(operation string) string {
	for key, value := range blockTypes {
		if value == operation {
			return key
		}
	}
	panic(fmt.Sprintf("unknown operation %v", operation))
}

TypeFromOperation translates given operation string such as destroy-environment, remove-object, etc to block type string as defined in multiwatcher.

Functions

func NewSuperBlockCommand

func NewSuperBlockCommand() cmd.Command

NewSuperBlockCommand creates the block supercommand and registers the subcommands that it supports.

func ProcessBlockedError

func ProcessBlockedError(err error, block Block) error

ProcessBlockedError ensures that correct and user-friendly message is displayed to the user based on the block type.

Types

type BaseBlockCommand

type BaseBlockCommand struct {
	envcmd.EnvCommandBase
	// contains filtered or unexported fields
}

BaseBlockCommand is base command for all commands that enable blocks.

func (*BaseBlockCommand) Init

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

Init initializes the command. Satisfying Command interface.

func (*BaseBlockCommand) SetFlags

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

SetFlags implements Command.SetFlags.

type Block

type Block int8

Block describes block type

const (
	// BlockDestroy describes the block that
	// blocks destroy- commands
	BlockDestroy Block = iota

	// BlockRemove describes the block that
	// blocks remove- commands
	BlockRemove

	// BlockChange describes the block that
	// blocks change commands
	BlockChange
)

type BlockClientAPI

type BlockClientAPI interface {
	Close() error
	SwitchBlockOn(blockType, msg string) error
}

BlockClientAPI defines the client API methods that block command uses.

type BlockInfo

type BlockInfo struct {
	Operation string  `yaml:"block" json:"block"`
	Enabled   bool    `yaml:"enabled" json:"enabled"`
	Message   *string `yaml:"message,omitempty" json:"message,omitempty"`
}

BlockInfo defines the serialization behaviour of the block information.

type BlockListAPI

type BlockListAPI interface {
	Close() error
	List() ([]params.Block, error)
}

BlockListAPI defines the client API methods that block list command uses.

type ChangeCommand

type ChangeCommand struct {
	BaseBlockCommand
}

ChangeCommand blocks commands that may change environment.

func (*ChangeCommand) Info

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

Info provides information about command. Satisfying Command interface.

func (*ChangeCommand) Run

func (c *ChangeCommand) Run(_ *cmd.Context) error

Satisfying Command interface.

type Command

type Command struct {
	cmd.SuperCommand
}

Command is the top-level command wrapping all storage functionality.

type DestroyCommand

type DestroyCommand struct {
	BaseBlockCommand
}

DestroyCommand blocks destroy environment.

func (*DestroyCommand) Info

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

Info provides information about command. Satisfying Command interface.

func (*DestroyCommand) Run

func (c *DestroyCommand) Run(_ *cmd.Context) error

Satisfying Command interface.

type ListCommand

type ListCommand struct {
	envcmd.EnvCommandBase
	// contains filtered or unexported fields
}

ListCommand list blocks.

func (*ListCommand) Info

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

Info implements Command.Info.

func (*ListCommand) Init

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

Init implements Command.Init.

func (*ListCommand) Run

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

Run implements Command.Run.

func (*ListCommand) SetFlags

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

SetFlags implements Command.SetFlags.

type RemoveCommand

type RemoveCommand struct {
	BaseBlockCommand
}

RemoveCommand blocks commands that remove juju objects.

func (*RemoveCommand) Info

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

Info provides information about command. Satisfying Command interface.

func (*RemoveCommand) Run

func (c *RemoveCommand) Run(_ *cmd.Context) error

Satisfying Command interface.

type UnblockClientAPI

type UnblockClientAPI interface {
	Close() error
	SwitchBlockOff(blockType string) error
}

UnblockClientAPI defines the client API methods that unblock command uses.

type UnblockCommand

type UnblockCommand struct {
	envcmd.EnvCommandBase
	// contains filtered or unexported fields
}

UnblockCommand removes the block from desired operation.

func (*UnblockCommand) Info

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

Info provides information about command. Satisfying Command interface.

func (*UnblockCommand) Init

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

Init initializes the command. Satisfying Command interface.

func (*UnblockCommand) Run

func (c *UnblockCommand) Run(_ *cmd.Context) error

Run unblocks previously blocked commands. Satisfying Command interface.

func (*UnblockCommand) SetFlags

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

SetFlags implements Command.SetFlags.

Jump to

Keyboard shortcuts

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