Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMoveSubnetsOp

func NewMoveSubnetsOp(space networkingcommon.BackingSpace, subnets []MovingSubnet) *moveSubnetsOp

NewMoveSubnetOp returns an operation reference that can be used to move the the input subnets into the input space.

func NewRemoveSpaceOp

func NewRemoveSpaceOp(space RemoveSpace, subnets []Subnet) *spaceRemoveModelOp

func NewRenameSpaceOp

func NewRenameSpaceOp(
	isController bool, settings Settings, st RenameSpaceState, space RenameSpace, toName string,
) *spaceRenameModelOp

func NewStateShim

func NewStateShim(st *state.State) (*stateShim, error)

NewStateShim returns a new state shim.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API provides the spaces API facade for version 6.

func NewAPI

func NewAPI(st *state.State, res facade.Resources, auth facade.Authorizer) (*API, error)

NewAPI creates a new Space API server-side facade with a state.State backing.

func (*API) CreateSpaces

func (api *API) CreateSpaces(args params.CreateSpacesParams) (results params.ErrorResults, err error)

CreateSpaces creates a new Juju network space, associating the specified subnets with it (optional; can be empty).

func (*API) ListSpaces

func (api *API) ListSpaces() (results params.ListSpacesResults, err error)

ListSpaces lists all the available spaces and their associated subnets.

func (*API) MoveSubnets

func (api *API) MoveSubnets(args params.MoveSubnetsParams) (params.MoveSubnetsResults, error)

MoveSubnets ensures that the input subnets are in the input space.

func (*API) ReloadSpaces

func (api *API) ReloadSpaces() error

ReloadSpaces refreshes spaces from substrate

func (*API) RemoveSpace

func (api *API) RemoveSpace(spaceParams params.RemoveSpaceParams) (params.RemoveSpaceResults, error)

RemoveSpace removes a space. Returns SpaceResults if entities/settings are found which makes the deletion not possible.

func (*API) RenameSpace

func (api *API) RenameSpace(args params.RenameSpacesParams) (params.ErrorResults, error)

RenameSpace renames a space.

func (*API) ShowSpace

func (api *API) ShowSpace(entities params.Entities) (params.ShowSpaceResults, error)

ShowSpace shows the spaces for a set of given entities.

type APIv2

type APIv2 struct {
	*APIv3
}

APIv2 provides the spaces API facade for versions < 3.

func NewAPIv2

func NewAPIv2(st *state.State, res facade.Resources, auth facade.Authorizer) (*APIv2, error)

NewAPIv2 is a wrapper that creates a V2 spaces API.

func (*APIv2) ReloadSpaces

func (u *APIv2) ReloadSpaces(_, _ struct{})

ReloadSpaces is not available via the V2 API.

type APIv3

type APIv3 struct {
	*APIv4
}

APIv3 provides the spaces API facade for version 3.

func NewAPIv3

func NewAPIv3(st *state.State, res facade.Resources, auth facade.Authorizer) (*APIv3, error)

NewAPIv3 is a wrapper that creates a V3 spaces API.

type APIv4

type APIv4 struct {
	*APIv5
}

APIv4 provides the spaces API facade for version 4.

func NewAPIv4

func NewAPIv4(st *state.State, res facade.Resources, auth facade.Authorizer) (*APIv4, error)

NewAPIv4 is a wrapper that creates a V4 spaces API.

func (*APIv4) CreateSpaces

func (api *APIv4) CreateSpaces(args params.CreateSpacesParamsV4) (params.ErrorResults, error)

CreateSpaces creates a new Juju network space, associating the specified subnets with it (optional; can be empty).

type APIv5

type APIv5 struct {
	*API
}

APIv5 provides the spaces API facade for version 5.

func NewAPIv5

func NewAPIv5(st *state.State, res facade.Resources, auth facade.Authorizer) (*APIv5, error)

NewAPIv5 is a wrapper that creates a V5 spaces API.

func (*APIv5) ShowSpace

func (api *APIv5) ShowSpace(_, _ struct{})

type Address

type Address interface {
	SubnetCIDR() string
	ConfigMethod() network.AddressConfigMethod
	Value() string
}

Address is an indirection for state.Address.

type AuthorizerState

type AuthorizerState interface {
	// ModelTag returns the tag of this model.
	ModelTag() names.ModelTag
}

AuthorizerState contains the methods used from state to authorize API requests.

type Backing

type Backing interface {
	environs.EnvironConfigGetter

	// ModelTag returns the tag of this model.
	ModelTag() names.ModelTag

	// SubnetByCIDR returns a unique subnet based on the input CIDR.
	SubnetByCIDR(cidr string) (networkingcommon.BackingSubnet, error)

	// MovingSubnet returns the subnet for the input ID,
	// suitable for moving to a new space.
	MovingSubnet(id string) (MovingSubnet, error)

	// AddSpace creates a space.
	AddSpace(name string, providerID network.Id, subnets []string, public bool) (networkingcommon.BackingSpace, error)

	// AllSpaces returns all known Juju network spaces.
	// TODO (manadart 2020-04-14): This should be removed in favour of
	// AllSpaceInfos below, reducing the reliance on networkingcommon.
	AllSpaces() ([]networkingcommon.BackingSpace, error)

	// AllSpaceInfos returns SpaceInfos for all spaces in the model.
	AllSpaceInfos() (network.SpaceInfos, error)

	// SpaceByName returns the Juju network space given by name.
	SpaceByName(name string) (networkingcommon.BackingSpace, error)

	// AllEndpointBindings loads all endpointBindings.
	AllEndpointBindings() (map[string]Bindings, error)

	// AllMachines loads all machines.
	AllMachines() ([]Machine, error)

	// ApplyOperation applies a given ModelOperation to the model.
	ApplyOperation(state.ModelOperation) error

	// ControllerConfig returns the controller config.
	ControllerConfig() (controller.Config, error)

	// AllConstraints returns all constraints in the model.
	AllConstraints() ([]Constraints, error)

	// ConstraintsBySpaceName returns constraints found by spaceName.
	ConstraintsBySpaceName(name string) ([]Constraints, error)

	// IsController returns true if this state instance
	// is for the controller model.
	IsController() bool
}

Backing describes the state methods used in this package.

type Bindings

type Bindings interface {
	// Map returns the space IDs for each bound endpoint.
	Map() map[string]string
}

Bindings describes a collection of endpoint bindings for an application.

type BlockChecker

type BlockChecker interface {
	ChangeAllowed() error
	RemoveAllowed() error
}

BlockChecker defines the block-checking functionality required by the spaces facade. This is implemented by apiserver/common.BlockChecker.

type Constraints

type Constraints interface {
	ID() string
	Value() constraints.Value
	ChangeSpaceNameOps(from, to string) []txn.Op
}

Constraints defines the methods supported by constraints used in the space context.

type EnvironSpaces

type EnvironSpaces interface {
	// ReloadSpaces loads spaces and subnets from provider specified by environ
	// into state.
	// Currently it's an append-only operation, no spaces/subnets are deleted.
	ReloadSpaces(context.ProviderCallContext, ReloadSpacesState, environs.BootstrapEnviron) error
}

EnvironSpaces defines methods for handling spaces within a environ setting.

type EnvironSpacesAdapter

type EnvironSpacesAdapter struct{}

EnvironSpacesAdapter allows the calling of ReloadSpaces from a type level, instead of a package level construct.

func (EnvironSpacesAdapter) ReloadSpaces

ReloadSpaces loads spaces and subnets from provider specified by environ into state. Currently it's an append-only operation, no spaces/subnets are deleted.

type Machine

type Machine interface {
	AllAddresses() ([]Address, error)
	Units() ([]Unit, error)
	AllSpaces() (set.Strings, error)
}

Machine defines the methods supported by a machine used in the space context.

type MoveSubnetsOp

type MoveSubnetsOp interface {
	state.ModelOperation

	// GetMovedSubnets returns the information for subnets that were
	// successfully moved as a result of applying this operation.
	GetMovedSubnets() []MovedSubnet
}

MoveSubnetsOp describes a model operation for moving subnets to a new space.

type MovedSubnet

type MovedSubnet struct {
	ID        string
	FromSpace string
	CIDR      string
}

MovedSubnet identifies a subnet and the space it was move from.

type MovingSubnet

type MovingSubnet interface {
	ID() string
	CIDR() string
	SpaceName() string
	SpaceID() string
	FanLocalUnderlay() string

	UpdateSpaceOps(spaceID string) []txn.Op
	Refresh() error
}

MovingSubnet describes a subnet that is to be relocated to a new space.

type OpFactory

type OpFactory interface {
	// NewRemoveSpaceOp returns an operation for removing a space.
	NewRemoveSpaceOp(fromName string) (state.ModelOperation, error)

	// NewRenameSpaceOp returns an operation for renaming a space.
	NewRenameSpaceOp(spaceName, toName string) (state.ModelOperation, error)

	// NewMoveSubnetsOp returns an operation for updating a space with new CIDRs.
	NewMoveSubnetsOp(spaceID string, subnets []MovingSubnet) (MoveSubnetsOp, error)
}

OpFactory describes a source of model operations required by the spaces API.

type ReloadSpaces

type ReloadSpaces interface {
	// ReloadSpaces refreshes spaces from the substrate.
	ReloadSpaces() error
}

ReloadSpaces offers a version 1 of the ReloadSpacesAPI.

type ReloadSpacesAPI

type ReloadSpacesAPI struct {
	// contains filtered or unexported fields
}

ReloadSpacesAPI provides the reload spaces API facade for version.

func NewReloadSpacesAPI

func NewReloadSpacesAPI(state ReloadSpacesState,
	environs ReloadSpacesEnviron,
	spaces EnvironSpaces,
	context context.ProviderCallContext,
	authorizer ReloadSpacesAuthorizer,
) *ReloadSpacesAPI

NewReloadSpacesAPI creates a new ReloadSpacesAPI.

func (*ReloadSpacesAPI) ReloadSpaces

func (api *ReloadSpacesAPI) ReloadSpaces() error

ReloadSpaces refreshes spaces from the substrate.

type ReloadSpacesAuthorizer

type ReloadSpacesAuthorizer func() error

ReloadSpacesAuthorizer represents a way to authorize reload spaces.

func DefaultReloadSpacesAuthorizer

func DefaultReloadSpacesAuthorizer(auth facade.Authorizer,
	check BlockChecker,
	state AuthorizerState,
) ReloadSpacesAuthorizer

DefaultReloadSpacesAuthorizer creates a new ReloadSpacesAuthorizer for handling reload spaces.

type ReloadSpacesEnviron

type ReloadSpacesEnviron interface {
	environs.EnvironConfigGetter

	// GetEnviron returns the environs.Environ ("provider") associated
	// with the model.
	GetEnviron(environs.EnvironConfigGetter, environs.NewEnvironFunc) (environs.Environ, error)
}

ReloadSpacesEnviron contains the methods for requesting environ data.

type ReloadSpacesEnvirons

type ReloadSpacesEnvirons struct {
	stateenvirons.EnvironConfigGetter
}

ReloadSpacesEnvirons returns a reload spaces environs type.

func DefaultReloadSpacesEnvirons

func DefaultReloadSpacesEnvirons(st *state.State) (ReloadSpacesEnvirons, error)

DefaultReloadSpacesEnvirons creates a new ReloadSpacesEnviron from state.

func (ReloadSpacesEnvirons) GetEnviron

GetEnviron returns the environs.Environ ("provider") associated with the model.

type ReloadSpacesState

type ReloadSpacesState interface {
	space.ReloadSpacesState
}

ReloadSpacesState contains all the methods required to execute the API.

type RemoveSpace

type RemoveSpace interface {
	Refresh() error
	RemoveSpaceOps() []txn.Op
}

RemoveSpace describes a space that can be removed.

type RenameSpace

type RenameSpace interface {
	Refresh() error
	Id() string
	Name() string
	RenameSpaceOps(toName string) []txn.Op
}

RenameSpace describes a space that can be renamed.

type RenameSpaceState

type RenameSpaceState interface {
	// ControllerConfig returns current ControllerConfig.
	ControllerConfig() (controller.Config, error)

	// ConstraintsBySpaceName returns all the constraints
	// that refer to the input space name.
	ConstraintsBySpaceName(spaceName string) ([]Constraints, error)
}

RenameSpaceState describes state operations required to execute the renameSpace operation.

type Settings

type Settings interface {
	DeltaOps(key string, delta settings.ItemChanges) ([]txn.Op, error)
}

Settings describes methods for interacting with settings to apply space-based configuration deltas.

type Subnet

type Subnet interface {
	UpdateSpaceOps(spaceID string) []txn.Op
}

type Unit

type Unit interface {
	Name() string
	ApplicationName() string
}

Unit is an indirection for state.Unit.