service

package
v0.28.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ASNMin is the minimum asn defined according to
	// https://en.wikipedia.org/wiki/Autonomous_system_(Internet)
	ASNMin = uint32(4200000000)

	// ASNBase is the offset for all Machine ASN´s
	ASNBase = uint32(4210000000)

	// ASNMax defines the maximum allowed asn
	// https://en.wikipedia.org/wiki/Autonomous_system_(Internet)
	ASNMax = uint32(4294967294)
)

Variables

View Source
var BasePath = "/"

BasePath is the URL base path for the metal-api

Functions

func MachineLiveliness added in v0.5.7

func MachineLiveliness(ds *datastore.RethinkStore, logger *slog.Logger) error

MachineLiveliness evaluates whether machines are still alive or if they have died

func NewAudit added in v0.22.4

func NewAudit(log *slog.Logger, a auditing.Auditing) *restful.WebService

func NewFilesystemLayout added in v0.15.0

func NewFilesystemLayout(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService

NewFilesystemLayout returns a webservice for filesystem specific endpoints.

func NewFirewall

func NewFirewall(
	log *slog.Logger,
	ds *datastore.RethinkStore,
	pub bus.Publisher,
	ipamer ipam.IPAMer,
	ep *bus.Endpoints,
	mdc mdm.Client,
	userGetter security.UserGetter,
	headscaleClient *headscale.HeadscaleClient,
) (*restful.WebService, error)

NewFirewall returns a webservice for firewall specific endpoints.

func NewFirmware added in v0.13.1

func NewFirmware(log *slog.Logger, ds *datastore.RethinkStore, s3Client *s3server.Client) (*restful.WebService, error)

NewFirmware returns a webservice for firmware specific endpoints.

func NewIP

func NewIP(log *slog.Logger, ds *datastore.RethinkStore, ep *bus.Endpoints, ipamer ipam.IPAMer, mdc mdm.Client) (*restful.WebService, error)

NewIP returns a webservice for ip specific endpoints.

func NewImage

func NewImage(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService

NewImage returns a webservice for image specific endpoints.

func NewMachine

func NewMachine(
	log *slog.Logger,
	ds *datastore.RethinkStore,
	pub bus.Publisher,
	ep *bus.Endpoints,
	ipamer ipam.IPAMer,
	mdc mdm.Client,
	s3Client *s3server.Client,
	userGetter security.UserGetter,
	reasonMinLength uint,
	headscaleClient *headscale.HeadscaleClient,
	ipmiSuperUser metal.MachineIPMISuperUser,
) (*restful.WebService, error)

NewMachine returns a webservice for machine specific endpoints.

func NewNetwork

func NewNetwork(log *slog.Logger, ds *datastore.RethinkStore, ipamer ipam.IPAMer, mdc mdm.Client) *restful.WebService

NewNetwork returns a webservice for network specific endpoints.

func NewPartition

func NewPartition(log *slog.Logger, ds *datastore.RethinkStore, tc TopicCreator) *restful.WebService

NewPartition returns a webservice for partition specific endpoints.

func NewProject

func NewProject(log *slog.Logger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService

NewProject returns a webservice for project specific endpoints.

func NewSize

func NewSize(log *slog.Logger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService

NewSize returns a webservice for size specific endpoints.

func NewSizeImageConstraint added in v0.16.3

func NewSizeImageConstraint(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService

NewSize returns a webservice for size specific endpoints.

func NewSwitch

func NewSwitch(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService

NewSwitch returns a webservice for switch specific endpoints.

func NewTenant added in v0.14.0

func NewTenant(log *slog.Logger, mdc mdm.Client) *restful.WebService

NewTenant returns a webservice for tenant specific endpoints.

func NewUser added in v0.15.7

func NewUser(log *slog.Logger, userGetter security.UserGetter) *restful.WebService

NewUser returns a webservice for user specific endpoints.

func NewVPN added in v0.20.0

func NewVPN(
	log *slog.Logger,
	headscaleClient *headscale.HeadscaleClient,
) *restful.WebService

NewVPN returns a webservice for VPN specific endpoints.

func ResurrectMachines

func ResurrectMachines(ctx context.Context, ds *datastore.RethinkStore, publisher bus.Publisher, ep *bus.Endpoints, ipamer ipam.IPAMer, headscaleClient *headscale.HeadscaleClient, logger *slog.Logger) error

ResurrectMachines attempts to resurrect machines that are obviously dead

Types

type Allocation

type Allocation <-chan MachineAllocation

An Allocation is a queue of allocated machines. You can read the machines to get the next allocated one.

type Allocator

type Allocator func(Allocation) error

An Allocator is a callback for some piece of code if this wants to read allocated machines.

type MachineAllocation

type MachineAllocation struct {
	Machine *metal.Machine
	Err     error
}

The MachineAllocation contains the allocated machine or an error.

type TenantEnsurer

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

TenantEnsurer holds allowed tenants and a list of path suffixes that

func NewTenantEnsurer

func NewTenantEnsurer(log *slog.Logger, tenants, excludedPathSuffixes []string) TenantEnsurer

NewTenantEnsurer creates a new ensurer with the given tenants.

func (*TenantEnsurer) EnsureAllowedTenantFilter

func (e *TenantEnsurer) EnsureAllowedTenantFilter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain)

EnsureAllowedTenantFilter checks if the tenant of the user is allowed.

type TopicCreator added in v0.8.0

type TopicCreator interface {
	CreateTopic(topicFQN string) error
}

TopicCreator creates a topic for messaging.

type UserDirectory

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

UserDirectory is the directory of users

func NewUserDirectory

func NewUserDirectory(providerTenant string) *UserDirectory

NewUserDirectory creates a new user directory with default users

func (*UserDirectory) Get

func (ud *UserDirectory) Get(user string) security.User

Get a user by its user name.

func (*UserDirectory) UserNames

func (ud *UserDirectory) UserNames() []string

UserNames returns the list of user names in the directory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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