Documentation ¶
Index ¶
- func NewSuperCommand() cmd.Command
- type AddCommand
- type CreateCommand
- type ListCommand
- type RemoveCommand
- type RunOnAPI
- type SubnetAPI
- type SubnetCommandBase
- func (s *SubnetCommandBase) CheckNumArgs(args []string, errors []error) error
- func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error)
- func (c *SubnetCommandBase) RunWithAPI(ctx *cmd.Context, toRun RunOnAPI) error
- func (s *SubnetCommandBase) ValidateCIDR(given string, strict bool) (names.SubnetTag, error)
- func (s *SubnetCommandBase) ValidateSpace(given string) (names.SpaceTag, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSuperCommand ¶
NewSuperCommand creates the "subnet" supercommand and registers the subcommands that it supports.
Types ¶
type AddCommand ¶
type AddCommand struct { SubnetCommandBase CIDR names.SubnetTag RawCIDR string // before normalizing (e.g. 10.10.0.0/8 to 10.0.0.0/8) ProviderId string Space names.SpaceTag Zones []string }
AddCommand calls the API to add an existing subnet to Juju.
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) (err error)
Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.
type CreateCommand ¶
type CreateCommand struct { SubnetCommandBase CIDR names.SubnetTag Space names.SpaceTag Zones set.Strings IsPublic bool IsPrivate bool // contains filtered or unexported fields }
CreateCommand calls the API to create a new subnet.
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.
func (*CreateCommand) Run ¶
func (c *CreateCommand) Run(ctx *cmd.Context) error
Run implements Command.Run.
func (*CreateCommand) SetFlags ¶
func (c *CreateCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags is defined on the cmd.Command interface.
type ListCommand ¶
type ListCommand struct { SubnetCommandBase SpaceName string ZoneName string // contains filtered or unexported fields }
ListCommand displays a list of all subnets 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 { SubnetCommandBase CIDR names.SubnetTag }
RemoveCommand calls the API to remove an existing, unused subnet from Juju.
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) error
Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.
type SubnetAPI ¶
type SubnetAPI interface { io.Closer // AddSubnet adds an existing subnet to Juju. AddSubnet(cidr names.SubnetTag, id network.Id, spaceTag names.SpaceTag, zones []string) error // ListSubnets returns information about subnets known to Juju, // optionally filtered by space and/or zone (both can be empty). ListSubnets(withSpace *names.SpaceTag, withZone string) ([]params.Subnet, error) // AllZones returns all availability zones known to Juju. AllZones() ([]string, error) // AllSpaces returns all Juju network spaces. AllSpaces() ([]names.Tag, error) // CreateSubnet creates a new Juju subnet. CreateSubnet(subnetCIDR names.SubnetTag, spaceTag names.SpaceTag, zones []string, isPublic bool) error // RemoveSubnet marks an existing subnet as no longer used, which // will cause it to get removed at some point after all its // related entites are cleaned up. It will fail if the subnet is // still in use by any machines. RemoveSubnet(subnetCIDR names.SubnetTag) error }
SubnetAPI defines the necessary API methods needed by the subnet subcommands.
type SubnetCommandBase ¶
type SubnetCommandBase struct { envcmd.EnvCommandBase // contains filtered or unexported fields }
SubnetCommandBase is the base type embedded into all subnet subcommands.
func (*SubnetCommandBase) CheckNumArgs ¶
func (s *SubnetCommandBase) CheckNumArgs(args []string, errors []error) error
CheckNumArgs is a helper used to validate the number of arguments passed to Init(). If the number of arguments is X, errors[X] (if set) will be returned, otherwise no error occurs.
func (*SubnetCommandBase) NewAPI ¶
func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error)
NewAPI returns a SubnetAPI for the root api endpoint that the environment command returns.
func (*SubnetCommandBase) RunWithAPI ¶
func (c *SubnetCommandBase) RunWithAPI(ctx *cmd.Context, toRun RunOnAPI) error
func (*SubnetCommandBase) ValidateCIDR ¶
ValidateCIDR parses given and returns an error if it's not valid. If the CIDR is incorrectly specified (e.g. 10.10.10.0/16 instead of 10.10.0.0/16) and strict is false, the correctly parsed CIDR in the expected format is returned instead without an error. Otherwise, when strict is true and given is incorrectly formatted, an error will be returned.
func (*SubnetCommandBase) ValidateSpace ¶
func (s *SubnetCommandBase) ValidateSpace(given string) (names.SpaceTag, error)
ValidateSpace parses given and returns an error if it's not a valid space name, otherwise returns the parsed tag and no error.