model

package
v0.0.0-...-ddee7fb Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignHostnameAndIP

func AssignHostnameAndIP(c context.Context, tx database.ExecerContext, hostname string, ipv4 common.IPv4) (int64, error)

AssignHostnameAndIP assigns the given hostname and IP address using the given transaction. The caller must commit or roll back the transaction appropriately.

func EnsureDatacenters

func EnsureDatacenters(c context.Context, cfgs []*config.Datacenter) (map[string]int64, error)

EnsureDatacenters ensures the database contains exactly the given datacenters. Returns a map of datacenter names to IDs in the database.

func EnsureIPs

func EnsureIPs(c context.Context, cfgs []*config.VLAN) error

EnsureIPs ensures the database contains exactly the given IP addresses.

func EnsureKVMs

func EnsureKVMs(c context.Context, cfgs []*config.Datacenter, platformIds, rackIds map[string]int64) (map[string]int64, error)

EnsureKVMs ensures the database contains exactly the given KVMs. Returns a map of KVM names to IDs in the database.

func EnsureOSes

func EnsureOSes(c context.Context, cfgs []*config.OS) error

EnsureOSes ensures the database contains exactly the given operating systems.

func EnsurePlatforms

func EnsurePlatforms(c context.Context, cfgs []*config.Platform) (map[string]int64, error)

EnsurePlatforms ensures the database contains exactly the given platforms. Returns a map of platform names to IDs.

func EnsureRackKVMs

func EnsureRackKVMs(c context.Context, cfgs []*config.Datacenter, kvmIds map[string]int64) error

EnsureRackKVMs ensures the database contains exactly the given rack kvm_ids.

func EnsureRacks

func EnsureRacks(c context.Context, cfgs []*config.Datacenter, datacenterIds map[string]int64) (map[string]int64, error)

EnsureRacks ensures the database contains exactly the given racks. Returns a map of rack names to IDs in the database.

func EnsureSwitches

func EnsureSwitches(c context.Context, cfgs []*config.Datacenter, rackIds map[string]int64) error

EnsureSwitches ensures the database contains exactly the given switches.

func EnsureVLANs

func EnsureVLANs(c context.Context, cfgs []*config.VLAN) error

EnsureVLANs ensures the database contains exactly the given VLANs.

Types

type Datacenter

type Datacenter struct {
	config.Datacenter
	Id int64
}

Datacenter represents a row in the datacenters table.

type DatacentersTable

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

DatacentersTable represents the table of datacenters in the database.

type IP

type IP struct {
	Id     int64
	IPv4   common.IPv4
	VLANId int64
}

IP represents a row in the ips table.

type IPsTable

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

IPsTable represents the table of IP addresses in the database.

type KVM

type KVM struct {
	config.KVM
	IPv4       common.IPv4
	MacAddress common.MAC48
	PlatformId int64
	RackId     int64
	Id         int64
	HostnameId int64
}

KVM represents a row in the kvms table.

type KVMsTable

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

KVMsTable represents the table of KVMs in the database.

type OS

type OS struct {
	config.OS
	Id int64
}

OS represents a row in the oses table.

type OSesTable

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

OSesTable represents the table of operating systems in the database.

type Platform

type Platform struct {
	config.Platform
	Id int64
}

Platform represents a row in the platforms table.

type PlatformsTable

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

PlatformsTable represents the table of platforms in the database.

type Rack

type Rack struct {
	config.Rack
	DatacenterId int64
	Id           int64
}

Rack represents a row in the racks table.

type RackKVM

type RackKVM struct {
	config.Rack
	Id    int64
	KVMId sql.NullInt64
}

RackKVM represents a kvm_id column in a row in the racks table.

type RackKVMsTable

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

RackKVMsTable represents the table of kvm_ids for racks in the database.

type RacksTable

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

RacksTable represents the table of racks in the database.

type Switch

type Switch struct {
	config.Switch
	RackId int64
	Id     int64
}

Switch represents a row in the switches table.

type SwitchesTable

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

SwitchesTable represents the table of switches in the database.

type VLAN

type VLAN struct {
	config.VLAN
}

VLAN represents a row in the vlans table.

type VLANsTable

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

VLANsTable represents the table of VLANs in the database.

Jump to

Keyboard shortcuts

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