Documentation

Index

Constants

View Source
const RenameCommandDoc = `` /* 151-byte string literal not displayed */

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 NewSuperCommand

      func NewSuperCommand() cmd.Command

        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.

                func (*CreateCommand) Run

                func (c *CreateCommand) 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 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.

                                  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)
                                            
                                            	// 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)