space

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ReloadCommandDoc = `
Reloades spaces and subnets from substrate
`

Variables

This section is empty.

Functions

func CheckCIDRs

func CheckCIDRs(args []string, cidrsOptional bool) (set.Strings, error)

CheckCIDRs parses the list of strings as CIDRs, checking for correct formatting, no duplication and no overlaps. Returns error if no CIDRs are provided, unless cidrsOptional is true.

func CheckName

func CheckName(name string) (string, error)

CheckName checks whether name is a valid space name.

func NewAddCommand

func NewAddCommand() modelcmd.ModelCommand

NewAddCommand returns a command used to add a network space.

func NewListCommand

func NewListCommand() modelcmd.ModelCommand

NewListCommand returns a command used to list spaces.

func NewReloadCommand

func NewReloadCommand() modelcmd.ModelCommand

NewListCommand returns a command used to list spaces.

func NewRemoveCommand

func NewRemoveCommand() modelcmd.ModelCommand

NewRemoveCommand returns a command used to remove a space.

func NewRenameCommand

func NewRenameCommand() modelcmd.ModelCommand

NewRenameCommand returns a command used to rename an existing space.

func NewUpdateCommand

func NewUpdateCommand() modelcmd.ModelCommand

NewUpdateCommand returns a command used to update subnets in a space.

func ParseNameAndCIDRs

func ParseNameAndCIDRs(args []string, cidrsOptional bool) (
	name string, CIDRs set.Strings, err error,
)

ParseNameAndCIDRs verifies the input args and returns any errors, like missing/invalid name or CIDRs (validated when given, but it's an error for CIDRs to be empty if cidrsOptional is false).

Types

type AddCommand

type AddCommand struct {
	SpaceCommandBase
	Name  string
	CIDRs set.Strings
}

AddCommand calls the API to add a new network space.

func (*AddCommand) Info

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

Info is defined on the cmd.Command interface.

func (*AddCommand) Init

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

Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.

func (*AddCommand) Run

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

Run implements Command.Run.

type ListCommand

type ListCommand struct {
	SpaceCommandBase
	Short bool
	// contains filtered or unexported fields
}

listCommand displays a list of all spaces known to Juju.

func (*ListCommand) Info

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

Info is defined on the cmd.Command interface.

func (*ListCommand) Init

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

Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.

func (*ListCommand) Run

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

Run implements Command.Run.

func (*ListCommand) SetFlags

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

SetFlags is defined on the cmd.Command interface.

type ReloadCommand

type ReloadCommand struct {
	SpaceCommandBase
}

listCommand displays a list of all spaces known to Juju.

func (*ReloadCommand) Info

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

Info is defined on the cmd.Command interface.

func (*ReloadCommand) Run

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

Run implements Command.Run.

type RemoveCommand

type RemoveCommand struct {
	SpaceCommandBase
	// contains filtered or unexported fields
}

RemoveCommand calls the API to remove an existing network space.

func (*RemoveCommand) Info

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

Info is defined on the cmd.Command interface.

func (*RemoveCommand) Init

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

Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.

func (*RemoveCommand) Run

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

Run implements Command.Run.

type RenameCommand

type RenameCommand struct {
	SpaceCommandBase
	Name    string
	NewName string
}

RenameCommand calls the API to rename an existing network space.

func (*RenameCommand) Info

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

Info is defined on the cmd.Command interface.

func (*RenameCommand) Init

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

Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.

func (*RenameCommand) Run

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

Run implements Command.Run.

func (*RenameCommand) SetFlags

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

type RunOnAPI

type RunOnAPI func(api SpaceAPI, ctx *cmd.Context) error

type SpaceAPI

type SpaceAPI interface {
	io.Closer

	// ListSpaces returns all Juju network spaces and their subnets.
	ListSpaces() ([]params.Space, error)

	// AddSpace adds a new Juju network space, associating the
	// specified subnets with it (optional; can be empty), setting the
	// space and subnets access to public or private.
	AddSpace(name string, subnetIds []string, public bool) error

	// RemoveSpace removes an existing Juju network space, transferring
	// any associated subnets to the default space.
	RemoveSpace(name string) error

	// UpdateSpace changes the associated subnets for an existing space with
	// the given name. The list of subnets must contain at least one entry.
	UpdateSpace(name string, subnetIds []string) error

	// RenameSpace changes the name of the space.
	RenameSpace(name, newName string) error

	// ReloadSpaces fetches spaces and subnets from substrate
	ReloadSpaces() error
}

SpaceAPI defines the necessary API methods needed by the space subcommands.

type SpaceCommandBase

type SpaceCommandBase struct {
	modelcmd.ModelCommandBase
	modelcmd.IAASOnlyCommand
	// contains filtered or unexported fields
}

SpaceCommandBase is the base type embedded into all space subcommands.

func (*SpaceCommandBase) NewAPI

func (c *SpaceCommandBase) NewAPI() (SpaceAPI, error)

NewAPI returns a SpaceAPI for the root api endpoint that the environment command returns.

func (*SpaceCommandBase) RunWithAPI

func (c *SpaceCommandBase) RunWithAPI(ctx *cmd.Context, toRun RunOnAPI) error

type UpdateCommand

type UpdateCommand struct {
	SpaceCommandBase
	Name  string
	CIDRs set.Strings
}

UpdateCommand calls the API to update an existing network space.

func (*UpdateCommand) Info

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

Info is defined on the cmd.Command interface.

func (*UpdateCommand) Init

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

Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.

func (*UpdateCommand) Run

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

Run implements Command.Run.

Jump to

Keyboard shortcuts

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