spaces

package
v0.0.0-...-b9bb202 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStateShim

func NewStateShim(st *state.State, cloudService common.CloudService, credentialService common.CredentialService, modelConfigService common.ModelConfigService) (*stateShim, error)

NewStateShim returns a new state shim.

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type API

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

API provides the spaces API facade for version 6.

func (*API) CreateSpaces

func (api *API) CreateSpaces(ctx context.Context, 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(ctx context.Context) (results params.ListSpacesResults, err error)

ListSpaces lists all the available spaces and their associated subnets.

func (*API) MoveSubnets

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

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

func (*API) ReloadSpaces

func (api *API) ReloadSpaces(ctx context.Context) error

ReloadSpaces refreshes spaces from substrate

func (*API) RemoveSpace

func (api *API) RemoveSpace(ctx context.Context, 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(ctx context.Context, args params.RenameSpacesParams) (params.ErrorResults, error)

RenameSpace renames a space.

func (*API) ShowSpace

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

ShowSpace shows the spaces for a set of given entities.

type Address

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

Address is an indirection for state.Address.

type Backing

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

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

	// 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(context.Context) error
	RemoveAllowed(context.Context) 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 ControllerConfigService

type ControllerConfigService interface {
	ControllerConfig(context.Context) (controller.Config, error)
}

ControllerConfigService is an interface that provides controller configuration.

type Machine

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

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

type NetworkService

type NetworkService interface {
	// AddSpace creates and returns a new space.
	AddSpace(ctx context.Context, space network.SpaceInfo) (network.Id, error)
	// Space returns a space from state that matches the input ID. If the space
	// is not found, an error is returned satisfying
	// [github.com/juju/juju/domain/network/errors.SpaceNotFound].
	Space(ctx context.Context, uuid string) (*network.SpaceInfo, error)
	// SpaceByName returns a space from state that matches the input name. If
	// the space is not found, an error is returned satisfying
	// [github.com/juju/juju/domain/network/errors.SpaceNotFound].
	SpaceByName(ctx context.Context, name string) (*network.SpaceInfo, error)
	// GetAllSpaces returns all spaces for the model.
	GetAllSpaces(ctx context.Context) (network.SpaceInfos, error)
	// UpdateSpace updates the space name identified by the passed uuid. If
	// the space is not found, an error is returned satisfying
	// [github.com/juju/juju/domain/network/errors.SpaceNotFound].
	UpdateSpace(ctx context.Context, uuid string, name string) error
	// RemoveSpace deletes a space identified by its uuid. If the space is not
	// found, an error is returned satisfying
	// [github.com/juju/juju/domain/network/errors.SpaceNotFound].
	RemoveSpace(ctx context.Context, uuid string) error
	// ReloadSpaces loads spaces and subnets from the provider into state.
	ReloadSpaces(ctx context.Context) error
	// GetAllSubnets returns all the subnets for the model.
	GetAllSubnets(ctx context.Context) (network.SubnetInfos, error)
	// SubnetsByCIDR returns the subnets matching the input CIDRs.
	SubnetsByCIDR(ctx context.Context, cidrs ...string) ([]network.SubnetInfo, error)
	// Subnet returns the subnet identified by the input UUID,
	// or an error if it is not found.
	Subnet(ctx context.Context, uuid string) (*network.SubnetInfo, error)
	// UpdateSubnet updates the spaceUUID of the subnet identified by the input
	// UUID.
	UpdateSubnet(ctx context.Context, uuid, spaceUUID string) error
	// SupportsSpaces returns whether the current environment supports spaces.
	SupportsSpaces(ctx context.Context) (bool, error)
	// SupportsSpaceDiscovery returns whether the current environment supports
	// discovering spaces from the provider.
	SupportsSpaceDiscovery(ctx context.Context) (bool, error)
}

NetworkService is the interface that is used to interact with the network spaces/subnets.

type Unit

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

Unit is an indirection for state.Unit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL