Documentation ¶
Index ¶
- Constants
- func CheckCIDRs(args []string, cidrsOptional bool) (set.Strings, error)
- func CheckName(name string) (string, error)
- func NewSuperCommand() cmd.Command
- func ParseNameAndCIDRs(args []string, cidrsOptional bool) (name string, CIDRs set.Strings, err error)
- type CreateCommand
- type ListCommand
- type RemoveCommand
- type RenameCommand
- type RunOnAPI
- type SpaceAPI
- type SpaceCommandBase
- type UpdateCommand
Constants ¶
const RenameCommandDoc = `` /* 151-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func CheckCIDRs ¶
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 NewSuperCommand ¶
NewSuperCommand creates the "space" supercommand and registers the subcommands that it supports.
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 CreateCommand ¶
type CreateCommand struct { SpaceCommandBase Name string CIDRs set.Strings }
CreateCommand calls the API to create a new network space.
func (*CreateCommand) Info ¶
func (c *CreateCommand) Info() *cmd.Info
Info is defined on the cmd.Command interface.
func (*CreateCommand) Init ¶
func (c *CreateCommand) 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.
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 RemoveCommand ¶
type RemoveCommand struct { SpaceCommandBase Name string }
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.
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 SpaceAPI ¶
type SpaceAPI interface { io.Closer // ListSpaces returns all Juju network spaces and their subnets. ListSpaces() ([]params.Space, error) // CreateSpace creates 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. CreateSpace(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 }
SpaceAPI defines the necessary API methods needed by the space subcommands.
type SpaceCommandBase ¶
type SpaceCommandBase struct { envcmd.EnvCommandBase // 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.
func (*UpdateCommand) SetFlags ¶
func (c *UpdateCommand) SetFlags(f *gnuflag.FlagSet)