juju: github.com/wallyworld/juju/cmd/juju/space Index | Files | Directories

package space

import "github.com/wallyworld/juju/cmd/juju/space"

Index

Package Files

add.go list.go move.go reload.go remove.go rename.go show.go space.go

Constants

const ReloadCommandDoc = `
Reloades spaces and subnets from substrate
`
const ShowSpaceCommandDoc = "" /* 314 byte string literal not displayed */

func CheckCIDRs Uses

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 Uses

func CheckName(name string) (string, error)

CheckName checks whether name is a valid space name.

func NewAddCommand Uses

func NewAddCommand() modelcmd.ModelCommand

NewAddCommand returns a command used to add a network space.

func NewListCommand Uses

func NewListCommand() modelcmd.ModelCommand

NewListCommand returns a command used to list spaces.

func NewMoveCommand Uses

func NewMoveCommand() modelcmd.ModelCommand

NewMoveCommand returns a command used to move an existing space to a different subnet.

func NewReloadCommand Uses

func NewReloadCommand() modelcmd.ModelCommand

NewListCommand returns a command used to list spaces.

func NewRemoveCommand Uses

func NewRemoveCommand() modelcmd.ModelCommand

NewRemoveCommand returns a command used to remove a space.

func NewRenameCommand Uses

func NewRenameCommand() modelcmd.ModelCommand

NewRenameCommand returns a command used to rename an existing space.

func NewShowSpaceCommand Uses

func NewShowSpaceCommand() modelcmd.ModelCommand

NewAddCommand returns a command used to add a network space.

func ParseNameAndCIDRs Uses

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

type API Uses

type API interface {
    io.Closer

    SpaceAPI
    SubnetAPI
}

API defines the contract for requesting the API facades.

type APIShim Uses

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 Uses

func (m *APIShim) AddSpace(name string, subnetIds []string, public bool) 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.

func (*APIShim) Close Uses

func (m *APIShim) Close() error

func (*APIShim) ListSpaces Uses

func (m *APIShim) ListSpaces() ([]params.Space, error)

ListSpaces returns all Juju network spaces and their subnets.

func (*APIShim) MoveSubnets Uses

func (m *APIShim) MoveSubnets(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 Uses

func (m *APIShim) ReloadSpaces() error

ReloadSpaces fetches spaces and subnets from substrate

func (*APIShim) RemoveSpace Uses

func (m *APIShim) RemoveSpace(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 Uses

func (m *APIShim) RenameSpace(oldName, newName string) error

RenameSpace changes the name of the space.

func (*APIShim) ShowSpace Uses

func (m *APIShim) ShowSpace(name string) (params.ShowSpaceResult, error)

ShowSpace fetches space information.

func (*APIShim) SubnetsByCIDR Uses

func (m *APIShim) SubnetsByCIDR(cidrs []string) ([]params.SubnetsResult, error)

SubnetsByCIDR returns the collection of subnets matching each CIDR in the input.

type AddCommand Uses

type AddCommand struct {
    SpaceCommandBase
    Name  string
    CIDRs set.Strings
}

AddCommand calls the API to add a new network space.

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) 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 FanCIDRs Uses

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 Uses

type ListCommand struct {
    SpaceCommandBase
    Short bool
    // contains filtered or unexported fields
}

listCommand displays a list of all spaces 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 MoveCommand Uses

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 Uses

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

Info returns a cmd.Info that details the move command information.

func (*MoveCommand) Init Uses

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 Uses

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

Run implements Command.Run.

func (*MoveCommand) SetFlags Uses

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

SetFlags defines the move command flags it wants to offer.

type MovedSpace Uses

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 Uses

type ReloadCommand struct {
    SpaceCommandBase
}

listCommand displays a list of all spaces known to Juju.

func (*ReloadCommand) Info Uses

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

Info is defined on the cmd.Command interface.

func (*ReloadCommand) Run Uses

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

Run implements Command.Run.

type RemoveCommand Uses

type RemoveCommand struct {
    SpaceCommandBase
    // contains filtered or unexported fields
}

RemoveCommand calls the API to remove an existing network space.

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) (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 Uses

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

Run implements Command.Run.

func (*RemoveCommand) SetFlags Uses

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

SetFlags implements Command.SetFlags.

type RemoveSpace Uses

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 Uses

type RenameCommand struct {
    SpaceCommandBase
    Name    string
    NewName string
}

RenameCommand calls the API to rename an existing network space.

func (*RenameCommand) Info Uses

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

Info is defined on the cmd.Command interface.

func (*RenameCommand) Init Uses

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 Uses

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

Run implements Command.Run.

func (*RenameCommand) SetFlags Uses

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

type RunOnAPI Uses

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

type RunOnSpaceAPI Uses

type RunOnSpaceAPI func(api SpaceAPI, ctx *cmd.Context) error

type ShowSpace Uses

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 Uses

type ShowSpaceCommand struct {
    SpaceCommandBase
    Name string
    // contains filtered or unexported fields
}

ShowSpaceCommand calls the API to add a new network space.

func (*ShowSpaceCommand) Info Uses

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

Info is defined on the cmd.Command interface.

func (*ShowSpaceCommand) Init Uses

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 Uses

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

Run implements Command.Run.

func (*ShowSpaceCommand) SetFlags Uses

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

SetFlags implements part of the cmd.Command interface.

type SpaceAPI Uses

type SpaceAPI interface {
    // ListSpaces returns all Juju network spaces and their subnets.
    ListSpaces() ([]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(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, force bool, dryRun bool) (params.RemoveSpaceResult, error)

    // RenameSpace changes the name of the space.
    RenameSpace(name, newName string) error

    // ReloadSpaces fetches spaces and subnets from substrate
    ReloadSpaces() error

    // ShowSpace fetches space information.
    ShowSpace(name string) (params.ShowSpaceResult, error)

    // MoveSubnets ensures that the input subnets are in the input space.
    MoveSubnets(names.SpaceTag, []names.SubnetTag, bool) (params.MoveSubnetsResult, error)
}

SpaceAPI defines the necessary API methods needed by the space subcommands.

type SpaceCommandBase Uses

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 Uses

func (c *SpaceCommandBase) NewAPI() (API, error)

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

func (*SpaceCommandBase) RunWithAPI Uses

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

func (*SpaceCommandBase) RunWithSpaceAPI Uses

func (c *SpaceCommandBase) RunWithSpaceAPI(ctx *cmd.Context, toRun RunOnSpaceAPI) error

type SpaceInfo Uses

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 Uses

type SubnetAPI interface {

    // SubnetsByCIDR returns the collection of subnets matching each CIDR in the input.
    SubnetsByCIDR([]string) ([]params.SubnetsResult, error)
}

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

type SubnetInfo Uses

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"`

    // FanInfo describes the fan networking setup for the subnet.
    // It may be empty if this is not a fan subnet,
    // or if this subnet information comes from a provider.
    FanInfo *network.FanCIDRs `json:"fan-info,omitempty" yaml:"fan-info,omitempty"`

    // IsPublic describes whether a subnet is public or not.
    IsPublic bool `json:"is-public,omitempty" yaml:"is-public,omitempty"`
}

SubnetInfo is a source-agnostic representation of a subnet. It may originate from state, or from a provider.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package space imports 23 packages (graph). Updated 2020-05-06. Refresh now. Tools for package owners.