Documentation ¶
Index ¶
- type Provider
- type ProviderService
- type ProviderSpaces
- type Service
- func (s *Service) AddSpace(ctx context.Context, space network.SpaceInfo) (network.Id, error)
- func (s *Service) AddSubnet(ctx context.Context, args network.SubnetInfo) (network.Id, error)
- func (s *Service) GetAllSpaces(ctx context.Context) (network.SpaceInfos, error)
- func (s *Service) GetAllSubnets(ctx context.Context) (network.SubnetInfos, error)
- func (s *Service) RemoveSpace(ctx context.Context, uuid string) error
- func (s *Service) RemoveSubnet(ctx context.Context, uuid string) error
- func (s *Service) Space(ctx context.Context, uuid string) (*network.SpaceInfo, error)
- func (s *Service) SpaceByName(ctx context.Context, name string) (*network.SpaceInfo, error)
- func (s *Service) Subnet(ctx context.Context, uuid string) (*network.SubnetInfo, error)
- func (s *Service) SubnetsByCIDR(ctx context.Context, cidrs ...string) ([]network.SubnetInfo, error)
- func (s *Service) UpdateSpace(ctx context.Context, uuid string, name string) error
- func (s *Service) UpdateSubnet(ctx context.Context, uuid, spaceUUID string) error
- type SpaceState
- type State
- type SubnetState
- type WatchableService
- type WatcherFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider interface { environs.Networking }
Provider is the interface that the network service requires to be able to interact with the underlying provider.
type ProviderService ¶
type ProviderService struct { Service // contains filtered or unexported fields }
ProviderService provides the API for working with network spaces.
func NewProviderService ¶
func NewProviderService( st State, provider providertracker.ProviderGetter[Provider], logger logger.Logger, ) *ProviderService
NewProviderService returns a new service reference wrapping the input state.
func (*ProviderService) ReloadSpaces ¶
func (s *ProviderService) ReloadSpaces(ctx context.Context) error
ReloadSpaces loads spaces and subnets from the provider into state.
func (*ProviderService) SupportsSpaceDiscovery ¶
func (s *ProviderService) SupportsSpaceDiscovery(ctx context.Context) (bool, error)
SupportsSpaceDiscovery returns whether the provider supports discovering spaces from the provider.
func (*ProviderService) SupportsSpaces ¶
func (s *ProviderService) SupportsSpaces(ctx context.Context) (bool, error)
SupportsSpaces returns whether the provider supports spaces.
type ProviderSpaces ¶
type ProviderSpaces struct {
// contains filtered or unexported fields
}
ProviderSpaces defines a set of operations to perform when dealing with provider spaces. SaveSpaces, DeleteSpaces are operations for setting state in the persistence layer.
func NewProviderSpaces ¶
func NewProviderSpaces(spaceService *ProviderService, logger logger.Logger) *ProviderSpaces
NewProviderSpaces creates a new ProviderSpaces to perform a series of operations.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides the API for working with spaces.
func NewService ¶
NewService returns a new service reference wrapping the input state.
func (*Service) GetAllSpaces ¶
GetAllSpaces returns all spaces for the model.
func (*Service) GetAllSubnets ¶
GetAllSubnets returns all the subnets for the model.
func (*Service) RemoveSpace ¶
RemoveSpace deletes a space identified by its uuid. If the space is not found, an error is returned matching github.com/juju/juju/domain/network/errors.SpaceNotFound.
func (*Service) RemoveSubnet ¶
Remove deletes a subnet identified by its uuid.
func (*Service) Space ¶
Space returns a space from state that matches the input ID. If the space is not found, an error is returned matching github.com/juju/juju/domain/network/errors.SpaceNotFound.
func (*Service) SpaceByName ¶
SpaceByName returns a space from state that matches the input name. If the space is not found, an error is returned matching github.com/juju/juju/domain/network/errors.SpaceNotFound.
func (*Service) Subnet ¶
Subnet returns the subnet identified by the input UUID, or an error if it is not found.
func (*Service) SubnetsByCIDR ¶
SubnetsByCIDR returns the subnets matching the input CIDRs.
func (*Service) UpdateSpace ¶
UpdateSpace updates the space name identified by the passed uuid. If the space is not found, an error is returned matching github.com/juju/juju/domain/network/errors.SpaceNotFound.
type SpaceState ¶
type SpaceState interface { // AddSpace creates a space. AddSpace(ctx context.Context, uuid string, name string, providerID network.Id, subnetIDs []string) error // GetSpace returns the space by UUID. If the space is not found, an error // is returned matching // [github.com/juju/juju/domain/network/errors.SpaceNotFound]. GetSpace(ctx context.Context, uuid string) (*network.SpaceInfo, error) // GetSpaceByName returns the space by name. If the space is not found, an // error is returned matching // [github.com/juju/juju/domain/network/errors.SpaceNotFound]. GetSpaceByName(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 identified by the passed uuid. If the // space is not found, an error is returned matching // [github.com/juju/juju/domain/network/errors.SpaceNotFound]. UpdateSpace(ctx context.Context, uuid string, name string) error // DeleteSpace deletes the space identified by the passed uuid. If the // space is not found, an error is returned matching // [github.com/juju/juju/domain/network/errors.SpaceNotFound]. DeleteSpace(ctx context.Context, uuid string) error }
SpaceState describes persistence layer methods for the space (sub-) domain.
type State ¶
type State interface { SpaceState SubnetState }
State describes retrieval and persistence methods needed for the network domain service.
type SubnetState ¶
type SubnetState interface { // AddSubnet creates a subnet. AddSubnet(ctx context.Context, subnet network.SubnetInfo) error // GetAllSubnets returns all known subnets in the model. GetAllSubnets(ctx context.Context) (network.SubnetInfos, error) // GetSubnet returns the subnet by UUID. GetSubnet(ctx context.Context, uuid string) (*network.SubnetInfo, error) // GetSubnetsByCIDR returns the subnets by CIDR. // Deprecated, this method should be removed when we re-work the API // for moving subnets. GetSubnetsByCIDR(ctx context.Context, cidrs ...string) (network.SubnetInfos, error) // UpdateSubnet updates the subnet identified by the passed uuid. UpdateSubnet(ctx context.Context, uuid string, spaceID string) error // DeleteSubnet deletes the subnet identified by the passed uuid. DeleteSubnet(ctx context.Context, uuid string) error // UpsertSubnets updates or adds each one of the provided subnets in one // transaction. UpsertSubnets(ctx context.Context, subnets []network.SubnetInfo) error // AllSubnetsQuery returns the SQL query that finds all subnet UUIDs from the // subnet table, needed for the subnets watcher. AllSubnetsQuery(ctx context.Context, db database.TxnRunner) ([]string, error) }
SubnetState describes persistence layer methods for the subnet (sub-) domain.
type WatchableService ¶
type WatchableService struct { ProviderService // contains filtered or unexported fields }
WatchableService provides the API for working with external controllers and the ability to create watchers.
func NewWatchableService ¶
func NewWatchableService(st State, provider providertracker.ProviderGetter[Provider], watcherFactory WatcherFactory, logger logger.Logger) *WatchableService
NewWatchableService returns a new watchable service reference wrapping the input state and provider.
func (*WatchableService) WatchSubnets ¶
func (s *WatchableService) WatchSubnets(ctx context.Context, subnetUUIDsToWatch set.Strings) (watcher.StringsWatcher, error)
Watch returns a watcher that observes changes to subnets and their association (fan underlays), filtered based on the provided list of subnets to watch.
type WatcherFactory ¶
type WatcherFactory interface { // NewNamespaceMapperWatcher returns a new namespace watcher // for events based on the input change mask and mapper. NewNamespaceMapperWatcher(namespace string, changeMask changestream.ChangeType, initialStateQuery eventsource.NamespaceQuery, mapper eventsource.Mapper) (watcher.StringsWatcher, error) }
WatcherFactory describes methods for creating watchers.