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 list.go subnet.go

func NewAddCommand Uses

func NewAddCommand() modelcmd.ModelCommand

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

func NewListCommand Uses

func NewListCommand() modelcmd.ModelCommand

NewListCommand returns a cammin used to list all subnets known to 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 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 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)
}

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 30 packages. Updated 2020-06-14. Refresh now. Tools for package owners.