juju: github.com/juju/juju/cmd/juju/subnet Index | Files

package subnet

import "github.com/juju/juju/cmd/juju/subnet"

Index

Package Files

add.go create.go list.go remove.go subnet.go

func NewAddCommand Uses

func NewAddCommand() modelcmd.ModelCommand

NewAddCommand returns a command used to add an existing subnet to Juju.

func NewCreateCommand Uses

func NewCreateCommand() modelcmd.ModelCommand

NewCreateCommand returns a command to create a new subnet.

func NewListCommand Uses

func NewListCommand() modelcmd.ModelCommand

NewListCommand returns a cammin used to list all subnets known to Juju.

func NewRemoveCommand Uses

func NewRemoveCommand() modelcmd.ModelCommand

NewRemoveCommand returns a command used to remove an unused subnet from Juju.

type AddCommand Uses

type AddCommand struct {
    SubnetCommandBase

    CIDR       string
    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 Uses

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

Info is defined on the cmd.Command interface.

func (*AddCommand) Init Uses

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.

func (*AddCommand) Run Uses

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

Run implements Command.Run.

type CreateCommand Uses

type CreateCommand struct {
    SubnetCommandBase

    CIDR      string
    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 Uses

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

Info is defined on the cmd.Command interface.

func (*CreateCommand) Init Uses

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 Uses

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

Run implements Command.Run.

func (*CreateCommand) SetFlags Uses

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

SetFlags is defined on the cmd.Command interface.

type ListCommand Uses

type ListCommand struct {
    SubnetCommandBase

    SpaceName string
    ZoneName  string

    Out cmd.Output
    // contains filtered or unexported fields
}

ListCommand displays a list of all subnets known to Juju

func (*ListCommand) Info Uses

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

Info is defined on the cmd.Command interface.

func (*ListCommand) Init Uses

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 Uses

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

Run implements Command.Run.

func (*ListCommand) SetFlags Uses

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

SetFlags is defined on the cmd.Command interface.

type RemoveCommand Uses

type RemoveCommand struct {
    SubnetCommandBase

    CIDR string
}

RemoveCommand calls the API to remove an existing, unused subnet from Juju.

func (*RemoveCommand) Info Uses

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

Info is defined on the cmd.Command interface.

func (*RemoveCommand) Init Uses

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.

func (*RemoveCommand) Run Uses

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

Run implements Command.Run.

type RunOnAPI Uses

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

type SubnetAPI Uses

type SubnetAPI interface {
    io.Closer

    // AddSubnet adds an existing subnet to Juju.
    AddSubnet(cidr string, 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 string, 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 string) error
}

SubnetAPI defines the necessary API methods needed by the subnet subcommands.

type SubnetCommandBase Uses

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

SubnetCommandBase is the base type embedded into all subnet subcommands.

func (*SubnetCommandBase) CheckNumArgs Uses

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 Uses

func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error)

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

func (*SubnetCommandBase) RunWithAPI Uses

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

func (*SubnetCommandBase) ValidateCIDR Uses

func (s *SubnetCommandBase) ValidateCIDR(given string, strict bool) (string, error)

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 Uses

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.

Package subnet imports 17 packages (graph) and is imported by 27 packages. Updated 2019-10-16. Refresh now. Tools for package owners.