service

package
Version: v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: AGPL-3.0 Imports: 36 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 *zap.SugaredLogger) error

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

func NewFilesystemLayout added in v0.15.0

func NewFilesystemLayout(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService

NewFilesystemLayout returns a webservice for filesystem specific endpoints.

func NewFirewall

func NewFirewall(
	log *zap.SugaredLogger,
	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 *zap.SugaredLogger, ds *datastore.RethinkStore, s3Client *s3server.Client) (*restful.WebService, error)

NewFirmware returns a webservice for firmware specific endpoints.

func NewIP

NewIP returns a webservice for ip specific endpoints.

func NewImage

NewImage returns a webservice for image specific endpoints.

func NewMachine

func NewMachine(
	log *zap.SugaredLogger,
	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,
) (*restful.WebService, error)

NewMachine returns a webservice for machine specific endpoints.

func NewNetwork

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

NewNetwork returns a webservice for network specific endpoints.

func NewPartition

NewPartition returns a webservice for partition specific endpoints.

func NewProject

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

NewProject returns a webservice for project specific endpoints.

func NewSize

NewSize returns a webservice for size specific endpoints.

func NewSizeImageConstraint added in v0.16.3

func NewSizeImageConstraint(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService

NewSize returns a webservice for size specific endpoints.

func NewSwitch

NewSwitch returns a webservice for switch specific endpoints.

func NewTenant added in v0.14.0

func NewTenant(log *zap.SugaredLogger, mdc mdm.Client) *restful.WebService

NewTenant returns a webservice for tenant specific endpoints.

func NewUser added in v0.15.7

func NewUser(log *zap.SugaredLogger, userGetter security.UserGetter) *restful.WebService

NewUser returns a webservice for user specific endpoints.

func NewVPN added in v0.20.0

func NewVPN(
	log *zap.SugaredLogger,
	headscaleClient *headscale.HeadscaleClient,
) *restful.WebService

NewVPN returns a webservice for VPN specific endpoints.

func ResurrectMachines

func ResurrectMachines(ds *datastore.RethinkStore, publisher bus.Publisher, ep *bus.Endpoints, ipamer ipam.IPAMer, headscaleClient *headscale.HeadscaleClient, logger *zap.SugaredLogger) 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 *zap.SugaredLogger, 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