cluster

package
v6.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNone        = DeviceType(0)
	TypeNIC         = DeviceType(1)
	TypeDisk        = DeviceType(2)
	TypeUnixChar    = DeviceType(3)
	TypeUnixBlock   = DeviceType(4)
	TypeUSB         = DeviceType(5)
	TypeGPU         = DeviceType(6)
	TypeInfiniband  = DeviceType(7)
	TypeProxy       = DeviceType(8)
	TypeUnixHotplug = DeviceType(9)
	TypeTPM         = DeviceType(10)
	TypePCI         = DeviceType(11)
)

Supported device types.

View Source
const (
	TypeContainer             = 0
	TypeImage                 = 1
	TypeProfile               = 2
	TypeProject               = 3
	TypeCertificate           = 4
	TypeInstance              = 5
	TypeInstanceBackup        = 6
	TypeInstanceSnapshot      = 7
	TypeNetwork               = 8
	TypeNetworkACL            = 9
	TypeNode                  = 10
	TypeOperation             = 11
	TypeStoragePool           = 12
	TypeStorageVolume         = 13
	TypeStorageVolumeBackup   = 14
	TypeStorageVolumeSnapshot = 15
	TypeWarning               = 16
	TypeClusterGroup          = 17
	TypeStorageBucket         = 18
)

Numeric type codes identifying different kind of entities.

View Source
const (
	// NetworkPeerTypeLocal represents a local peer connection.
	NetworkPeerTypeLocal = iota

	// NetworkPeerTypeRemote represents a remote peer connection.
	NetworkPeerTypeRemote
)
View Source
const (
	// NetworkIntegrationTypeOVN represents an OVN network integration.
	NetworkIntegrationTypeOVN = iota
)

Variables

View Source
var (
	// ErrNotFound is the error returned, if the entity is not found in the DB.
	ErrNotFound = errors.New("Not found")

	// ErrConflict is the error returned, if the adding or updating an entity
	// causes a conflict with an existing entity.
	ErrConflict = errors.New("Conflict")
)
View Source
var EntityNames = map[int]string{
	TypeCertificate:           "certificate",
	TypeClusterGroup:          "cluster group",
	TypeContainer:             "container",
	TypeImage:                 "image",
	TypeInstanceBackup:        "instance backup",
	TypeInstance:              "instance",
	TypeInstanceSnapshot:      "instance snapshot",
	TypeNetworkACL:            "network acl",
	TypeNetwork:               "network",
	TypeNode:                  "node",
	TypeOperation:             "operation",
	TypeProfile:               "profile",
	TypeProject:               "project",
	TypeStorageBucket:         "storage bucket",
	TypeStoragePool:           "storage pool",
	TypeStorageVolumeBackup:   "storage volume backup",
	TypeStorageVolumeSnapshot: "storage volume snapshot",
	TypeStorageVolume:         "storage volume",
	TypeWarning:               "warning",
}

EntityNames associates an entity code to its name.

View Source
var EntityTypes = map[string]int{}

EntityTypes associates an entity name to its type code.

View Source
var EntityURIs = map[int]string{
	TypeCertificate:           "/" + version.APIVersion + "/certificates/%s",
	TypeClusterGroup:          "/" + version.APIVersion + "/cluster/groups/%s",
	TypeContainer:             "/" + version.APIVersion + "/containers/%s?project=%s",
	TypeImage:                 "/" + version.APIVersion + "/images/%s?project=%s",
	TypeInstanceBackup:        "/" + version.APIVersion + "/instances/%s/backups/%s?project=%s",
	TypeInstanceSnapshot:      "/" + version.APIVersion + "/instances/%s/snapshots/%s?project=%s",
	TypeInstance:              "/" + version.APIVersion + "/instances/%s?project=%s",
	TypeNetworkACL:            "/" + version.APIVersion + "/network-acls/%s?project=%s",
	TypeNetwork:               "/" + version.APIVersion + "/networks/%s?project=%s",
	TypeNode:                  "/" + version.APIVersion + "/cluster/members/%s",
	TypeOperation:             "/" + version.APIVersion + "/operations/%s",
	TypeProfile:               "/" + version.APIVersion + "/profiles/%s?project=%s",
	TypeProject:               "/" + version.APIVersion + "/projects/%s",
	TypeStorageBucket:         "/" + version.APIVersion + "/storage-pools/%s/buckets/%s?project=%s",
	TypeStoragePool:           "/" + version.APIVersion + "/storage-pools/%s",
	TypeStorageVolumeBackup:   "/" + version.APIVersion + "/storage-pools/%s/volumes/%s/%s/backups/%s?project=%s",
	TypeStorageVolumeSnapshot: "/" + version.APIVersion + "/storage-pools/%s/volumes/%s/%s/snapshots/%s?project=%s",
	TypeStorageVolume:         "/" + version.APIVersion + "/storage-pools/%s/volumes/%s/%s?project=%s",
	TypeWarning:               "/" + version.APIVersion + "/warnings/%s",
}

EntityURIs associates an entity code to its URI pattern.

View Source
var NetworkIntegrationTypeNames = map[int]string{
	NetworkIntegrationTypeOVN: "ovn",
}

NetworkIntegrationTypeNames is a map between DB type to their string representation.

View Source
var NetworkPeerTypeNames = map[int]string{
	NetworkPeerTypeLocal:  "local",
	NetworkPeerTypeRemote: "remote",
}

NetworkPeerTypeNames maps peer types (integers) to their API representation (string).

NetworkPeerTypes maps peer strings to their internal representation (integers).

View Source
var PreparedStmts = map[int]*sql.Stmt{}

PreparedStmts is a placeholder for transitioning to package-scoped transaction functions.

View Source
var ProjectFeatures = map[string]ProjectFeature{
	"features.images": {
		DefaultEnabled: true,
	},
	"features.profiles": {
		DefaultEnabled: true,
	},
	"features.storage.volumes": {
		DefaultEnabled: true,
	},
	"features.storage.buckets": {
		DefaultEnabled: true,
	},
	"features.networks": {},
	"features.networks.zones": {
		CanEnableNonEmpty: true,
	},
}

ProjectFeatures lists available project features and their behaviours.

View Source
var SchemaVersion = len(updates)

SchemaVersion is the current version of the cluster database schema.

Functions

func APIToDevices

func APIToDevices(apiDevices map[string]map[string]string) (map[string]Device, error)

APIToDevices takes an API format devices map and converts it to a map of db.Device.

func CertificateExists

func CertificateExists(ctx context.Context, db dbtx, fingerprint string) (_ bool, _err error)

CertificateExists checks if a certificate with the given key exists. generator: certificate Exists

func ClusterGroupExists

func ClusterGroupExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

ClusterGroupExists checks if a cluster_group with the given key exists. generator: cluster_group Exists

func CreateCertificate

func CreateCertificate(ctx context.Context, db dbtx, object Certificate) (_ int64, _err error)

CreateCertificate adds a new certificate to the database. generator: certificate Create

func CreateCertificateProjects

func CreateCertificateProjects(ctx context.Context, db tx, objects []CertificateProject) (_err error)

CreateCertificateProjects adds a new certificate_project to the database. generator: certificate_project Create

func CreateCertificateWithProjects

func CreateCertificateWithProjects(ctx context.Context, tx *sql.Tx, cert Certificate, projectNames []string) (int64, error)

CreateCertificateWithProjects stores a CertInfo object in the db, and associates it to a list of project names. It will ignore the ID field from the CertInfo.

func CreateClusterGroup

func CreateClusterGroup(ctx context.Context, db dbtx, object ClusterGroup) (_ int64, _err error)

CreateClusterGroup adds a new cluster_group to the database. generator: cluster_group Create

func CreateClusterGroupConfig added in v6.4.0

func CreateClusterGroupConfig(ctx context.Context, db dbtx, clusterGroupID int64, config map[string]string) (_err error)

CreateClusterGroupConfig adds new cluster_group Config to the database. generator: cluster_group Create

func CreateConfig

func CreateConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, object Config) (_err error)

CreateConfig adds a new config to the database. generator: config Create

func CreateDevices

func CreateDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, objects map[string]Device) (_err error)

CreateDevices adds a new device to the database. generator: device Create

func CreateInstance

func CreateInstance(ctx context.Context, db dbtx, object Instance) (_ int64, _err error)

CreateInstance adds a new instance to the database. generator: instance Create

func CreateInstanceConfig

func CreateInstanceConfig(ctx context.Context, db dbtx, instanceID int64, config map[string]string) (_err error)

CreateInstanceConfig adds new instance Config to the database. generator: instance Create

func CreateInstanceDevices

func CreateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) (_err error)

CreateInstanceDevices adds new instance Devices to the database. generator: instance Create

func CreateInstanceProfiles

func CreateInstanceProfiles(ctx context.Context, db tx, objects []InstanceProfile) (_err error)

CreateInstanceProfiles adds a new instance_profile to the database. generator: instance_profile Create

func CreateInstanceSnapshot

func CreateInstanceSnapshot(ctx context.Context, db dbtx, object InstanceSnapshot) (_ int64, _err error)

CreateInstanceSnapshot adds a new instance_snapshot to the database. generator: instance_snapshot Create

func CreateInstanceSnapshotConfig

func CreateInstanceSnapshotConfig(ctx context.Context, db dbtx, instanceSnapshotID int64, config map[string]string) (_err error)

CreateInstanceSnapshotConfig adds new instance_snapshot Config to the database. generator: instance_snapshot Create

func CreateInstanceSnapshotDevices

func CreateInstanceSnapshotDevices(ctx context.Context, db tx, instanceSnapshotID int64, devices map[string]Device) (_err error)

CreateInstanceSnapshotDevices adds new instance_snapshot Devices to the database. generator: instance_snapshot Create

func CreateNetworkACL added in v6.0.5

func CreateNetworkACL(ctx context.Context, db dbtx, object NetworkACL) (_ int64, _err error)

CreateNetworkACL adds a new NetworkACL to the database. generator: NetworkACL Create

func CreateNetworkACLConfig added in v6.0.5

func CreateNetworkACLConfig(ctx context.Context, db dbtx, networkACLID int64, config map[string]string) (_err error)

CreateNetworkACLConfig adds new NetworkACL Config to the database. generator: NetworkACL Create

func CreateNetworkAddressSet added in v6.12.0

func CreateNetworkAddressSet(ctx context.Context, db dbtx, object NetworkAddressSet) (_ int64, _err error)

CreateNetworkAddressSet adds a new network_address_set to the database. generator: network_address_set Create

func CreateNetworkAddressSetConfig added in v6.12.0

func CreateNetworkAddressSetConfig(ctx context.Context, db dbtx, networkAddressSetID int64, config map[string]string) (_err error)

CreateNetworkAddressSetConfig adds new network_address_set Config to the database. generator: network_address_set Create

func CreateNetworkForward added in v6.0.5

func CreateNetworkForward(ctx context.Context, db dbtx, object NetworkForward) (_ int64, _err error)

CreateNetworkForward adds a new network_forward to the database. generator: network_forward Create

func CreateNetworkForwardConfig added in v6.0.5

func CreateNetworkForwardConfig(ctx context.Context, db dbtx, networkForwardID int64, config map[string]string) (_err error)

CreateNetworkForwardConfig adds new network_forward Config to the database. generator: network_forward Create

func CreateNetworkIntegration

func CreateNetworkIntegration(ctx context.Context, db dbtx, object NetworkIntegration) (_ int64, _err error)

CreateNetworkIntegration adds a new network_integration to the database. generator: network_integration Create

func CreateNetworkIntegrationConfig

func CreateNetworkIntegrationConfig(ctx context.Context, db dbtx, networkIntegrationID int64, config map[string]string) (_err error)

CreateNetworkIntegrationConfig adds new network_integration Config to the database. generator: network_integration Create

func CreateNetworkLoadBalancer added in v6.0.5

func CreateNetworkLoadBalancer(ctx context.Context, db dbtx, object NetworkLoadBalancer) (_ int64, _err error)

CreateNetworkLoadBalancer adds a new network_load_balancer to the database. generator: network_load_balancer Create

func CreateNetworkLoadBalancerConfig added in v6.0.5

func CreateNetworkLoadBalancerConfig(ctx context.Context, db dbtx, networkLoadBalancerID int64, config map[string]string) (_err error)

CreateNetworkLoadBalancerConfig adds new network_load_balancer Config to the database. generator: network_load_balancer Create

func CreateNetworkPeer added in v6.0.5

func CreateNetworkPeer(ctx context.Context, db dbtx, object NetworkPeer) (_ int64, _err error)

CreateNetworkPeer adds a new network_peer to the database. generator: network_peer Create

func CreateNetworkPeerConfig added in v6.0.5

func CreateNetworkPeerConfig(ctx context.Context, db dbtx, networkPeerID int64, config map[string]string) (_err error)

CreateNetworkPeerConfig adds new network_peer Config to the database. generator: network_peer Create

func CreateNetworkZone added in v6.0.5

func CreateNetworkZone(ctx context.Context, db dbtx, object NetworkZone) (_ int64, _err error)

CreateNetworkZone adds a new NetworkZone to the database. generator: NetworkZone Create

func CreateNetworkZoneConfig added in v6.0.5

func CreateNetworkZoneConfig(ctx context.Context, db dbtx, networkZoneID int64, config map[string]string) (_err error)

CreateNetworkZoneConfig adds new NetworkZone Config to the database. generator: NetworkZone Create

func CreateNetworkZoneRecord added in v6.0.5

func CreateNetworkZoneRecord(ctx context.Context, db dbtx, object NetworkZoneRecord) (_ int64, _err error)

CreateNetworkZoneRecord adds a new NetworkZoneRecord to the database. generator: NetworkZoneRecord Create

func CreateNetworkZoneRecordConfig added in v6.0.5

func CreateNetworkZoneRecordConfig(ctx context.Context, db dbtx, networkZoneRecordID int64, config map[string]string) (_err error)

CreateNetworkZoneRecordConfig adds new NetworkZoneRecord Config to the database. generator: NetworkZoneRecord Create

func CreateNodeClusterGroup

func CreateNodeClusterGroup(ctx context.Context, db dbtx, object NodeClusterGroup) (_ int64, _err error)

CreateNodeClusterGroup adds a new node_cluster_group to the database. generator: node_cluster_group Create

func CreateOrReplaceOperation

func CreateOrReplaceOperation(ctx context.Context, db dbtx, object Operation) (_ int64, _err error)

CreateOrReplaceOperation adds a new operation to the database. generator: operation CreateOrReplace

func CreateProfile

func CreateProfile(ctx context.Context, db dbtx, object Profile) (_ int64, _err error)

CreateProfile adds a new profile to the database. generator: profile Create

func CreateProfileConfig

func CreateProfileConfig(ctx context.Context, db dbtx, profileID int64, config map[string]string) (_err error)

CreateProfileConfig adds new profile Config to the database. generator: profile Create

func CreateProfileDevices

func CreateProfileDevices(ctx context.Context, db tx, profileID int64, devices map[string]Device) (_err error)

CreateProfileDevices adds new profile Devices to the database. generator: profile Create

func CreateProject

func CreateProject(ctx context.Context, db dbtx, object Project) (_ int64, _err error)

CreateProject adds a new project to the database. generator: project Create

func CreateProjectConfig

func CreateProjectConfig(ctx context.Context, db dbtx, projectID int64, config map[string]string) (_err error)

CreateProjectConfig adds new project Config to the database. generator: project Create

func DeleteCertificate

func DeleteCertificate(ctx context.Context, db dbtx, fingerprint string) (_err error)

DeleteCertificate deletes the certificate matching the given key parameters. generator: certificate DeleteOne-by-Fingerprint

func DeleteCertificateProjects

func DeleteCertificateProjects(ctx context.Context, db tx, certificateID int) (_err error)

DeleteCertificateProjects deletes the certificate_project matching the given key parameters. generator: certificate_project DeleteMany

func DeleteCertificates

func DeleteCertificates(ctx context.Context, db dbtx, name string, certificateType certificate.Type) (_err error)

DeleteCertificates deletes the certificate matching the given key parameters. generator: certificate DeleteMany-by-Name-and-Type

func DeleteClusterGroup

func DeleteClusterGroup(ctx context.Context, db dbtx, name string) (_err error)

DeleteClusterGroup deletes the cluster_group matching the given key parameters. generator: cluster_group DeleteOne-by-Name

func DeleteConfig

func DeleteConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, referenceID int) (_err error)

DeleteConfig deletes the config matching the given key parameters. generator: config DeleteMany

func DeleteDevices

func DeleteDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, referenceID int) (_err error)

DeleteDevices deletes the device matching the given key parameters. generator: device DeleteMany

func DeleteInstance

func DeleteInstance(ctx context.Context, db dbtx, project string, name string) (_err error)

DeleteInstance deletes the instance matching the given key parameters. generator: instance DeleteOne-by-Project-and-Name

func DeleteInstanceProfiles

func DeleteInstanceProfiles(ctx context.Context, db tx, instanceID int) (_err error)

DeleteInstanceProfiles deletes the instance_profile matching the given key parameters. generator: instance_profile DeleteMany

func DeleteInstanceSnapshot

func DeleteInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string) (_err error)

DeleteInstanceSnapshot deletes the instance_snapshot matching the given key parameters. generator: instance_snapshot DeleteOne-by-Project-and-Instance-and-Name

func DeleteNetworkACL added in v6.0.5

func DeleteNetworkACL(ctx context.Context, db dbtx, id int) (_err error)

DeleteNetworkACL deletes the NetworkACL matching the given key parameters. generator: NetworkACL DeleteOne-by-ID

func DeleteNetworkAddressSet added in v6.12.0

func DeleteNetworkAddressSet(ctx context.Context, db dbtx, project string, name string) (_err error)

DeleteNetworkAddressSet deletes the network_address_set matching the given key parameters. generator: network_address_set DeleteOne-by-Project-and-Name

func DeleteNetworkForward added in v6.0.5

func DeleteNetworkForward(ctx context.Context, db dbtx, networkID int64, id int64) (_err error)

DeleteNetworkForward deletes the network_forward matching the given key parameters. generator: network_forward DeleteOne-by-NetworkID-and-ID

func DeleteNetworkIntegration

func DeleteNetworkIntegration(ctx context.Context, db dbtx, name string) (_err error)

DeleteNetworkIntegration deletes the network_integration matching the given key parameters. generator: network_integration DeleteOne-by-Name

func DeleteNetworkLoadBalancer added in v6.0.5

func DeleteNetworkLoadBalancer(ctx context.Context, db dbtx, networkID int64, id int64) (_err error)

DeleteNetworkLoadBalancer deletes the network_load_balancer matching the given key parameters. generator: network_load_balancer DeleteOne-by-NetworkID-and-ID

func DeleteNetworkPeer added in v6.0.5

func DeleteNetworkPeer(ctx context.Context, db dbtx, networkID int64, id int64) (_err error)

DeleteNetworkPeer deletes the network_peer matching the given key parameters. generator: network_peer DeleteOne-by-NetworkID-and-ID

func DeleteNetworkZone added in v6.0.5

func DeleteNetworkZone(ctx context.Context, db dbtx, id int) (_err error)

DeleteNetworkZone deletes the NetworkZone matching the given key parameters. generator: NetworkZone DeleteOne-by-ID

func DeleteNetworkZoneRecord added in v6.0.5

func DeleteNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, id int) (_err error)

DeleteNetworkZoneRecord deletes the NetworkZoneRecord matching the given key parameters. generator: NetworkZoneRecord DeleteOne-by-NetworkZoneID-and-ID

func DeleteNodeClusterGroup

func DeleteNodeClusterGroup(ctx context.Context, db dbtx, groupID int) (_err error)

DeleteNodeClusterGroup deletes the node_cluster_group matching the given key parameters. generator: node_cluster_group DeleteOne-by-GroupID

func DeleteOperation

func DeleteOperation(ctx context.Context, db dbtx, uuid string) (_err error)

DeleteOperation deletes the operation matching the given key parameters. generator: operation DeleteOne-by-UUID

func DeleteOperations

func DeleteOperations(ctx context.Context, db dbtx, nodeID int64) (_err error)

DeleteOperations deletes the operation matching the given key parameters. generator: operation DeleteMany-by-NodeID

func DeleteProfile

func DeleteProfile(ctx context.Context, db dbtx, project string, name string) (_err error)

DeleteProfile deletes the profile matching the given key parameters. generator: profile DeleteOne-by-Project-and-Name

func DeleteProject

func DeleteProject(ctx context.Context, db dbtx, name string) (_err error)

DeleteProject deletes the project matching the given key parameters. generator: project DeleteOne-by-Name

func DeleteWarning

func DeleteWarning(ctx context.Context, db dbtx, uuid string) (_err error)

DeleteWarning deletes the warning matching the given key parameters. generator: warning DeleteOne-by-UUID

func DeleteWarnings

func DeleteWarnings(ctx context.Context, db dbtx, entityTypeCode int, entityID int) (_err error)

DeleteWarnings deletes the warning matching the given key parameters. generator: warning DeleteMany-by-EntityTypeCode-and-EntityID

func DevicesToAPI

func DevicesToAPI(devices map[string]Device) map[string]map[string]string

DevicesToAPI takes a map of devices and converts them to API format.

func EnsureSchema

func EnsureSchema(db *sql.DB, address string, dir string) (bool, error)

EnsureSchema applies all relevant schema updates to the cluster database.

Before actually doing anything, this function will make sure that all nodes in the cluster have a schema version and a number of API extensions that match our one. If it's not the case, we either return an error (if some nodes have version greater than us and we need to be upgraded), or return false and no error (if some nodes have a lower version, and we need to wait till they get upgraded and restarted).

func ExpandInstanceConfig

func ExpandInstanceConfig(config map[string]string, profiles []api.Profile) map[string]string

ExpandInstanceConfig expands the given instance config with the config values of the given profiles.

func ExpandInstanceDevices

func ExpandInstanceDevices(devices config.Devices, profiles []api.Profile) config.Devices

ExpandInstanceDevices expands the given instance devices with the devices defined in the given profiles.

func FreshSchema

func FreshSchema() string

FreshSchema returns the fresh schema definition of the global database.

func GetAllInstanceConfigs added in v6.0.4

func GetAllInstanceConfigs(ctx context.Context, tx *sql.Tx) (map[int]map[string]string, error)

GetAllInstanceConfigs returns a map of all instance configurations, keyed by database ID.

func GetAllInstanceDevices added in v6.0.4

func GetAllInstanceDevices(ctx context.Context, tx *sql.Tx) (map[int][]Device, error)

GetAllInstanceDevices returns a map of all instance devices, keyed by database ID.

func GetAllProfileConfigs added in v6.0.4

func GetAllProfileConfigs(ctx context.Context, tx *sql.Tx) (map[int]map[string]string, error)

GetAllProfileConfigs returns a map of all profile configurations, keyed by database ID.

func GetAllProfileDevices added in v6.0.4

func GetAllProfileDevices(ctx context.Context, tx *sql.Tx) (map[int][]Device, error)

GetAllProfileDevices returns a map of all profile devices, keyed by database ID.

func GetCertificateID

func GetCertificateID(ctx context.Context, db tx, fingerprint string) (_ int64, _err error)

GetCertificateID return the ID of the certificate with the given key. generator: certificate ID

func GetClusterGroupConfig added in v6.4.0

func GetClusterGroupConfig(ctx context.Context, db tx, clusterGroupID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetClusterGroupConfig returns all available ClusterGroup Config generator: cluster_group GetMany

func GetClusterGroupID

func GetClusterGroupID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetClusterGroupID return the ID of the cluster_group with the given key. generator: cluster_group ID

func GetConfig

func GetConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, filters ...ConfigFilter) (_ map[int]map[string]string, _err error)

GetConfig returns all available config. generator: config GetMany

func GetDevices

func GetDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, filters ...DeviceFilter) (_ map[int][]Device, _err error)

GetDevices returns all available devices for the parent entity. generator: device GetMany

func GetInstanceConfig

func GetInstanceConfig(ctx context.Context, db tx, instanceID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetInstanceConfig returns all available Instance Config generator: instance GetMany

func GetInstanceDevices

func GetInstanceDevices(ctx context.Context, db tx, instanceID int, filters ...DeviceFilter) (_ map[string]Device, _err error)

GetInstanceDevices returns all available Instance Devices generator: instance GetMany

func GetInstanceID

func GetInstanceID(ctx context.Context, db tx, project string, name string) (_ int64, _err error)

GetInstanceID return the ID of the instance with the given key. generator: instance ID

func GetInstanceSnapshotConfig

func GetInstanceSnapshotConfig(ctx context.Context, db tx, instanceSnapshotID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetInstanceSnapshotConfig returns all available InstanceSnapshot Config generator: instance_snapshot GetMany

func GetInstanceSnapshotDevices

func GetInstanceSnapshotDevices(ctx context.Context, db tx, instanceSnapshotID int, filters ...DeviceFilter) (_ map[string]Device, _err error)

GetInstanceSnapshotDevices returns all available InstanceSnapshot Devices generator: instance_snapshot GetMany

func GetInstanceSnapshotID

func GetInstanceSnapshotID(ctx context.Context, db tx, project string, instance string, name string) (_ int64, _err error)

GetInstanceSnapshotID return the ID of the instance_snapshot with the given key. generator: instance_snapshot ID

func GetNetworkACLAPI added in v6.0.5

func GetNetworkACLAPI(ctx context.Context, db tx, projectName string, name string) (int, *api.NetworkACL, error)

GetNetworkACLAPI returns the Network ACL API struct for the ACL with the given name in the given project.

func GetNetworkACLConfig added in v6.0.5

func GetNetworkACLConfig(ctx context.Context, db tx, networkACLID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkACLConfig returns all available NetworkACL Config generator: NetworkACL GetMany

func GetNetworkACLID added in v6.0.5

func GetNetworkACLID(ctx context.Context, db tx, project string, name string) (_ int64, _err error)

GetNetworkACLID return the ID of the NetworkACL with the given key. generator: NetworkACL ID

func GetNetworkAddressSetConfig added in v6.12.0

func GetNetworkAddressSetConfig(ctx context.Context, db tx, networkAddressSetID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkAddressSetConfig returns all available NetworkAddressSet Config generator: network_address_set GetMany

func GetNetworkAddressSetID added in v6.12.0

func GetNetworkAddressSetID(ctx context.Context, db tx, project string, name string) (_ int64, _err error)

GetNetworkAddressSetID return the ID of the network_address_set with the given key. generator: network_address_set ID

func GetNetworkForwardConfig added in v6.0.5

func GetNetworkForwardConfig(ctx context.Context, db tx, networkForwardID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkForwardConfig returns all available NetworkForward Config generator: network_forward GetMany

func GetNetworkForwardID added in v6.0.5

func GetNetworkForwardID(ctx context.Context, db tx, networkID int64, listenAddress string) (_ int64, _err error)

GetNetworkForwardID return the ID of the network_forward with the given key. generator: network_forward ID

func GetNetworkIntegrationConfig

func GetNetworkIntegrationConfig(ctx context.Context, db tx, networkIntegrationID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkIntegrationConfig returns all available NetworkIntegration Config generator: network_integration GetMany

func GetNetworkIntegrationID

func GetNetworkIntegrationID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetNetworkIntegrationID return the ID of the network_integration with the given key. generator: network_integration ID

func GetNetworkLoadBalancerConfig added in v6.0.5

func GetNetworkLoadBalancerConfig(ctx context.Context, db tx, networkLoadBalancerID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkLoadBalancerConfig returns all available NetworkLoadBalancer Config generator: network_load_balancer GetMany

func GetNetworkLoadBalancerID added in v6.0.5

func GetNetworkLoadBalancerID(ctx context.Context, db tx, networkID int64, listenAddress string) (_ int64, _err error)

GetNetworkLoadBalancerID return the ID of the network_load_balancer with the given key. generator: network_load_balancer ID

func GetNetworkPeerConfig added in v6.0.5

func GetNetworkPeerConfig(ctx context.Context, db tx, networkPeerID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkPeerConfig returns all available NetworkPeer Config generator: network_peer GetMany

func GetNetworkPeerID added in v6.0.5

func GetNetworkPeerID(ctx context.Context, db tx, networkID int64, name string) (_ int64, _err error)

GetNetworkPeerID return the ID of the network_peer with the given key. generator: network_peer ID

func GetNetworkZoneConfig added in v6.0.5

func GetNetworkZoneConfig(ctx context.Context, db tx, networkZoneID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkZoneConfig returns all available NetworkZone Config generator: NetworkZone GetMany

func GetNetworkZoneID added in v6.0.5

func GetNetworkZoneID(ctx context.Context, db tx, project string, name string) (_ int64, _err error)

GetNetworkZoneID return the ID of the NetworkZone with the given key. generator: NetworkZone ID

func GetNetworkZoneRecordConfig added in v6.0.5

func GetNetworkZoneRecordConfig(ctx context.Context, db tx, networkZoneRecordID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetNetworkZoneRecordConfig returns all available NetworkZoneRecord Config generator: NetworkZoneRecord GetMany

func GetNetworkZoneRecordID added in v6.0.5

func GetNetworkZoneRecordID(ctx context.Context, db tx, networkZoneID int, name string) (_ int64, _err error)

GetNetworkZoneRecordID return the ID of the NetworkZoneRecord with the given key. generator: NetworkZoneRecord ID

func GetNodeClusterGroupID

func GetNodeClusterGroupID(ctx context.Context, db tx, groupID int) (_ int64, _err error)

GetNodeClusterGroupID return the ID of the node_cluster_group with the given key. generator: node_cluster_group ID

func GetNodeID

func GetNodeID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetNodeID return the ID of the node with the given key. generator: node ID

func GetProfileConfig

func GetProfileConfig(ctx context.Context, db tx, profileID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetProfileConfig returns all available Profile Config generator: profile GetMany

func GetProfileDevices

func GetProfileDevices(ctx context.Context, db tx, profileID int, filters ...DeviceFilter) (_ map[string]Device, _err error)

GetProfileDevices returns all available Profile Devices generator: profile GetMany

func GetProfileID

func GetProfileID(ctx context.Context, db tx, project string, name string) (_ int64, _err error)

GetProfileID return the ID of the profile with the given key. generator: profile ID

func GetProjectConfig

func GetProjectConfig(ctx context.Context, db tx, projectID int, filters ...ConfigFilter) (_ map[string]string, _err error)

GetProjectConfig returns all available Project Config generator: project GetMany

func GetProjectID

func GetProjectID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetProjectID return the ID of the project with the given key. generator: project ID

func GetProjectIDsToNames

func GetProjectIDsToNames(ctx context.Context, tx *sql.Tx) (map[int64]string, error)

GetProjectIDsToNames returns a map associating each prect ID to its project name.

func GetProjectNames

func GetProjectNames(ctx context.Context, tx *sql.Tx) ([]string, error)

GetProjectNames returns the names of all availablprojects.

func GetWarningID

func GetWarningID(ctx context.Context, db tx, uuid string) (_ int64, _err error)

GetWarningID return the ID of the warning with the given key. generator: warning ID

func InitProjectWithoutImages

func InitProjectWithoutImages(ctx context.Context, tx *sql.Tx, project string) error

InitProjectWithoutImages populates the images_profiles table with all images from the default project when a project is created with features.images=false.

func InstanceExists

func InstanceExists(ctx context.Context, db dbtx, project string, name string) (_ bool, _err error)

InstanceExists checks if a instance with the given key exists. generator: instance Exists

func InstanceSnapshotExists

func InstanceSnapshotExists(ctx context.Context, db dbtx, project string, instance string, name string) (_ bool, _err error)

InstanceSnapshotExists checks if a instance_snapshot with the given key exists. generator: instance_snapshot Exists

func NetworkACLExists added in v6.0.5

func NetworkACLExists(ctx context.Context, db dbtx, project string, name string) (_ bool, _err error)

NetworkACLExists checks if a NetworkACL with the given key exists. generator: NetworkACL Exists

func NetworkAddressSetExists added in v6.12.0

func NetworkAddressSetExists(ctx context.Context, db dbtx, project string, name string) (_ bool, _err error)

NetworkAddressSetExists checks if a network_address_set with the given key exists. generator: network_address_set Exists

func NetworkIntegrationExists

func NetworkIntegrationExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

NetworkIntegrationExists checks if a network_integration with the given key exists. generator: network_integration Exists

func NetworkPeerExists added in v6.0.5

func NetworkPeerExists(ctx context.Context, db dbtx, networkID int64, name string) (_ bool, _err error)

NetworkPeerExists checks if a network_peer with the given key exists. generator: network_peer Exists

func NetworkZoneExists added in v6.0.5

func NetworkZoneExists(ctx context.Context, db dbtx, project string, name string) (_ bool, _err error)

NetworkZoneExists checks if a NetworkZone with the given key exists. generator: NetworkZone Exists

func NetworkZoneRecordExists added in v6.0.5

func NetworkZoneRecordExists(ctx context.Context, db dbtx, networkZoneID int, name string) (_ bool, _err error)

NetworkZoneRecordExists checks if a NetworkZoneRecord with the given key exists. generator: NetworkZoneRecord Exists

func NodeClusterGroupExists

func NodeClusterGroupExists(ctx context.Context, db dbtx, groupID int) (_ bool, _err error)

NodeClusterGroupExists checks if a node_cluster_group with the given key exists. generator: node_cluster_group Exists

func Open

func Open(name string, store driver.NodeStore, options ...driver.Option) (*sql.DB, error)

Open the cluster database object.

The name argument is the name of the cluster database. It defaults to 'db.bin', but can be overwritten for testing.

The dialer argument is a function that returns a gRPC dialer that can be used to connect to a database node using the gRPC SQL package.

func PrepareStmts

func PrepareStmts(db preparer, skipErrors bool) (map[int]*sql.Stmt, error)

PrepareStmts prepares all registered statements and returns an index from statement code to prepared statement object.

func ProfileExists

func ProfileExists(ctx context.Context, db dbtx, project string, name string) (_ bool, _err error)

ProfileExists checks if a profile with the given key exists. generator: profile Exists

func ProjectExists

func ProjectExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

ProjectExists checks if a project with the given key exists. generator: project Exists

func ProjectHasImages

func ProjectHasImages(ctx context.Context, tx *sql.Tx, name string) (bool, error)

ProjectHasImages is a helper to check if a project has the images feature enabled.

func ProjectHasProfiles

func ProjectHasProfiles(ctx context.Context, tx *sql.Tx, name string) (bool, error)

ProjectHasProfiles is a helper to check if a project has the profiles feature enabled.

func RegisterStmt

func RegisterStmt(sqlStmt string) int

RegisterStmt register a SQL statement.

Registered statements will be prepared upfront and reused, to speed up execution.

Return a unique registration code.

func RenameClusterGroup

func RenameClusterGroup(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameClusterGroup renames the cluster_group matching the given key parameters. generator: cluster_group Rename

func RenameInstance

func RenameInstance(ctx context.Context, db dbtx, project string, name string, to string) (_err error)

RenameInstance renames the instance matching the given key parameters. generator: instance Rename

func RenameInstanceSnapshot

func RenameInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string, to string) (_err error)

RenameInstanceSnapshot renames the instance_snapshot matching the given key parameters. generator: instance_snapshot Rename

func RenameNetworkACL added in v6.0.5

func RenameNetworkACL(ctx context.Context, db dbtx, project string, name string, to string) (_err error)

RenameNetworkACL renames the NetworkACL matching the given key parameters. generator: NetworkACL Rename

func RenameNetworkAddressSet added in v6.12.0

func RenameNetworkAddressSet(ctx context.Context, db dbtx, project string, name string, to string) (_err error)

RenameNetworkAddressSet renames the network_address_set matching the given key parameters. generator: network_address_set Rename

func RenameNetworkIntegration

func RenameNetworkIntegration(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameNetworkIntegration renames the network_integration matching the given key parameters. generator: network_integration Rename

func RenameNetworkZone added in v6.0.5

func RenameNetworkZone(ctx context.Context, db dbtx, project string, name string, to string) (_err error)

RenameNetworkZone renames the NetworkZone matching the given key parameters. generator: NetworkZone Rename

func RenameNetworkZoneRecord added in v6.0.5

func RenameNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, name string, to string) (_err error)

RenameNetworkZoneRecord renames the NetworkZoneRecord matching the given key parameters. generator: NetworkZoneRecord Rename

func RenameProfile

func RenameProfile(ctx context.Context, db dbtx, project string, name string, to string) (_err error)

RenameProfile renames the profile matching the given key parameters. generator: profile Rename

func RenameProject

func RenameProject(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameProject renames the project matching the given key parameters. generator: project Rename

func Schema

func Schema() *schema.Schema

Schema for the cluster database.

func SchemaDotGo

func SchemaDotGo() error

SchemaDotGo refreshes the schema.go file in this package, using the updates defined here.

func Stmt

func Stmt(db dbtx, code int) (*sql.Stmt, error)

Stmt prepares the in-memory prepared statement for the transaction.

func StmtString

func StmtString(code int) (string, error)

StmtString returns the in-memory query string with the given code.

func URLToEntityType

func URLToEntityType(rawURL string) (int, string, string, []string, error)

URLToEntityType parses a raw URL string and returns the entity type, the project, the location and the path arguments. The returned project is set to "default" if it is not present (unless the entity type is TypeProject, in which case it is set to the value of the path parameter). An error is returned if the URL is not recognised.

func UpdateCertificate

func UpdateCertificate(ctx context.Context, db tx, fingerprint string, object Certificate) (_err error)

UpdateCertificate updates the certificate matching the given key parameters. generator: certificate Update

func UpdateCertificateProjects

func UpdateCertificateProjects(ctx context.Context, db tx, certificateID int, projectNames []string) (_err error)

UpdateCertificateProjects updates the certificate_project matching the given key parameters. generator: certificate_project Update

func UpdateClusterGroup

func UpdateClusterGroup(ctx context.Context, db tx, name string, object ClusterGroup) (_err error)

UpdateClusterGroup updates the cluster_group matching the given key parameters. generator: cluster_group Update

func UpdateClusterGroupConfig added in v6.4.0

func UpdateClusterGroupConfig(ctx context.Context, db tx, clusterGroupID int64, config map[string]string) (_err error)

UpdateClusterGroupConfig updates the cluster_group Config matching the given key parameters. generator: cluster_group Update

func UpdateConfig

func UpdateConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, referenceID int, config map[string]string) (_err error)

UpdateConfig updates the config matching the given key parameters. generator: config Update

func UpdateDevices

func UpdateDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, referenceID int, devices map[string]Device) (_err error)

UpdateDevices updates the device matching the given key parameters. generator: device Update

func UpdateInstance

func UpdateInstance(ctx context.Context, db tx, project string, name string, object Instance) (_err error)

UpdateInstance updates the instance matching the given key parameters. generator: instance Update

func UpdateInstanceConfig

func UpdateInstanceConfig(ctx context.Context, db tx, instanceID int64, config map[string]string) (_err error)

UpdateInstanceConfig updates the instance Config matching the given key parameters. generator: instance Update

func UpdateInstanceDevices

func UpdateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) (_err error)

UpdateInstanceDevices updates the instance Device matching the given key parameters. generator: instance Update

func UpdateInstanceProfiles

func UpdateInstanceProfiles(ctx context.Context, tx *sql.Tx, instanceID int, projectName string, profiles []string) error

UpdateInstanceProfiles updates the profiles of an instance in the order they are given.

func UpdateNetworkACL added in v6.0.5

func UpdateNetworkACL(ctx context.Context, db tx, project string, name string, object NetworkACL) (_err error)

UpdateNetworkACL updates the NetworkACL matching the given key parameters. generator: NetworkACL Update

func UpdateNetworkACLAPI added in v6.0.5

func UpdateNetworkACLAPI(ctx context.Context, db tx, id int64, put *api.NetworkACLPut) error

UpdateNetworkACLAPI updates the Network ACL with the given ID using the provided API struct.

func UpdateNetworkACLConfig added in v6.0.5

func UpdateNetworkACLConfig(ctx context.Context, db tx, networkACLID int64, config map[string]string) (_err error)

UpdateNetworkACLConfig updates the NetworkACL Config matching the given key parameters. generator: NetworkACL Update

func UpdateNetworkAddressSet added in v6.12.0

func UpdateNetworkAddressSet(ctx context.Context, db tx, project string, name string, object NetworkAddressSet) (_err error)

UpdateNetworkAddressSet updates the network_address_set matching the given key parameters. generator: network_address_set Update

func UpdateNetworkAddressSetConfig added in v6.12.0

func UpdateNetworkAddressSetConfig(ctx context.Context, db tx, networkAddressSetID int64, config map[string]string) (_err error)

UpdateNetworkAddressSetConfig updates the network_address_set Config matching the given key parameters. generator: network_address_set Update

func UpdateNetworkForward added in v6.0.5

func UpdateNetworkForward(ctx context.Context, db tx, networkID int64, listenAddress string, object NetworkForward) (_err error)

UpdateNetworkForward updates the network_forward matching the given key parameters. generator: network_forward Update

func UpdateNetworkForwardConfig added in v6.0.5

func UpdateNetworkForwardConfig(ctx context.Context, db tx, networkForwardID int64, config map[string]string) (_err error)

UpdateNetworkForwardConfig updates the network_forward Config matching the given key parameters. generator: network_forward Update

func UpdateNetworkIntegration

func UpdateNetworkIntegration(ctx context.Context, db tx, name string, object NetworkIntegration) (_err error)

UpdateNetworkIntegration updates the network_integration matching the given key parameters. generator: network_integration Update

func UpdateNetworkIntegrationConfig

func UpdateNetworkIntegrationConfig(ctx context.Context, db tx, networkIntegrationID int64, config map[string]string) (_err error)

UpdateNetworkIntegrationConfig updates the network_integration Config matching the given key parameters. generator: network_integration Update

func UpdateNetworkLoadBalancer added in v6.0.5

func UpdateNetworkLoadBalancer(ctx context.Context, db tx, networkID int64, listenAddress string, object NetworkLoadBalancer) (_err error)

UpdateNetworkLoadBalancer updates the network_load_balancer matching the given key parameters. generator: network_load_balancer Update

func UpdateNetworkLoadBalancerConfig added in v6.0.5

func UpdateNetworkLoadBalancerConfig(ctx context.Context, db tx, networkLoadBalancerID int64, config map[string]string) (_err error)

UpdateNetworkLoadBalancerConfig updates the network_load_balancer Config matching the given key parameters. generator: network_load_balancer Update

func UpdateNetworkPeer added in v6.0.5

func UpdateNetworkPeer(ctx context.Context, db tx, networkID int64, name string, object NetworkPeer) (_err error)

UpdateNetworkPeer updates the network_peer matching the given key parameters. generator: network_peer Update

func UpdateNetworkPeerConfig added in v6.0.5

func UpdateNetworkPeerConfig(ctx context.Context, db tx, networkPeerID int64, config map[string]string) (_err error)

UpdateNetworkPeerConfig updates the network_peer Config matching the given key parameters. generator: network_peer Update

func UpdateNetworkZone added in v6.0.5

func UpdateNetworkZone(ctx context.Context, db tx, project string, name string, object NetworkZone) (_err error)

UpdateNetworkZone updates the NetworkZone matching the given key parameters. generator: NetworkZone Update

func UpdateNetworkZoneConfig added in v6.0.5

func UpdateNetworkZoneConfig(ctx context.Context, db tx, networkZoneID int64, config map[string]string) (_err error)

UpdateNetworkZoneConfig updates the NetworkZone Config matching the given key parameters. generator: NetworkZone Update

func UpdateNetworkZoneRecord added in v6.0.5

func UpdateNetworkZoneRecord(ctx context.Context, db tx, networkZoneID int, name string, object NetworkZoneRecord) (_err error)

UpdateNetworkZoneRecord updates the NetworkZoneRecord matching the given key parameters. generator: NetworkZoneRecord Update

func UpdateNetworkZoneRecordConfig added in v6.0.5

func UpdateNetworkZoneRecordConfig(ctx context.Context, db tx, networkZoneRecordID int64, config map[string]string) (_err error)

UpdateNetworkZoneRecordConfig updates the NetworkZoneRecord Config matching the given key parameters. generator: NetworkZoneRecord Update

func UpdateProfile

func UpdateProfile(ctx context.Context, db tx, project string, name string, object Profile) (_err error)

UpdateProfile updates the profile matching the given key parameters. generator: profile Update

func UpdateProfileConfig

func UpdateProfileConfig(ctx context.Context, db tx, profileID int64, config map[string]string) (_err error)

UpdateProfileConfig updates the profile Config matching the given key parameters. generator: profile Update

func UpdateProfileDevices

func UpdateProfileDevices(ctx context.Context, db tx, profileID int64, devices map[string]Device) (_err error)

UpdateProfileDevices updates the profile Device matching the given key parameters. generator: profile Update

func UpdateProject

func UpdateProject(ctx context.Context, tx *sql.Tx, name string, object api.ProjectPut) error

UpdateProject updates the project matching the given key parameters.

func WarningExists

func WarningExists(ctx context.Context, db dbtx, uuid string) (_ bool, _err error)

WarningExists checks if a warning with the given key exists. generator: warning Exists

Types

type Certificate

type Certificate struct {
	ID          int
	Fingerprint string `db:"primary=yes"`
	Type        certificate.Type
	Name        string
	Certificate string
	Restricted  bool
	Description string
}

Certificate is here to pass the certificates content from the database around.

func GetCertificate

func GetCertificate(ctx context.Context, db dbtx, fingerprint string) (_ *Certificate, _err error)

GetCertificate returns the certificate with the given key. generator: certificate GetOne

func GetCertificateByFingerprintPrefix

func GetCertificateByFingerprintPrefix(ctx context.Context, tx *sql.Tx, fingerprintPrefix string) (*Certificate, error)

GetCertificateByFingerprintPrefix gets an CertBaseInfo object from the database. The argument fingerprint will be queried with a LIKE query, means you can pass a shortform and will get the full fingerprint. There can never be more than one certificate with a given fingerprint, as it is enforced by a UNIQUE constraint in the schema.

func GetCertificates

func GetCertificates(ctx context.Context, db dbtx, filters ...CertificateFilter) (_ []Certificate, _err error)

GetCertificates returns all available certificates. generator: certificate GetMany

func (*Certificate) ToAPI

func (cert *Certificate) ToAPI(ctx context.Context, tx *sql.Tx) (*api.Certificate, error)

ToAPI converts the database Certificate struct to an api.Certificate entry filling fields from the database as necessary.

func (*Certificate) ToAPIType

func (cert *Certificate) ToAPIType() string

ToAPIType returns the API equivalent type.

type CertificateFilter

type CertificateFilter struct {
	ID          *int
	Fingerprint *string
	Name        *string
	Type        *certificate.Type
}

CertificateFilter specifies potential query parameter fields.

type CertificateGenerated

type CertificateGenerated interface {
	// GetCertificates returns all available certificates.
	// generator: certificate GetMany
	GetCertificates(ctx context.Context, db dbtx, filters ...CertificateFilter) ([]Certificate, error)

	// GetCertificate returns the certificate with the given key.
	// generator: certificate GetOne
	GetCertificate(ctx context.Context, db dbtx, fingerprint string) (*Certificate, error)

	// GetCertificateID return the ID of the certificate with the given key.
	// generator: certificate ID
	GetCertificateID(ctx context.Context, db tx, fingerprint string) (int64, error)

	// CertificateExists checks if a certificate with the given key exists.
	// generator: certificate Exists
	CertificateExists(ctx context.Context, db dbtx, fingerprint string) (bool, error)

	// CreateCertificate adds a new certificate to the database.
	// generator: certificate Create
	CreateCertificate(ctx context.Context, db dbtx, object Certificate) (int64, error)

	// DeleteCertificate deletes the certificate matching the given key parameters.
	// generator: certificate DeleteOne-by-Fingerprint
	DeleteCertificate(ctx context.Context, db dbtx, fingerprint string) error

	// DeleteCertificates deletes the certificate matching the given key parameters.
	// generator: certificate DeleteMany-by-Name-and-Type
	DeleteCertificates(ctx context.Context, db dbtx, name string, certificateType certificate.Type) error

	// UpdateCertificate updates the certificate matching the given key parameters.
	// generator: certificate Update
	UpdateCertificate(ctx context.Context, db tx, fingerprint string, object Certificate) error
}

CertificateGenerated is an interface of generated methods for Certificate.

type CertificateProject

type CertificateProject struct {
	CertificateID int `db:"primary=yes"`
	ProjectID     int
}

CertificateProject is an association table struct that associates Certificates to Projects.

type CertificateProjectFilter

type CertificateProjectFilter struct {
	CertificateID *int
	ProjectID     *int
}

CertificateProjectFilter specifies potential query parameter fields.

type CertificateProjectGenerated

type CertificateProjectGenerated interface {
	// GetCertificateProjects returns all available Projects for the Certificate.
	// generator: certificate_project GetMany
	GetCertificateProjects(ctx context.Context, db tx, certificateID int) ([]Project, error)

	// DeleteCertificateProjects deletes the certificate_project matching the given key parameters.
	// generator: certificate_project DeleteMany
	DeleteCertificateProjects(ctx context.Context, db tx, certificateID int) error

	// CreateCertificateProjects adds a new certificate_project to the database.
	// generator: certificate_project Create
	CreateCertificateProjects(ctx context.Context, db tx, objects []CertificateProject) error

	// UpdateCertificateProjects updates the certificate_project matching the given key parameters.
	// generator: certificate_project Update
	UpdateCertificateProjects(ctx context.Context, db tx, certificateID int, projectNames []string) error
}

CertificateProjectGenerated is an interface of generated methods for CertificateProject.

type ClusterGroup

type ClusterGroup struct {
	ID          int
	Name        string
	Description string   `db:"coalesce=''"`
	Nodes       []string `db:"ignore"`
}

ClusterGroup is a value object holding db-related details about a cluster group.

func GetClusterGroup

func GetClusterGroup(ctx context.Context, db dbtx, name string) (_ *ClusterGroup, _err error)

GetClusterGroup returns the cluster_group with the given key. generator: cluster_group GetOne

func GetClusterGroups

func GetClusterGroups(ctx context.Context, db dbtx, filters ...ClusterGroupFilter) (_ []ClusterGroup, _err error)

GetClusterGroups returns all available cluster_groups. generator: cluster_group GetMany

func (*ClusterGroup) ToAPI

func (c *ClusterGroup) ToAPI(ctx context.Context, tx *sql.Tx) (*api.ClusterGroup, error)

ToAPI returns an API entry.

type ClusterGroupFilter

type ClusterGroupFilter struct {
	ID   *int
	Name *string
}

ClusterGroupFilter specifies potential query parameter fields.

type ClusterGroupGenerated

type ClusterGroupGenerated interface {
	// GetClusterGroupConfig returns all available ClusterGroup Config
	// generator: cluster_group GetMany
	GetClusterGroupConfig(ctx context.Context, db tx, clusterGroupID int, filters ...ConfigFilter) (map[string]string, error)

	// GetClusterGroups returns all available cluster_groups.
	// generator: cluster_group GetMany
	GetClusterGroups(ctx context.Context, db dbtx, filters ...ClusterGroupFilter) ([]ClusterGroup, error)

	// GetClusterGroup returns the cluster_group with the given key.
	// generator: cluster_group GetOne
	GetClusterGroup(ctx context.Context, db dbtx, name string) (*ClusterGroup, error)

	// GetClusterGroupID return the ID of the cluster_group with the given key.
	// generator: cluster_group ID
	GetClusterGroupID(ctx context.Context, db tx, name string) (int64, error)

	// ClusterGroupExists checks if a cluster_group with the given key exists.
	// generator: cluster_group Exists
	ClusterGroupExists(ctx context.Context, db dbtx, name string) (bool, error)

	// RenameClusterGroup renames the cluster_group matching the given key parameters.
	// generator: cluster_group Rename
	RenameClusterGroup(ctx context.Context, db dbtx, name string, to string) error

	// CreateClusterGroupConfig adds new cluster_group Config to the database.
	// generator: cluster_group Create
	CreateClusterGroupConfig(ctx context.Context, db dbtx, clusterGroupID int64, config map[string]string) error

	// CreateClusterGroup adds a new cluster_group to the database.
	// generator: cluster_group Create
	CreateClusterGroup(ctx context.Context, db dbtx, object ClusterGroup) (int64, error)

	// UpdateClusterGroupConfig updates the cluster_group Config matching the given key parameters.
	// generator: cluster_group Update
	UpdateClusterGroupConfig(ctx context.Context, db tx, clusterGroupID int64, config map[string]string) error

	// UpdateClusterGroup updates the cluster_group matching the given key parameters.
	// generator: cluster_group Update
	UpdateClusterGroup(ctx context.Context, db tx, name string, object ClusterGroup) error

	// DeleteClusterGroup deletes the cluster_group matching the given key parameters.
	// generator: cluster_group DeleteOne-by-Name
	DeleteClusterGroup(ctx context.Context, db dbtx, name string) error
}

ClusterGroupGenerated is an interface of generated methods for ClusterGroup.

type Config

type Config struct {
	ID          int `db:"primary=yes"`
	ReferenceID int
	Key         string
	Value       string
}

Config is a reference struct representing one configuration entry of another entity.

type ConfigFilter

type ConfigFilter struct {
	Key   *string
	Value *string
}

ConfigFilter specifies potential query parameter fields.

type ConfigGenerated

type ConfigGenerated interface {
	// GetConfig returns all available config.
	// generator: config GetMany
	GetConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, filters ...ConfigFilter) (map[int]map[string]string, error)

	// CreateConfig adds a new config to the database.
	// generator: config Create
	CreateConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, object Config) error

	// UpdateConfig updates the config matching the given key parameters.
	// generator: config Update
	UpdateConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, referenceID int, config map[string]string) error

	// DeleteConfig deletes the config matching the given key parameters.
	// generator: config DeleteMany
	DeleteConfig(ctx context.Context, db dbtx, parentTablePrefix string, parentColumnPrefix string, referenceID int) error
}

ConfigGenerated is an interface of generated methods for Config.

type Device

type Device struct {
	ID          int
	ReferenceID int
	Name        string
	Type        DeviceType
	Config      map[string]string
}

Device is a reference struct representing another entity's device.

type DeviceFilter

type DeviceFilter struct {
	Name   *string
	Type   *DeviceType
	Config *ConfigFilter
}

DeviceFilter specifies potential query parameter fields.

type DeviceGenerated

type DeviceGenerated interface {
	// GetDevices returns all available devices for the parent entity.
	// generator: device GetMany
	GetDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, filters ...DeviceFilter) (map[int][]Device, error)

	// CreateDevices adds a new device to the database.
	// generator: device Create
	CreateDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, objects map[string]Device) error

	// UpdateDevices updates the device matching the given key parameters.
	// generator: device Update
	UpdateDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, referenceID int, devices map[string]Device) error

	// DeleteDevices deletes the device matching the given key parameters.
	// generator: device DeleteMany
	DeleteDevices(ctx context.Context, db tx, parentTablePrefix string, parentColumnPrefix string, referenceID int) error
}

DeviceGenerated is an interface of generated methods for Device.

type DeviceType

type DeviceType int

DeviceType represents the types of supported devices.

func NewDeviceType

func NewDeviceType(t string) (DeviceType, error)

NewDeviceType determines the device type from the given string, if supported.

func (DeviceType) String

func (t DeviceType) String() string

type Image

type Image struct {
	ID           int
	Project      string `db:"primary=yes&join=projects.name"`
	Fingerprint  string `db:"primary=yes"`
	Type         int
	Filename     string
	Size         int64
	Public       bool
	Architecture int
	CreationDate sql.NullTime
	ExpiryDate   sql.NullTime
	UploadDate   time.Time
	Cached       bool
	LastUseDate  sql.NullTime
	AutoUpdate   bool
}

Image is a value object holding db-related details about an image.

func GetImage

func GetImage(ctx context.Context, db dbtx, project string, fingerprint string) (_ *Image, _err error)

GetImage returns the image with the given key. generator: image GetOne

func GetImages

func GetImages(ctx context.Context, db dbtx, filters ...ImageFilter) (_ []Image, _err error)

GetImages returns all available images. generator: image GetMany

type ImageFilter

type ImageFilter struct {
	ID          *int
	Project     *string
	Fingerprint *string
	Public      *bool
	Cached      *bool
	AutoUpdate  *bool
}

ImageFilter can be used to filter results yielded by GetImages.

type ImageGenerated

type ImageGenerated interface {
	// GetImages returns all available images.
	// generator: image GetMany
	GetImages(ctx context.Context, db dbtx, filters ...ImageFilter) ([]Image, error)

	// GetImage returns the image with the given key.
	// generator: image GetOne
	GetImage(ctx context.Context, db dbtx, project string, fingerprint string) (*Image, error)
}

ImageGenerated is an interface of generated methods for Image.

type Instance

type Instance struct {
	ID           int
	Project      string `db:"primary=yes&join=projects.name"`
	Name         string `db:"primary=yes"`
	Node         string `db:"join=nodes.name"`
	Type         instancetype.Type
	Snapshot     bool `db:"ignore"`
	Architecture int
	Ephemeral    bool
	CreationDate time.Time
	Stateful     bool
	LastUseDate  sql.NullTime
	Description  string `db:"coalesce=''"`
	ExpiryDate   sql.NullTime
}

Instance is a value object holding db-related details about an instance.

func GetInstance

func GetInstance(ctx context.Context, db dbtx, project string, name string) (_ *Instance, _err error)

GetInstance returns the instance with the given key. generator: instance GetOne

func GetInstances

func GetInstances(ctx context.Context, db dbtx, filters ...InstanceFilter) (_ []Instance, _err error)

GetInstances returns all available instances. generator: instance GetMany

func GetProfileInstances

func GetProfileInstances(ctx context.Context, db tx, profileID int) (_ []Instance, _err error)

GetProfileInstances returns all available Instances for the Profile. generator: instance_profile GetMany

func (*Instance) ToAPI

func (i *Instance) ToAPI(ctx context.Context, tx *sql.Tx, instanceDevices map[int][]Device, profileConfigs map[int]map[string]string, profileDevices map[int][]Device) (*api.Instance, error)

ToAPI converts the database Instance to API type.

type InstanceFilter

type InstanceFilter struct {
	ID      *int
	Project *string
	Name    *string
	Node    *string
	Type    *instancetype.Type
}

InstanceFilter specifies potential query parameter fields.

type InstanceGenerated

type InstanceGenerated interface {
	// GetInstanceConfig returns all available Instance Config
	// generator: instance GetMany
	GetInstanceConfig(ctx context.Context, db tx, instanceID int, filters ...ConfigFilter) (map[string]string, error)

	// GetInstanceDevices returns all available Instance Devices
	// generator: instance GetMany
	GetInstanceDevices(ctx context.Context, db tx, instanceID int, filters ...DeviceFilter) (map[string]Device, error)

	// GetInstances returns all available instances.
	// generator: instance GetMany
	GetInstances(ctx context.Context, db dbtx, filters ...InstanceFilter) ([]Instance, error)

	// GetInstance returns the instance with the given key.
	// generator: instance GetOne
	GetInstance(ctx context.Context, db dbtx, project string, name string) (*Instance, error)

	// GetInstanceID return the ID of the instance with the given key.
	// generator: instance ID
	GetInstanceID(ctx context.Context, db tx, project string, name string) (int64, error)

	// InstanceExists checks if a instance with the given key exists.
	// generator: instance Exists
	InstanceExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// CreateInstanceConfig adds new instance Config to the database.
	// generator: instance Create
	CreateInstanceConfig(ctx context.Context, db dbtx, instanceID int64, config map[string]string) error

	// CreateInstanceDevices adds new instance Devices to the database.
	// generator: instance Create
	CreateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) error

	// CreateInstance adds a new instance to the database.
	// generator: instance Create
	CreateInstance(ctx context.Context, db dbtx, object Instance) (int64, error)

	// RenameInstance renames the instance matching the given key parameters.
	// generator: instance Rename
	RenameInstance(ctx context.Context, db dbtx, project string, name string, to string) error

	// DeleteInstance deletes the instance matching the given key parameters.
	// generator: instance DeleteOne-by-Project-and-Name
	DeleteInstance(ctx context.Context, db dbtx, project string, name string) error

	// UpdateInstanceConfig updates the instance Config matching the given key parameters.
	// generator: instance Update
	UpdateInstanceConfig(ctx context.Context, db tx, instanceID int64, config map[string]string) error

	// UpdateInstanceDevices updates the instance Device matching the given key parameters.
	// generator: instance Update
	UpdateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) error

	// UpdateInstance updates the instance matching the given key parameters.
	// generator: instance Update
	UpdateInstance(ctx context.Context, db tx, project string, name string, object Instance) error
}

InstanceGenerated is an interface of generated methods for Instance.

type InstanceProfile

type InstanceProfile struct {
	InstanceID int `db:"primary=yes&order=yes"`
	ProfileID  int
	ApplyOrder int `db:"order=yes"`
}

InstanceProfile is an association table struct that associates Instances to Profiles.

type InstanceProfileFilter

type InstanceProfileFilter struct {
	InstanceID *int
	ProfileID  *int
}

InstanceProfileFilter specifies potential query parameter fields.

type InstanceProfileGenerated

type InstanceProfileGenerated interface {
	// GetProfileInstances returns all available Instances for the Profile.
	// generator: instance_profile GetMany
	GetProfileInstances(ctx context.Context, db tx, profileID int) ([]Instance, error)

	// GetInstanceProfiles returns all available Profiles for the Instance.
	// generator: instance_profile GetMany
	GetInstanceProfiles(ctx context.Context, db tx, instanceID int) ([]Profile, error)

	// CreateInstanceProfiles adds a new instance_profile to the database.
	// generator: instance_profile Create
	CreateInstanceProfiles(ctx context.Context, db tx, objects []InstanceProfile) error

	// DeleteInstanceProfiles deletes the instance_profile matching the given key parameters.
	// generator: instance_profile DeleteMany
	DeleteInstanceProfiles(ctx context.Context, db tx, instanceID int) error
}

InstanceProfileGenerated is an interface of generated methods for InstanceProfile.

type InstanceSnapshot

type InstanceSnapshot struct {
	ID           int
	Project      string `db:"primary=yes&join=projects.name&joinon=instances.project_id"`
	Instance     string `db:"primary=yes&join=instances.name"`
	Name         string `db:"primary=yes"`
	CreationDate time.Time
	Stateful     bool
	Description  string `db:"coalesce=''"`
	ExpiryDate   sql.NullTime
}

InstanceSnapshot is a value object holding db-related details about a snapshot.

func GetInstanceSnapshot

func GetInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string) (_ *InstanceSnapshot, _err error)

GetInstanceSnapshot returns the instance_snapshot with the given key. generator: instance_snapshot GetOne

func GetInstanceSnapshots

func GetInstanceSnapshots(ctx context.Context, db dbtx, filters ...InstanceSnapshotFilter) (_ []InstanceSnapshot, _err error)

GetInstanceSnapshots returns all available instance_snapshots. generator: instance_snapshot GetMany

func (*InstanceSnapshot) ToInstance

func (s *InstanceSnapshot) ToInstance(parentName string, parentNode string, parentType instancetype.Type, parentArch int) Instance

ToInstance converts an instance snapshot to a database Instance, filling in extra fields from the parent instance.

type InstanceSnapshotFilter

type InstanceSnapshotFilter struct {
	ID       *int
	Project  *string
	Instance *string
	Name     *string
}

InstanceSnapshotFilter specifies potential query parameter fields.

type InstanceSnapshotGenerated

type InstanceSnapshotGenerated interface {
	// GetInstanceSnapshotConfig returns all available InstanceSnapshot Config
	// generator: instance_snapshot GetMany
	GetInstanceSnapshotConfig(ctx context.Context, db tx, instanceSnapshotID int, filters ...ConfigFilter) (map[string]string, error)

	// GetInstanceSnapshotDevices returns all available InstanceSnapshot Devices
	// generator: instance_snapshot GetMany
	GetInstanceSnapshotDevices(ctx context.Context, db tx, instanceSnapshotID int, filters ...DeviceFilter) (map[string]Device, error)

	// GetInstanceSnapshots returns all available instance_snapshots.
	// generator: instance_snapshot GetMany
	GetInstanceSnapshots(ctx context.Context, db dbtx, filters ...InstanceSnapshotFilter) ([]InstanceSnapshot, error)

	// GetInstanceSnapshot returns the instance_snapshot with the given key.
	// generator: instance_snapshot GetOne
	GetInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string) (*InstanceSnapshot, error)

	// GetInstanceSnapshotID return the ID of the instance_snapshot with the given key.
	// generator: instance_snapshot ID
	GetInstanceSnapshotID(ctx context.Context, db tx, project string, instance string, name string) (int64, error)

	// InstanceSnapshotExists checks if a instance_snapshot with the given key exists.
	// generator: instance_snapshot Exists
	InstanceSnapshotExists(ctx context.Context, db dbtx, project string, instance string, name string) (bool, error)

	// CreateInstanceSnapshotConfig adds new instance_snapshot Config to the database.
	// generator: instance_snapshot Create
	CreateInstanceSnapshotConfig(ctx context.Context, db dbtx, instanceSnapshotID int64, config map[string]string) error

	// CreateInstanceSnapshotDevices adds new instance_snapshot Devices to the database.
	// generator: instance_snapshot Create
	CreateInstanceSnapshotDevices(ctx context.Context, db tx, instanceSnapshotID int64, devices map[string]Device) error

	// CreateInstanceSnapshot adds a new instance_snapshot to the database.
	// generator: instance_snapshot Create
	CreateInstanceSnapshot(ctx context.Context, db dbtx, object InstanceSnapshot) (int64, error)

	// RenameInstanceSnapshot renames the instance_snapshot matching the given key parameters.
	// generator: instance_snapshot Rename
	RenameInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string, to string) error

	// DeleteInstanceSnapshot deletes the instance_snapshot matching the given key parameters.
	// generator: instance_snapshot DeleteOne-by-Project-and-Instance-and-Name
	DeleteInstanceSnapshot(ctx context.Context, db dbtx, project string, instance string, name string) error
}

InstanceSnapshotGenerated is an interface of generated methods for InstanceSnapshot.

type Marshaler added in v6.0.4

type Marshaler interface {
	MarshalDB() (string, error)
}

Marshaler is the interface that wraps the MarshalDB method, which converts the underlying type into a string representation suitable for persistence in the database.

type NetworkACL added in v6.0.5

type NetworkACL struct {
	ID          int    `db:"order=yes"`
	ProjectID   int    `db:"omit=create,update"`
	Project     string `db:"primary=yes&join=projects.name"`
	Name        string `db:"primary=yes"`
	Description string
	Ingress     []api.NetworkACLRule `db:"marshal=json"`
	Egress      []api.NetworkACLRule `db:"marshal=json"`
}

NetworkACL is a value object holding db-related details about a network ACL.

func GetNetworkACL added in v6.0.5

func GetNetworkACL(ctx context.Context, db dbtx, project string, name string) (_ *NetworkACL, _err error)

GetNetworkACL returns the NetworkACL with the given key. generator: NetworkACL GetOne

func GetNetworkACLs added in v6.0.5

func GetNetworkACLs(ctx context.Context, db dbtx, filters ...NetworkACLFilter) (_ []NetworkACL, _err error)

GetNetworkACLs returns all available NetworkACLs. generator: NetworkACL GetMany

func (*NetworkACL) ToAPI added in v6.0.5

func (n *NetworkACL) ToAPI(ctx context.Context, db tx) (*api.NetworkACL, error)

ToAPI converts the DB record into the shared/api form.

type NetworkACLFilter added in v6.0.5

type NetworkACLFilter struct {
	ID      *int
	Name    *string
	Project *string
}

NetworkACLFilter specifies potential query parameter fields.

type NetworkACLGenerated added in v6.0.5

type NetworkACLGenerated interface {
	// GetNetworkACLConfig returns all available NetworkACL Config
	// generator: NetworkACL GetMany
	GetNetworkACLConfig(ctx context.Context, db tx, networkACLID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkACLs returns all available NetworkACLs.
	// generator: NetworkACL GetMany
	GetNetworkACLs(ctx context.Context, db dbtx, filters ...NetworkACLFilter) ([]NetworkACL, error)

	// GetNetworkACL returns the NetworkACL with the given key.
	// generator: NetworkACL GetOne
	GetNetworkACL(ctx context.Context, db dbtx, project string, name string) (*NetworkACL, error)

	// NetworkACLExists checks if a NetworkACL with the given key exists.
	// generator: NetworkACL Exists
	NetworkACLExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// CreateNetworkACLConfig adds new NetworkACL Config to the database.
	// generator: NetworkACL Create
	CreateNetworkACLConfig(ctx context.Context, db dbtx, networkACLID int64, config map[string]string) error

	// CreateNetworkACL adds a new NetworkACL to the database.
	// generator: NetworkACL Create
	CreateNetworkACL(ctx context.Context, db dbtx, object NetworkACL) (int64, error)

	// GetNetworkACLID return the ID of the NetworkACL with the given key.
	// generator: NetworkACL ID
	GetNetworkACLID(ctx context.Context, db tx, project string, name string) (int64, error)

	// RenameNetworkACL renames the NetworkACL matching the given key parameters.
	// generator: NetworkACL Rename
	RenameNetworkACL(ctx context.Context, db dbtx, project string, name string, to string) error

	// UpdateNetworkACLConfig updates the NetworkACL Config matching the given key parameters.
	// generator: NetworkACL Update
	UpdateNetworkACLConfig(ctx context.Context, db tx, networkACLID int64, config map[string]string) error

	// UpdateNetworkACL updates the NetworkACL matching the given key parameters.
	// generator: NetworkACL Update
	UpdateNetworkACL(ctx context.Context, db tx, project string, name string, object NetworkACL) error

	// DeleteNetworkACL deletes the NetworkACL matching the given key parameters.
	// generator: NetworkACL DeleteOne-by-ID
	DeleteNetworkACL(ctx context.Context, db dbtx, id int) error
}

NetworkACLGenerated is an interface of generated methods for NetworkACL.

type NetworkAddressSet added in v6.12.0

type NetworkAddressSet struct {
	ID          int
	ProjectID   int      `db:"omit=create,update"`
	Project     string   `db:"primary=yes&join=projects.name"`
	Name        string   `db:"primary=yes"`
	Description string   `db:"coalesce=''"`
	Addresses   []string `db:"marshal=json"`
}

NetworkAddressSet is a value object holding db-related details about a network address_set.

func GetNetworkAddressSet added in v6.12.0

func GetNetworkAddressSet(ctx context.Context, db dbtx, project string, name string) (_ *NetworkAddressSet, _err error)

GetNetworkAddressSet returns the network_address_set with the given key. generator: network_address_set GetOne

func GetNetworkAddressSets added in v6.12.0

func GetNetworkAddressSets(ctx context.Context, db dbtx, filters ...NetworkAddressSetFilter) (_ []NetworkAddressSet, _err error)

GetNetworkAddressSets returns all available network_address_sets. generator: network_address_set GetMany

func (*NetworkAddressSet) ToAPI added in v6.12.0

ToAPI converts the DB records to an API record.

type NetworkAddressSetFilter added in v6.12.0

type NetworkAddressSetFilter struct {
	ID      *int
	Name    *string
	Project *string
}

NetworkAddressSetFilter specifies potential query parameter fields.

type NetworkAddressSetGenerated added in v6.12.0

type NetworkAddressSetGenerated interface {
	// GetNetworkAddressSetID return the ID of the network_address_set with the given key.
	// generator: network_address_set ID
	GetNetworkAddressSetID(ctx context.Context, db tx, project string, name string) (int64, error)

	// NetworkAddressSetExists checks if a network_address_set with the given key exists.
	// generator: network_address_set Exists
	NetworkAddressSetExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// GetNetworkAddressSetConfig returns all available NetworkAddressSet Config
	// generator: network_address_set GetMany
	GetNetworkAddressSetConfig(ctx context.Context, db tx, networkAddressSetID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkAddressSets returns all available network_address_sets.
	// generator: network_address_set GetMany
	GetNetworkAddressSets(ctx context.Context, db dbtx, filters ...NetworkAddressSetFilter) ([]NetworkAddressSet, error)

	// GetNetworkAddressSet returns the network_address_set with the given key.
	// generator: network_address_set GetOne
	GetNetworkAddressSet(ctx context.Context, db dbtx, project string, name string) (*NetworkAddressSet, error)

	// CreateNetworkAddressSetConfig adds new network_address_set Config to the database.
	// generator: network_address_set Create
	CreateNetworkAddressSetConfig(ctx context.Context, db dbtx, networkAddressSetID int64, config map[string]string) error

	// CreateNetworkAddressSet adds a new network_address_set to the database.
	// generator: network_address_set Create
	CreateNetworkAddressSet(ctx context.Context, db dbtx, object NetworkAddressSet) (int64, error)

	// RenameNetworkAddressSet renames the network_address_set matching the given key parameters.
	// generator: network_address_set Rename
	RenameNetworkAddressSet(ctx context.Context, db dbtx, project string, name string, to string) error

	// UpdateNetworkAddressSetConfig updates the network_address_set Config matching the given key parameters.
	// generator: network_address_set Update
	UpdateNetworkAddressSetConfig(ctx context.Context, db tx, networkAddressSetID int64, config map[string]string) error

	// UpdateNetworkAddressSet updates the network_address_set matching the given key parameters.
	// generator: network_address_set Update
	UpdateNetworkAddressSet(ctx context.Context, db tx, project string, name string, object NetworkAddressSet) error

	// DeleteNetworkAddressSet deletes the network_address_set matching the given key parameters.
	// generator: network_address_set DeleteOne-by-Project-and-Name
	DeleteNetworkAddressSet(ctx context.Context, db dbtx, project string, name string) error
}

NetworkAddressSetGenerated is an interface of generated methods for NetworkAddressSet.

type NetworkForward added in v6.0.5

type NetworkForward struct {
	ID            int64
	NetworkID     int64         `db:"primary=yes&column=network_id"`
	NodeID        sql.NullInt64 `db:"column=node_id&nullable=true"`
	Location      *string       `db:"leftjoin=nodes.name&omit=create,update"`
	ListenAddress string        `db:"primary=yes"`
	Description   string
	Ports         []api.NetworkForwardPort `db:"marshal=json"`
}

NetworkForward is the generated entity backing the networks_forwards table.

func GetNetworkForward added in v6.0.5

func GetNetworkForward(ctx context.Context, db dbtx, networkID int64, listenAddress string) (_ *NetworkForward, _err error)

GetNetworkForward returns the network_forward with the given key. generator: network_forward GetOne

func GetNetworkForwards added in v6.0.5

func GetNetworkForwards(ctx context.Context, db dbtx, filters ...NetworkForwardFilter) (_ []NetworkForward, _err error)

GetNetworkForwards returns all available network_forwards. generator: network_forward GetMany

func (*NetworkForward) ToAPI added in v6.0.5

func (n *NetworkForward) ToAPI(ctx context.Context, tx *sql.Tx) (*api.NetworkForward, error)

ToAPI converts the DB record into the external API type.

type NetworkForwardFilter added in v6.0.5

type NetworkForwardFilter struct {
	ID            *int64
	NetworkID     *int64
	NodeID        *int64
	ListenAddress *string
}

NetworkForwardFilter defines the optional WHERE-clause fields.

type NetworkForwardGenerated added in v6.0.5

type NetworkForwardGenerated interface {
	// GetNetworkForwardConfig returns all available NetworkForward Config
	// generator: network_forward GetMany
	GetNetworkForwardConfig(ctx context.Context, db tx, networkForwardID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkForwards returns all available network_forwards.
	// generator: network_forward GetMany
	GetNetworkForwards(ctx context.Context, db dbtx, filters ...NetworkForwardFilter) ([]NetworkForward, error)

	// GetNetworkForward returns the network_forward with the given key.
	// generator: network_forward GetOne
	GetNetworkForward(ctx context.Context, db dbtx, networkID int64, listenAddress string) (*NetworkForward, error)

	// GetNetworkForwardID return the ID of the network_forward with the given key.
	// generator: network_forward ID
	GetNetworkForwardID(ctx context.Context, db tx, networkID int64, listenAddress string) (int64, error)

	// CreateNetworkForwardConfig adds new network_forward Config to the database.
	// generator: network_forward Create
	CreateNetworkForwardConfig(ctx context.Context, db dbtx, networkForwardID int64, config map[string]string) error

	// CreateNetworkForward adds a new network_forward to the database.
	// generator: network_forward Create
	CreateNetworkForward(ctx context.Context, db dbtx, object NetworkForward) (int64, error)

	// UpdateNetworkForwardConfig updates the network_forward Config matching the given key parameters.
	// generator: network_forward Update
	UpdateNetworkForwardConfig(ctx context.Context, db tx, networkForwardID int64, config map[string]string) error

	// UpdateNetworkForward updates the network_forward matching the given key parameters.
	// generator: network_forward Update
	UpdateNetworkForward(ctx context.Context, db tx, networkID int64, listenAddress string, object NetworkForward) error

	// DeleteNetworkForward deletes the network_forward matching the given key parameters.
	// generator: network_forward DeleteOne-by-NetworkID-and-ID
	DeleteNetworkForward(ctx context.Context, db dbtx, networkID int64, id int64) error
}

NetworkForwardGenerated is an interface of generated methods for NetworkForward.

type NetworkIntegration

type NetworkIntegration struct {
	ID          int
	Name        string
	Description string
	Type        int
}

NetworkIntegration is a value object holding db-related details about a network integration.

func GetNetworkIntegration

func GetNetworkIntegration(ctx context.Context, db dbtx, name string) (_ *NetworkIntegration, _err error)

GetNetworkIntegration returns the network_integration with the given key. generator: network_integration GetOne

func GetNetworkIntegrations

func GetNetworkIntegrations(ctx context.Context, db dbtx, filters ...NetworkIntegrationFilter) (_ []NetworkIntegration, _err error)

GetNetworkIntegrations returns all available network_integrations. generator: network_integration GetMany

func (*NetworkIntegration) ToAPI

ToAPI converts the DB records to an API record.

type NetworkIntegrationFilter

type NetworkIntegrationFilter struct {
	ID   *int
	Name *string
}

NetworkIntegrationFilter specifies potential query parameter fields.

type NetworkIntegrationGenerated

type NetworkIntegrationGenerated interface {
	// GetNetworkIntegrationConfig returns all available NetworkIntegration Config
	// generator: network_integration GetMany
	GetNetworkIntegrationConfig(ctx context.Context, db tx, networkIntegrationID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkIntegrations returns all available network_integrations.
	// generator: network_integration GetMany
	GetNetworkIntegrations(ctx context.Context, db dbtx, filters ...NetworkIntegrationFilter) ([]NetworkIntegration, error)

	// GetNetworkIntegration returns the network_integration with the given key.
	// generator: network_integration GetOne
	GetNetworkIntegration(ctx context.Context, db dbtx, name string) (*NetworkIntegration, error)

	// NetworkIntegrationExists checks if a network_integration with the given key exists.
	// generator: network_integration Exists
	NetworkIntegrationExists(ctx context.Context, db dbtx, name string) (bool, error)

	// CreateNetworkIntegrationConfig adds new network_integration Config to the database.
	// generator: network_integration Create
	CreateNetworkIntegrationConfig(ctx context.Context, db dbtx, networkIntegrationID int64, config map[string]string) error

	// CreateNetworkIntegration adds a new network_integration to the database.
	// generator: network_integration Create
	CreateNetworkIntegration(ctx context.Context, db dbtx, object NetworkIntegration) (int64, error)

	// GetNetworkIntegrationID return the ID of the network_integration with the given key.
	// generator: network_integration ID
	GetNetworkIntegrationID(ctx context.Context, db tx, name string) (int64, error)

	// RenameNetworkIntegration renames the network_integration matching the given key parameters.
	// generator: network_integration Rename
	RenameNetworkIntegration(ctx context.Context, db dbtx, name string, to string) error

	// DeleteNetworkIntegration deletes the network_integration matching the given key parameters.
	// generator: network_integration DeleteOne-by-Name
	DeleteNetworkIntegration(ctx context.Context, db dbtx, name string) error

	// UpdateNetworkIntegrationConfig updates the network_integration Config matching the given key parameters.
	// generator: network_integration Update
	UpdateNetworkIntegrationConfig(ctx context.Context, db tx, networkIntegrationID int64, config map[string]string) error

	// UpdateNetworkIntegration updates the network_integration matching the given key parameters.
	// generator: network_integration Update
	UpdateNetworkIntegration(ctx context.Context, db tx, name string, object NetworkIntegration) error
}

NetworkIntegrationGenerated is an interface of generated methods for NetworkIntegration.

type NetworkLoadBalancer added in v6.0.5

type NetworkLoadBalancer struct {
	ID            int64
	NetworkID     int64  `db:"primary=yes&column=network_id"`
	ListenAddress string `db:"primary=yes"`
	Description   string
	Backends      []api.NetworkLoadBalancerBackend `db:"marshal=json"`
	Ports         []api.NetworkLoadBalancerPort    `db:"marshal=json"`
}

NetworkLoadBalancer is the generated entity backing the networks_load_balancers table.

func GetNetworkLoadBalancer added in v6.0.5

func GetNetworkLoadBalancer(ctx context.Context, db dbtx, networkID int64, listenAddress string) (_ *NetworkLoadBalancer, _err error)

GetNetworkLoadBalancer returns the network_load_balancer with the given key. generator: network_load_balancer GetOne

func GetNetworkLoadBalancers added in v6.0.5

func GetNetworkLoadBalancers(ctx context.Context, db dbtx, filters ...NetworkLoadBalancerFilter) (_ []NetworkLoadBalancer, _err error)

GetNetworkLoadBalancers returns all available network_load_balancers. generator: network_load_balancer GetMany

func (*NetworkLoadBalancer) ToAPI added in v6.0.5

ToAPI converts the DB record into the external API type.

type NetworkLoadBalancerFilter added in v6.0.5

type NetworkLoadBalancerFilter struct {
	ID            *int64
	NetworkID     *int64
	ListenAddress *string
}

NetworkLoadBalancerFilter defines the optional WHERE-clause fields.

type NetworkLoadBalancerGenerated added in v6.0.5

type NetworkLoadBalancerGenerated interface {
	// GetNetworkLoadBalancerConfig returns all available NetworkLoadBalancer Config
	// generator: network_load_balancer GetMany
	GetNetworkLoadBalancerConfig(ctx context.Context, db tx, networkLoadBalancerID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkLoadBalancers returns all available network_load_balancers.
	// generator: network_load_balancer GetMany
	GetNetworkLoadBalancers(ctx context.Context, db dbtx, filters ...NetworkLoadBalancerFilter) ([]NetworkLoadBalancer, error)

	// GetNetworkLoadBalancer returns the network_load_balancer with the given key.
	// generator: network_load_balancer GetOne
	GetNetworkLoadBalancer(ctx context.Context, db dbtx, networkID int64, listenAddress string) (*NetworkLoadBalancer, error)

	// GetNetworkLoadBalancerID return the ID of the network_load_balancer with the given key.
	// generator: network_load_balancer ID
	GetNetworkLoadBalancerID(ctx context.Context, db tx, networkID int64, listenAddress string) (int64, error)

	// CreateNetworkLoadBalancerConfig adds new network_load_balancer Config to the database.
	// generator: network_load_balancer Create
	CreateNetworkLoadBalancerConfig(ctx context.Context, db dbtx, networkLoadBalancerID int64, config map[string]string) error

	// CreateNetworkLoadBalancer adds a new network_load_balancer to the database.
	// generator: network_load_balancer Create
	CreateNetworkLoadBalancer(ctx context.Context, db dbtx, object NetworkLoadBalancer) (int64, error)

	// UpdateNetworkLoadBalancerConfig updates the network_load_balancer Config matching the given key parameters.
	// generator: network_load_balancer Update
	UpdateNetworkLoadBalancerConfig(ctx context.Context, db tx, networkLoadBalancerID int64, config map[string]string) error

	// UpdateNetworkLoadBalancer updates the network_load_balancer matching the given key parameters.
	// generator: network_load_balancer Update
	UpdateNetworkLoadBalancer(ctx context.Context, db tx, networkID int64, listenAddress string, object NetworkLoadBalancer) error

	// DeleteNetworkLoadBalancer deletes the network_load_balancer matching the given key parameters.
	// generator: network_load_balancer DeleteOne-by-NetworkID-and-ID
	DeleteNetworkLoadBalancer(ctx context.Context, db dbtx, networkID int64, id int64) error
}

NetworkLoadBalancerGenerated is an interface of generated methods for NetworkLoadBalancer.

type NetworkPeer added in v6.0.5

type NetworkPeer struct {
	ID                         int64
	NetworkID                  int64  `db:"primary=yes&column=network_id"`
	Name                       string `db:"primary=yes"`
	Description                string
	Type                       int
	TargetNetworkProject       sql.NullString
	TargetNetworkName          sql.NullString
	TargetNetworkIntegrationID sql.NullInt64
	TargetNetworkID            sql.NullInt64
}

NetworkPeer is a value object holding db-related details about a network peer. Fields correspond to the columns in the networks_peers table. generate-database will create CRUD methods and config helpers automatically.

func GetNetworkPeer added in v6.0.5

func GetNetworkPeer(ctx context.Context, db dbtx, networkID int64, name string) (_ *NetworkPeer, _err error)

GetNetworkPeer returns the network_peer with the given key. generator: network_peer GetOne

func GetNetworkPeers added in v6.0.5

func GetNetworkPeers(ctx context.Context, db dbtx, filters ...NetworkPeerFilter) (_ []NetworkPeer, _err error)

GetNetworkPeers returns all available network_peers. generator: network_peer GetMany

func (*NetworkPeer) ToAPI added in v6.0.5

func (n *NetworkPeer) ToAPI(ctx context.Context, tx *sql.Tx) (*api.NetworkPeer, error)

ToAPI converts the database NetworkPeer to API type.

type NetworkPeerConnection added in v6.0.5

type NetworkPeerConnection struct {
	NetworkName string
	PeerName    string
}

NetworkPeerConnection represents a peer connection.

type NetworkPeerFilter added in v6.0.5

type NetworkPeerFilter struct {
	ID        *int64
	NetworkID *int64
	Name      *string
	Type      *int

	TargetNetworkProject       *string
	TargetNetworkName          *string
	TargetNetworkIntegrationID *int64
	TargetNetworkID            *int64
}

NetworkPeerFilter specifies potential query parameter fields.

type NetworkPeerGenerated added in v6.0.5

type NetworkPeerGenerated interface {
	// GetNetworkPeerConfig returns all available NetworkPeer Config
	// generator: network_peer GetMany
	GetNetworkPeerConfig(ctx context.Context, db tx, networkPeerID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkPeers returns all available network_peers.
	// generator: network_peer GetMany
	GetNetworkPeers(ctx context.Context, db dbtx, filters ...NetworkPeerFilter) ([]NetworkPeer, error)

	// GetNetworkPeer returns the network_peer with the given key.
	// generator: network_peer GetOne
	GetNetworkPeer(ctx context.Context, db dbtx, networkID int64, name string) (*NetworkPeer, error)

	// NetworkPeerExists checks if a network_peer with the given key exists.
	// generator: network_peer Exists
	NetworkPeerExists(ctx context.Context, db dbtx, networkID int64, name string) (bool, error)

	// CreateNetworkPeerConfig adds new network_peer Config to the database.
	// generator: network_peer Create
	CreateNetworkPeerConfig(ctx context.Context, db dbtx, networkPeerID int64, config map[string]string) error

	// CreateNetworkPeer adds a new network_peer to the database.
	// generator: network_peer Create
	CreateNetworkPeer(ctx context.Context, db dbtx, object NetworkPeer) (int64, error)

	// GetNetworkPeerID return the ID of the network_peer with the given key.
	// generator: network_peer ID
	GetNetworkPeerID(ctx context.Context, db tx, networkID int64, name string) (int64, error)

	// DeleteNetworkPeer deletes the network_peer matching the given key parameters.
	// generator: network_peer DeleteOne-by-NetworkID-and-ID
	DeleteNetworkPeer(ctx context.Context, db dbtx, networkID int64, id int64) error

	// UpdateNetworkPeerConfig updates the network_peer Config matching the given key parameters.
	// generator: network_peer Update
	UpdateNetworkPeerConfig(ctx context.Context, db tx, networkPeerID int64, config map[string]string) error

	// UpdateNetworkPeer updates the network_peer matching the given key parameters.
	// generator: network_peer Update
	UpdateNetworkPeer(ctx context.Context, db tx, networkID int64, name string, object NetworkPeer) error
}

NetworkPeerGenerated is an interface of generated methods for NetworkPeer.

type NetworkZone added in v6.0.5

type NetworkZone struct {
	ID          int    `db:"order=yes"`
	ProjectID   int    `db:"omit=create,update"`
	Project     string `db:"primary=yes&join=projects.name"`
	Name        string `db:"primary=yes"`
	Description string
}

NetworkZone is a value object holding db-related details about a network zone (DNS).

func GetNetworkZone added in v6.0.5

func GetNetworkZone(ctx context.Context, db dbtx, project string, name string) (_ *NetworkZone, _err error)

GetNetworkZone returns the NetworkZone with the given key. generator: NetworkZone GetOne

func GetNetworkZones added in v6.0.5

func GetNetworkZones(ctx context.Context, db dbtx, filters ...NetworkZoneFilter) (_ []NetworkZone, _err error)

GetNetworkZones returns all available NetworkZones. generator: NetworkZone GetMany

func (*NetworkZone) ToAPI added in v6.0.5

func (n *NetworkZone) ToAPI(ctx context.Context, db tx) (*api.NetworkZone, error)

ToAPI converts the DB records to an API record.

type NetworkZoneFilter added in v6.0.5

type NetworkZoneFilter struct {
	ID      *int
	Name    *string
	Project *string
}

NetworkZoneFilter specifies potential query parameter fields.

type NetworkZoneGenerated added in v6.0.5

type NetworkZoneGenerated interface {
	// GetNetworkZoneConfig returns all available NetworkZone Config
	// generator: NetworkZone GetMany
	GetNetworkZoneConfig(ctx context.Context, db tx, networkZoneID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkZones returns all available NetworkZones.
	// generator: NetworkZone GetMany
	GetNetworkZones(ctx context.Context, db dbtx, filters ...NetworkZoneFilter) ([]NetworkZone, error)

	// GetNetworkZone returns the NetworkZone with the given key.
	// generator: NetworkZone GetOne
	GetNetworkZone(ctx context.Context, db dbtx, project string, name string) (*NetworkZone, error)

	// NetworkZoneExists checks if a NetworkZone with the given key exists.
	// generator: NetworkZone Exists
	NetworkZoneExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// CreateNetworkZoneConfig adds new NetworkZone Config to the database.
	// generator: NetworkZone Create
	CreateNetworkZoneConfig(ctx context.Context, db dbtx, networkZoneID int64, config map[string]string) error

	// CreateNetworkZone adds a new NetworkZone to the database.
	// generator: NetworkZone Create
	CreateNetworkZone(ctx context.Context, db dbtx, object NetworkZone) (int64, error)

	// GetNetworkZoneID return the ID of the NetworkZone with the given key.
	// generator: NetworkZone ID
	GetNetworkZoneID(ctx context.Context, db tx, project string, name string) (int64, error)

	// RenameNetworkZone renames the NetworkZone matching the given key parameters.
	// generator: NetworkZone Rename
	RenameNetworkZone(ctx context.Context, db dbtx, project string, name string, to string) error

	// UpdateNetworkZoneConfig updates the NetworkZone Config matching the given key parameters.
	// generator: NetworkZone Update
	UpdateNetworkZoneConfig(ctx context.Context, db tx, networkZoneID int64, config map[string]string) error

	// UpdateNetworkZone updates the NetworkZone matching the given key parameters.
	// generator: NetworkZone Update
	UpdateNetworkZone(ctx context.Context, db tx, project string, name string, object NetworkZone) error

	// DeleteNetworkZone deletes the NetworkZone matching the given key parameters.
	// generator: NetworkZone DeleteOne-by-ID
	DeleteNetworkZone(ctx context.Context, db dbtx, id int) error
}

NetworkZoneGenerated is an interface of generated methods for NetworkZone.

type NetworkZoneRecord added in v6.0.5

type NetworkZoneRecord struct {
	ID            int    `db:"order=yes"`
	NetworkZoneID int    `db:"primary=yes"`
	Name          string `db:"primary=yes"`
	Description   string
	Entries       []api.NetworkZoneRecordEntry `db:"marshal=json"`
}

NetworkZoneRecord is a value object holding db-related details about a DNS record in a network zone.

func GetNetworkZoneRecord added in v6.0.5

func GetNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, name string) (_ *NetworkZoneRecord, _err error)

GetNetworkZoneRecord returns the NetworkZoneRecord with the given key. generator: NetworkZoneRecord GetOne

func GetNetworkZoneRecords added in v6.0.5

func GetNetworkZoneRecords(ctx context.Context, db dbtx, filters ...NetworkZoneRecordFilter) (_ []NetworkZoneRecord, _err error)

GetNetworkZoneRecords returns all available NetworkZoneRecords. generator: NetworkZoneRecord GetMany

func (*NetworkZoneRecord) ToAPI added in v6.0.5

func (r *NetworkZoneRecord) ToAPI(ctx context.Context, db tx) (*api.NetworkZoneRecord, error)

ToAPI converts the DB record into external API type.

type NetworkZoneRecordFilter added in v6.0.5

type NetworkZoneRecordFilter struct {
	ID            *int
	Name          *string
	NetworkZoneID *int
}

NetworkZoneRecordFilter defines the optional WHERE-clause fields.

type NetworkZoneRecordGenerated added in v6.0.5

type NetworkZoneRecordGenerated interface {
	// GetNetworkZoneRecordConfig returns all available NetworkZoneRecord Config
	// generator: NetworkZoneRecord GetMany
	GetNetworkZoneRecordConfig(ctx context.Context, db tx, networkZoneRecordID int, filters ...ConfigFilter) (map[string]string, error)

	// GetNetworkZoneRecords returns all available NetworkZoneRecords.
	// generator: NetworkZoneRecord GetMany
	GetNetworkZoneRecords(ctx context.Context, db dbtx, filters ...NetworkZoneRecordFilter) ([]NetworkZoneRecord, error)

	// GetNetworkZoneRecord returns the NetworkZoneRecord with the given key.
	// generator: NetworkZoneRecord GetOne
	GetNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, name string) (*NetworkZoneRecord, error)

	// NetworkZoneRecordExists checks if a NetworkZoneRecord with the given key exists.
	// generator: NetworkZoneRecord Exists
	NetworkZoneRecordExists(ctx context.Context, db dbtx, networkZoneID int, name string) (bool, error)

	// CreateNetworkZoneRecordConfig adds new NetworkZoneRecord Config to the database.
	// generator: NetworkZoneRecord Create
	CreateNetworkZoneRecordConfig(ctx context.Context, db dbtx, networkZoneRecordID int64, config map[string]string) error

	// CreateNetworkZoneRecord adds a new NetworkZoneRecord to the database.
	// generator: NetworkZoneRecord Create
	CreateNetworkZoneRecord(ctx context.Context, db dbtx, object NetworkZoneRecord) (int64, error)

	// GetNetworkZoneRecordID return the ID of the NetworkZoneRecord with the given key.
	// generator: NetworkZoneRecord ID
	GetNetworkZoneRecordID(ctx context.Context, db tx, networkZoneID int, name string) (int64, error)

	// RenameNetworkZoneRecord renames the NetworkZoneRecord matching the given key parameters.
	// generator: NetworkZoneRecord Rename
	RenameNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, name string, to string) error

	// UpdateNetworkZoneRecordConfig updates the NetworkZoneRecord Config matching the given key parameters.
	// generator: NetworkZoneRecord Update
	UpdateNetworkZoneRecordConfig(ctx context.Context, db tx, networkZoneRecordID int64, config map[string]string) error

	// UpdateNetworkZoneRecord updates the NetworkZoneRecord matching the given key parameters.
	// generator: NetworkZoneRecord Update
	UpdateNetworkZoneRecord(ctx context.Context, db tx, networkZoneID int, name string, object NetworkZoneRecord) error

	// DeleteNetworkZoneRecord deletes the NetworkZoneRecord matching the given key parameters.
	// generator: NetworkZoneRecord DeleteOne-by-NetworkZoneID-and-ID
	DeleteNetworkZoneRecord(ctx context.Context, db dbtx, networkZoneID int, id int) error
}

NetworkZoneRecordGenerated is an interface of generated methods for NetworkZoneRecord.

type Node

type Node struct {
	ID   int
	Name string
}

Node represents a cluster member.

type NodeClusterGroup

type NodeClusterGroup struct {
	GroupID int    `db:"primary=yes"`
	Node    string `db:"join=nodes.name"`
	NodeID  int    `db:"omit=create,objects,objects-by-GroupID"`
}

NodeClusterGroup associates a node to a cluster group.

func GetNodeClusterGroups

func GetNodeClusterGroups(ctx context.Context, db dbtx, filters ...NodeClusterGroupFilter) (_ []NodeClusterGroup, _err error)

GetNodeClusterGroups returns all available node_cluster_groups. generator: node_cluster_group GetMany

type NodeClusterGroupFilter

type NodeClusterGroupFilter struct {
	GroupID *int
}

NodeClusterGroupFilter specifies potential query parameter fields.

type NodeFilter

type NodeFilter struct {
	Name *string
}

NodeFilter specifies potential query parameter fields.

type NodeGenerated

type NodeGenerated interface {
	// GetNodeID return the ID of the node with the given key.
	// generator: node ID
	GetNodeID(ctx context.Context, db tx, name string) (int64, error)
}

NodeGenerated is an interface of generated methods for Node.

type Operation

type Operation struct {
	ID          int64              `db:"primary=yes"`                               // Stable database identifier
	UUID        string             `db:"primary=yes"`                               // User-visible identifier
	NodeAddress string             `db:"join=nodes.address&omit=create-or-replace"` // Address of the node the operation is running on
	ProjectID   *int64             // ID of the project for the operation.
	NodeID      int64              // ID of the node the operation is running on
	Type        operationtype.Type // Type of the operation
}

Operation holds information about a single operation running on a member in the cluster.

func GetOperations

func GetOperations(ctx context.Context, db dbtx, filters ...OperationFilter) (_ []Operation, _err error)

GetOperations returns all available operations. generator: operation GetMany

type OperationFilter

type OperationFilter struct {
	ID     *int64
	NodeID *int64
	UUID   *string
}

OperationFilter specifies potential query parameter fields.

type OperationGenerated

type OperationGenerated interface {
	// GetOperations returns all available operations.
	// generator: operation GetMany
	GetOperations(ctx context.Context, db dbtx, filters ...OperationFilter) ([]Operation, error)

	// CreateOrReplaceOperation adds a new operation to the database.
	// generator: operation CreateOrReplace
	CreateOrReplaceOperation(ctx context.Context, db dbtx, object Operation) (int64, error)

	// DeleteOperation deletes the operation matching the given key parameters.
	// generator: operation DeleteOne-by-UUID
	DeleteOperation(ctx context.Context, db dbtx, uuid string) error

	// DeleteOperations deletes the operation matching the given key parameters.
	// generator: operation DeleteMany-by-NodeID
	DeleteOperations(ctx context.Context, db dbtx, nodeID int64) error
}

OperationGenerated is an interface of generated methods for Operation.

type Profile

type Profile struct {
	ID          int
	ProjectID   int    `db:"omit=create,update"`
	Project     string `db:"primary=yes&join=projects.name"`
	Name        string `db:"primary=yes"`
	Description string `db:"coalesce=''"`
}

Profile is a value object holding db-related details about a profile.

func GetInstanceProfiles

func GetInstanceProfiles(ctx context.Context, db tx, instanceID int) (_ []Profile, _err error)

GetInstanceProfiles returns all available Profiles for the Instance. generator: instance_profile GetMany

func GetProfile

func GetProfile(ctx context.Context, db dbtx, project string, name string) (_ *Profile, _err error)

GetProfile returns the profile with the given key. generator: profile GetOne

func GetProfiles

func GetProfiles(ctx context.Context, db dbtx, filters ...ProfileFilter) (_ []Profile, _err error)

GetProfiles returns all available profiles. generator: profile GetMany

func GetProfilesIfEnabled

func GetProfilesIfEnabled(ctx context.Context, tx *sql.Tx, projectName string, names []string) ([]Profile, error)

GetProfilesIfEnabled returns the profiles from the given project, or the default project if "features.profiles" is not set.

func (*Profile) ToAPI

func (p *Profile) ToAPI(ctx context.Context, tx *sql.Tx, profileConfigs map[int]map[string]string, profileDevices map[int][]Device) (*api.Profile, error)

ToAPI returns a cluster Profile as an API struct.

type ProfileFilter

type ProfileFilter struct {
	ID      *int
	Project *string
	Name    *string
}

ProfileFilter specifies potential query parameter fields.

type ProfileGenerated

type ProfileGenerated interface {
	// GetProfileID return the ID of the profile with the given key.
	// generator: profile ID
	GetProfileID(ctx context.Context, db tx, project string, name string) (int64, error)

	// ProfileExists checks if a profile with the given key exists.
	// generator: profile Exists
	ProfileExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// GetProfileConfig returns all available Profile Config
	// generator: profile GetMany
	GetProfileConfig(ctx context.Context, db tx, profileID int, filters ...ConfigFilter) (map[string]string, error)

	// GetProfileDevices returns all available Profile Devices
	// generator: profile GetMany
	GetProfileDevices(ctx context.Context, db tx, profileID int, filters ...DeviceFilter) (map[string]Device, error)

	// GetProfiles returns all available profiles.
	// generator: profile GetMany
	GetProfiles(ctx context.Context, db dbtx, filters ...ProfileFilter) ([]Profile, error)

	// GetProfile returns the profile with the given key.
	// generator: profile GetOne
	GetProfile(ctx context.Context, db dbtx, project string, name string) (*Profile, error)

	// CreateProfileConfig adds new profile Config to the database.
	// generator: profile Create
	CreateProfileConfig(ctx context.Context, db dbtx, profileID int64, config map[string]string) error

	// CreateProfileDevices adds new profile Devices to the database.
	// generator: profile Create
	CreateProfileDevices(ctx context.Context, db tx, profileID int64, devices map[string]Device) error

	// CreateProfile adds a new profile to the database.
	// generator: profile Create
	CreateProfile(ctx context.Context, db dbtx, object Profile) (int64, error)

	// RenameProfile renames the profile matching the given key parameters.
	// generator: profile Rename
	RenameProfile(ctx context.Context, db dbtx, project string, name string, to string) error

	// UpdateProfileConfig updates the profile Config matching the given key parameters.
	// generator: profile Update
	UpdateProfileConfig(ctx context.Context, db tx, profileID int64, config map[string]string) error

	// UpdateProfileDevices updates the profile Device matching the given key parameters.
	// generator: profile Update
	UpdateProfileDevices(ctx context.Context, db tx, profileID int64, devices map[string]Device) error

	// UpdateProfile updates the profile matching the given key parameters.
	// generator: profile Update
	UpdateProfile(ctx context.Context, db tx, project string, name string, object Profile) error

	// DeleteProfile deletes the profile matching the given key parameters.
	// generator: profile DeleteOne-by-Project-and-Name
	DeleteProfile(ctx context.Context, db dbtx, project string, name string) error
}

ProfileGenerated is an interface of generated methods for Profile.

type Project

type Project struct {
	ID          int
	Description string
	Name        string `db:"omit=update"`
}

Project represents a project.

func GetCertificateProjects

func GetCertificateProjects(ctx context.Context, db tx, certificateID int) (_ []Project, _err error)

GetCertificateProjects returns all available Projects for the Certificate. generator: certificate_project GetMany

func GetProject

func GetProject(ctx context.Context, db dbtx, name string) (_ *Project, _err error)

GetProject returns the project with the given key. generator: project GetOne

func GetProjects

func GetProjects(ctx context.Context, db dbtx, filters ...ProjectFilter) (_ []Project, _err error)

GetProjects returns all available projects. generator: project GetMany

func (*Project) ToAPI

func (p *Project) ToAPI(ctx context.Context, tx *sql.Tx) (*api.Project, error)

ToAPI converts the database Project struct to an api.Project entry.

type ProjectFeature

type ProjectFeature struct {
	// DefaultEnabled
	// Whether the feature should be enabled by default on new projects.
	DefaultEnabled bool

	// CanEnableNonEmpty
	// Whether or not the feature can be changed to enabled on a non-empty project.
	CanEnableNonEmpty bool
}

ProjectFeature indicates the behaviour of a project feature.

type ProjectFilter

type ProjectFilter struct {
	ID   *int
	Name *string `db:"omit=update"` // If non-empty, return only the project with this name.
}

ProjectFilter specifies potential query parameter fields.

type ProjectGenerated

type ProjectGenerated interface {
	// GetProjectConfig returns all available Project Config
	// generator: project GetMany
	GetProjectConfig(ctx context.Context, db tx, projectID int, filters ...ConfigFilter) (map[string]string, error)

	// GetProjects returns all available projects.
	// generator: project GetMany
	GetProjects(ctx context.Context, db dbtx, filters ...ProjectFilter) ([]Project, error)

	// GetProject returns the project with the given key.
	// generator: project GetOne
	GetProject(ctx context.Context, db dbtx, name string) (*Project, error)

	// ProjectExists checks if a project with the given key exists.
	// generator: project Exists
	ProjectExists(ctx context.Context, db dbtx, name string) (bool, error)

	// CreateProjectConfig adds new project Config to the database.
	// generator: project Create
	CreateProjectConfig(ctx context.Context, db dbtx, projectID int64, config map[string]string) error

	// CreateProject adds a new project to the database.
	// generator: project Create
	CreateProject(ctx context.Context, db dbtx, object Project) (int64, error)

	// GetProjectID return the ID of the project with the given key.
	// generator: project ID
	GetProjectID(ctx context.Context, db tx, name string) (int64, error)

	// RenameProject renames the project matching the given key parameters.
	// generator: project Rename
	RenameProject(ctx context.Context, db dbtx, name string, to string) error

	// DeleteProject deletes the project matching the given key parameters.
	// generator: project DeleteOne-by-Name
	DeleteProject(ctx context.Context, db dbtx, name string) error
}

ProjectGenerated is an interface of generated methods for Project.

type Unmarshaler added in v6.0.4

type Unmarshaler interface {
	UnmarshalDB(string) error
}

Unmarshaler is the interface that wraps the UnmarshalDB method, which converts a string representation retrieved from the database into the underlying type.

type Warning

type Warning struct {
	ID             int
	Node           string `db:"coalesce=''&leftjoin=nodes.name"`
	Project        string `db:"coalesce=''&leftjoin=projects.name"`
	EntityTypeCode int    `db:"coalesce=-1"`
	EntityID       int    `db:"coalesce=-1"`
	UUID           string `db:"primary=yes"`
	TypeCode       warningtype.Type
	Status         warningtype.Status
	FirstSeenDate  time.Time
	LastSeenDate   time.Time
	UpdatedDate    time.Time
	LastMessage    string
	Count          int
}

Warning is a value object holding db-related details about a warning.

func GetWarning

func GetWarning(ctx context.Context, db dbtx, uuid string) (_ *Warning, _err error)

GetWarning returns the warning with the given key. generator: warning GetOne-by-UUID

func GetWarnings

func GetWarnings(ctx context.Context, db dbtx, filters ...WarningFilter) (_ []Warning, _err error)

GetWarnings returns all available warnings. generator: warning GetMany

func (Warning) ToAPI

func (w Warning) ToAPI() api.Warning

ToAPI returns an API entry.

type WarningFilter

type WarningFilter struct {
	ID             *int
	UUID           *string
	Project        *string
	Node           *string
	TypeCode       *warningtype.Type
	EntityTypeCode *int
	EntityID       *int
	Status         *warningtype.Status
}

WarningFilter specifies potential query parameter fields.

type WarningGenerated

type WarningGenerated interface {
	// GetWarnings returns all available warnings.
	// generator: warning GetMany
	GetWarnings(ctx context.Context, db dbtx, filters ...WarningFilter) ([]Warning, error)

	// GetWarning returns the warning with the given key.
	// generator: warning GetOne-by-UUID
	GetWarning(ctx context.Context, db dbtx, uuid string) (*Warning, error)

	// DeleteWarning deletes the warning matching the given key parameters.
	// generator: warning DeleteOne-by-UUID
	DeleteWarning(ctx context.Context, db dbtx, uuid string) error

	// DeleteWarnings deletes the warning matching the given key parameters.
	// generator: warning DeleteMany-by-EntityTypeCode-and-EntityID
	DeleteWarnings(ctx context.Context, db dbtx, entityTypeCode int, entityID int) error

	// GetWarningID return the ID of the warning with the given key.
	// generator: warning ID
	GetWarningID(ctx context.Context, db tx, uuid string) (int64, error)

	// WarningExists checks if a warning with the given key exists.
	// generator: warning Exists
	WarningExists(ctx context.Context, db dbtx, uuid string) (bool, error)
}

WarningGenerated is an interface of generated methods for Warning.

Source Files

Jump to

Keyboard shortcuts

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