Documentation
¶
Index ¶
- Constants
- func CheckCIDRs(args []string, cidrsOptional bool) (set.Strings, error)
- func CheckName(name string) (string, error)
- func NewAddCommand() modelcmd.ModelCommand
- func NewListCommand() modelcmd.ModelCommand
- func NewMoveCommand() modelcmd.ModelCommand
- func NewReloadCommand() modelcmd.ModelCommand
- func NewRemoveCommand() modelcmd.ModelCommand
- func NewRenameCommand() modelcmd.ModelCommand
- func NewShowSpaceCommand() modelcmd.ModelCommand
- func ParseNameAndCIDRs(args []string, cidrsOptional bool) (name string, cidrs set.Strings, err error)
- type API
- type APIShim
- func (m *APIShim) AddSpace(ctx context.Context, name string, subnetIds []string, public bool) error
- func (m *APIShim) Close() error
- func (m *APIShim) ListSpaces(ctx context.Context) ([]params.Space, error)
- func (m *APIShim) MoveSubnets(ctx context.Context, space names.SpaceTag, subnets []names.SubnetTag, ...) (params.MoveSubnetsResult, error)
- func (m *APIShim) ReloadSpaces(ctx context.Context) error
- func (m *APIShim) RemoveSpace(ctx context.Context, name string, force bool, dryRun bool) (params.RemoveSpaceResult, error)
- func (m *APIShim) RenameSpace(ctx context.Context, oldName, newName string) error
- func (m *APIShim) ShowSpace(ctx context.Context, name string) (params.ShowSpaceResult, error)
- func (m *APIShim) SubnetsByCIDR(ctx context.Context, cidrs []string) ([]params.SubnetsResult, error)
- type AddCommand
- type FanCIDRs
- type ListCommand
- type MoveCommand
- type MovedSpace
- type ReloadCommand
- type RemoveCommand
- type RemoveSpace
- type RenameCommand
- type RunOnAPI
- type RunOnSpaceAPI
- type ShowSpace
- type ShowSpaceCommand
- type SpaceAPI
- type SpaceCommandBase
- type SpaceInfo
- type SubnetAPI
- type SubnetInfo
Constants ¶
const ReloadCommandDoc = `
Reloades spaces and subnets from substrate.
`
const ReloadCommandExamples = `
juju reload-spaces
`
const ShowSpaceCommandDoc = `` /* 177-byte string literal not displayed */
const ShowSpaceCommandExamples = `
Show a space by name:
juju show-space alpha
`
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 NewAddCommand ¶
func NewAddCommand() modelcmd.ModelCommand
NewAddCommand returns a command used to add a network space.
func NewListCommand ¶
func NewListCommand() modelcmd.ModelCommand
NewListCommand returns a command used to list spaces.
func NewMoveCommand ¶
func NewMoveCommand() modelcmd.ModelCommand
NewMoveCommand returns a command used to move an existing space to a different subnet.
func NewReloadCommand ¶
func NewReloadCommand() modelcmd.ModelCommand
NewListCommand returns a command used to list spaces.
func NewRemoveCommand ¶
func NewRemoveCommand() modelcmd.ModelCommand
NewRemoveCommand returns a command used to remove a space.
func NewRenameCommand ¶
func NewRenameCommand() modelcmd.ModelCommand
NewRenameCommand returns a command used to rename an existing space.
func NewShowSpaceCommand ¶
func NewShowSpaceCommand() modelcmd.ModelCommand
NewAddCommand returns a command used to add a network space.
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 APIShim ¶
type APIShim struct { SpaceAPI // contains filtered or unexported fields }
APIShim forwards SpaceAPI methods to the real API facade for implemented methods only.
func (*APIShim) AddSpace ¶
AddSpace adds 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.
func (*APIShim) ListSpaces ¶
ListSpaces returns all Juju network spaces and their subnets.
func (*APIShim) MoveSubnets ¶
func (m *APIShim) MoveSubnets(ctx context.Context, space names.SpaceTag, subnets []names.SubnetTag, force bool) (params.MoveSubnetsResult, error)
MoveSubnets ensures that the input subnets are in the input space.
func (*APIShim) ReloadSpaces ¶
ReloadSpaces fetches spaces and subnets from substrate
func (*APIShim) RemoveSpace ¶
func (m *APIShim) RemoveSpace(ctx context.Context, name string, force bool, dryRun bool) (params.RemoveSpaceResult, error)
RemoveSpace removes an existing Juju network space, transferring any associated subnets to the default space.
func (*APIShim) RenameSpace ¶
RenameSpace changes the name of the space.
func (*APIShim) SubnetsByCIDR ¶
func (m *APIShim) SubnetsByCIDR(ctx context.Context, cidrs []string) ([]params.SubnetsResult, error)
SubnetsByCIDR returns the collection of subnets matching each CIDR in the input.
type AddCommand ¶
type AddCommand struct { SpaceCommandBase Name string CIDRs set.Strings }
AddCommand calls the API to add a new network space.
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) error
Init is defined on the cmd.Command interface. It checks the arguments for sanity and sets up the command to run.
type FanCIDRs ¶
type FanCIDRs struct { // FanLocalUnderlay is the CIDR of the local underlying fan network. // It allows easy identification of the device the fan is running on. FanLocalUnderlay string `json:"fan-local-underlay" yaml:"fan-local-underlay"` // FanOverlay is the CIDR of the complete fan setup. FanOverlay string `json:"fan-overlay" yaml:"fan-overlay"` }
FanCIDRs describes the subnets relevant to a fan network.
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 MoveCommand ¶
type MoveCommand struct { SpaceCommandBase Name string CIDRs set.Strings Force bool // contains filtered or unexported fields }
MoveCommand calls the API to attempt to move an existing space to a different subnet.
func (*MoveCommand) Info ¶
func (c *MoveCommand) Info() *cmd.Info
Info returns a cmd.Info that details the move command information.
func (*MoveCommand) Init ¶
func (c *MoveCommand) Init(args []string) error
Init checks the arguments for valid arguments and sets up the command to run. Defined on the cmd.Command interface.
func (*MoveCommand) Run ¶
func (c *MoveCommand) Run(ctx *cmd.Context) error
Run implements Command.Run.
func (*MoveCommand) SetFlags ¶
func (c *MoveCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags defines the move command flags it wants to offer.
type MovedSpace ¶
type MovedSpace struct { // SpaceFrom is the name of the space which the CIDR left. SpaceFrom string `json:"from" yaml:"from"` // SpaceTo is the name of the space which the CIDR goes to. SpaceTo string `json:"to" yaml:"to"` // CIDR of the subnet that is moving. CIDR string `json:"cidr" yaml:"cidr"` }
MovedSpace represents a CIDR movement from space `a` to space `b`
type ReloadCommand ¶
type ReloadCommand struct {
SpaceCommandBase
}
listCommand displays a list of all spaces known to Juju.
func (*ReloadCommand) Info ¶
func (c *ReloadCommand) Info() *cmd.Info
Info is defined on the cmd.Command interface.
type RemoveCommand ¶
type RemoveCommand struct { SpaceCommandBase // contains filtered or unexported fields }
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.
func (*RemoveCommand) SetFlags ¶
func (c *RemoveCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags implements Command.SetFlags.
type RemoveSpace ¶
type RemoveSpace struct { // The space which cannot be removed. Only with --force. Space string `json:"space" yaml:"space"` // HasModelConstraint is the model constraint. HasModelConstraint bool `json:"has-model-constraint" yaml:"has-model-constraint"` // Constraints are the constraints which blocks the remove. Blocking Constraints are: Application. Constraints []string `json:"constraints,omitempty" yaml:"constraints,omitempty"` // Bindings are the application bindings which blocks the remove. Bindings []string `json:"bindings,omitempty" yaml:"bindings,omitempty"` // ControllerConfig are the config settings of the controller model which are using the space. // This is only valid if the current model is a controller model. ControllerConfig []string `json:"controller-settings,omitempty" yaml:"controller-settings,omitempty"` }
RemoveSpace represents space information why a space could not be removed.
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 ShowSpace ¶
type ShowSpace struct { // Information about a given space. Space SpaceInfo `json:"space" yaml:"space"` // Application names which are bound to a given space. Applications []string `json:"applications" yaml:"applications"` // MachineCount is the number of machines connected to a given space. MachineCount int `json:"machine-count" yaml:"machine-count"` }
ShowSpace represents space information output by the CLI client.
type ShowSpaceCommand ¶
type ShowSpaceCommand struct { SpaceCommandBase Name string // contains filtered or unexported fields }
ShowSpaceCommand calls the API to add a new network space.
func (*ShowSpaceCommand) Info ¶
func (c *ShowSpaceCommand) Info() *cmd.Info
Info is defined on the cmd.Command interface.
func (*ShowSpaceCommand) Init ¶
func (c *ShowSpaceCommand) 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 (*ShowSpaceCommand) Run ¶
func (c *ShowSpaceCommand) Run(ctx *cmd.Context) error
Run implements Command.Run.
func (*ShowSpaceCommand) SetFlags ¶
func (c *ShowSpaceCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags implements part of the cmd.Command interface.
type SpaceAPI ¶
type SpaceAPI interface { // ListSpaces returns all Juju network spaces and their subnets. ListSpaces(ctx context.Context) ([]params.Space, error) // AddSpace adds 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. AddSpace(ctx context.Context, name string, subnetIds []string, public bool) error // RemoveSpace removes an existing Juju network space, transferring // any associated subnets to the default space. RemoveSpace(ctx context.Context, name string, force bool, dryRun bool) (params.RemoveSpaceResult, error) // RenameSpace changes the name of the space. RenameSpace(ctx context.Context, name, newName string) error // ReloadSpaces fetches spaces and subnets from substrate ReloadSpaces(ctx context.Context) error // ShowSpace fetches space information. ShowSpace(ctx context.Context, name string) (params.ShowSpaceResult, error) // MoveSubnets ensures that the input subnets are in the input space. MoveSubnets(context.Context, names.SpaceTag, []names.SubnetTag, bool) (params.MoveSubnetsResult, error) }
SpaceAPI defines the necessary API methods needed by the space subcommands.
type SpaceCommandBase ¶
type SpaceCommandBase struct { modelcmd.ModelCommandBase modelcmd.IAASOnlyCommand // contains filtered or unexported fields }
SpaceCommandBase is the base type embedded into all space subcommands.
func (*SpaceCommandBase) NewAPI ¶
func (c *SpaceCommandBase) NewAPI(ctx context.Context) (API, error)
NewAPI returns a API for the root api endpoint that the environment command returns.
func (*SpaceCommandBase) RunWithAPI ¶
func (c *SpaceCommandBase) RunWithAPI(ctx *cmd.Context, toRun RunOnAPI) error
func (*SpaceCommandBase) RunWithSpaceAPI ¶
func (c *SpaceCommandBase) RunWithSpaceAPI(ctx *cmd.Context, toRun RunOnSpaceAPI) error
type SpaceInfo ¶
type SpaceInfo struct { // ID is the unique identifier for the space. ID string `json:"id" yaml:"id"` // Name is the name of the space. // It is used by operators for identifying a space and should be unique. Name string `json:"name" yaml:"name"` // ProviderId is the provider's unique identifier for the space, // such as used by MAAS. ProviderId string `json:"provider-id,omitempty" yaml:"provider-id,omitempty"` // Subnets are the subnets that have been grouped into this network space. Subnets []SubnetInfo `json:"subnets" yaml:"subnets"` }
SpaceInfo defines a network space.
type SubnetAPI ¶
type SubnetAPI interface { // SubnetsByCIDR returns the collection of subnets matching each CIDR in the input. SubnetsByCIDR(context.Context, []string) ([]params.SubnetsResult, error) }
SubnetAPI defines the necessary API methods needed by the subnet subcommands.
type SubnetInfo ¶
type SubnetInfo struct { // CIDR of the network, in 123.45.67.89/24 format. CIDR string `json:"cidr" yaml:"cidr"` // ProviderId is a provider-specific subnet ID. ProviderId string `json:"provider-id,omitempty" yaml:"provider-id,omitempty"` // ProviderSpaceId holds the provider ID of the space associated // with this subnet. Can be empty if not supported. ProviderSpaceId string `json:"provider-space-id,omitempty" yaml:"provider-space-id,omitempty"` // ProviderNetworkId holds the provider ID of the network // containing this subnet, for example VPC id for EC2. ProviderNetworkId string `json:"provider-network-id,omitempty" yaml:"provider-network-id,omitempty"` // VLANTag needs to be between 1 and 4094 for VLANs and 0 for // normal networks. It's defined by IEEE 802.1Q standard, and used // to define a VLAN network. For more information, see: // http://en.wikipedia.org/wiki/IEEE_802.1Q. VLANTag int `json:"vlan-tag" yaml:"vlan-tag"` // AvailabilityZones describes which availability zones this // subnet is in. It can be empty if the provider does not support // availability zones. AvailabilityZones []string `json:"zones,omitempty" yaml:"zones,omitempty"` // SpaceID is the id of the space the subnet is associated with. // Default value should be AlphaSpaceId. It can be empty if // the subnet is returned from an networkingEnviron. SpaceID is // preferred over SpaceName in state and non networkingEnviron use. SpaceID string `json:"space-id,omitempty" yaml:"space-id,omitempty"` // SpaceName is the name of the space the subnet is associated with. // An empty string indicates it is part of the AlphaSpaceName OR // if the SpaceID is set. Should primarily be used in an networkingEnviron. SpaceName string `json:"space-name,omitempty" yaml:"space-name,omitempty"` }
SubnetInfo is a source-agnostic representation of a subnet. It may originate from state, or from a provider.