Documentation ¶
Index ¶
- Constants
- Variables
- func APIToDevices(apiDevices map[string]map[string]string) (map[string]Device, error)
- func AuthGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func CertificateExists(ctx context.Context, tx *sql.Tx, fingerprint string) (bool, error)
- func ClusterGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func CreateAuthGroup(ctx context.Context, tx *sql.Tx, object AuthGroup) (int64, error)
- func CreateCertificate(ctx context.Context, tx *sql.Tx, object Certificate) (int64, error)
- func CreateCertificateProjects(ctx context.Context, tx *sql.Tx, objects []CertificateProject) error
- func CreateCertificateWithProjects(ctx context.Context, tx *sql.Tx, cert Certificate, projectNames []string) (int64, error)
- func CreateClusterGroup(ctx context.Context, tx *sql.Tx, object ClusterGroup) (int64, error)
- func CreateConfig(ctx context.Context, tx *sql.Tx, parent string, object Config) error
- func CreateDevices(ctx context.Context, tx *sql.Tx, parent string, objects map[string]Device) error
- func CreateIdentity(ctx context.Context, tx *sql.Tx, object Identity) (int64, error)
- func CreateIdentityProjects(ctx context.Context, tx *sql.Tx, objects []IdentityProject) error
- func CreateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, object IdentityProviderGroup) (int64, error)
- func CreateInstance(ctx context.Context, tx *sql.Tx, object Instance) (int64, error)
- func CreateInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int64, config map[string]string) error
- func CreateInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int64, devices map[string]Device) error
- func CreateInstanceProfiles(ctx context.Context, tx *sql.Tx, objects []InstanceProfile) error
- func CreateInstanceSnapshot(ctx context.Context, tx *sql.Tx, object InstanceSnapshot) (int64, error)
- func CreateInstanceSnapshotConfig(ctx context.Context, tx *sql.Tx, instanceSnapshotID int64, ...) error
- func CreateInstanceSnapshotDevices(ctx context.Context, tx *sql.Tx, instanceSnapshotID int64, ...) error
- func CreateNodeClusterGroup(ctx context.Context, tx *sql.Tx, object NodeClusterGroup) (int64, error)
- func CreateOrReplaceOperation(ctx context.Context, tx *sql.Tx, object Operation) (int64, error)
- func CreateProfile(ctx context.Context, tx *sql.Tx, object Profile) (int64, error)
- func CreateProfileConfig(ctx context.Context, tx *sql.Tx, profileID int64, config map[string]string) error
- func CreateProfileDevices(ctx context.Context, tx *sql.Tx, profileID int64, devices map[string]Device) error
- func CreateProject(ctx context.Context, tx *sql.Tx, object Project) (int64, error)
- func CreateProjectConfig(ctx context.Context, tx *sql.Tx, projectID int64, config map[string]string) error
- func DeleteAuthGroup(ctx context.Context, tx *sql.Tx, name string) error
- func DeleteCertificate(ctx context.Context, tx *sql.Tx, fingerprint string) error
- func DeleteCertificateProjects(ctx context.Context, tx *sql.Tx, certificateID int) error
- func DeleteCertificates(ctx context.Context, tx *sql.Tx, name string, certificateType certificate.Type) error
- func DeleteClusterGroup(ctx context.Context, tx *sql.Tx, name string) error
- func DeleteConfig(ctx context.Context, tx *sql.Tx, parent string, referenceID int) error
- func DeleteDevices(ctx context.Context, tx *sql.Tx, parent string, referenceID int) error
- func DeleteIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) error
- func DeleteIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int) error
- func DeleteIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string) error
- func DeleteIdentitys(ctx context.Context, tx *sql.Tx, name string, identityType IdentityType) error
- func DeleteInstance(ctx context.Context, tx *sql.Tx, project string, name string) error
- func DeleteInstanceProfiles(ctx context.Context, tx *sql.Tx, instanceID int) error
- func DeleteInstanceSnapshot(ctx context.Context, tx *sql.Tx, project string, instance string, name string) error
- func DeleteNodeClusterGroup(ctx context.Context, tx *sql.Tx, groupID int) error
- func DeleteOperation(ctx context.Context, tx *sql.Tx, uuid string) error
- func DeleteOperations(ctx context.Context, tx *sql.Tx, nodeID int64) error
- func DeleteProfile(ctx context.Context, tx *sql.Tx, project string, name string) error
- func DeleteProject(ctx context.Context, tx *sql.Tx, name string) error
- func DeleteWarning(ctx context.Context, tx *sql.Tx, uuid string) error
- func DeleteWarnings(ctx context.Context, tx *sql.Tx, entityType EntityType, entityID int) error
- func DevicesToAPI(devices map[string]Device) map[string]map[string]string
- func EnsureSchema(db *sql.DB, address string, dir string) (bool, error)
- func FreshSchema() string
- func GetAllAuthGroupsByIdentityIDs(ctx context.Context, tx *sql.Tx) (map[int][]AuthGroup, error)
- func GetAllIdentitiesByAuthGroupIDs(ctx context.Context, tx *sql.Tx) (map[int][]Identity, error)
- func GetAllIdentityProviderGroupsByGroupIDs(ctx context.Context, tx *sql.Tx) (map[int][]IdentityProviderGroup, error)
- func GetAuthGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetCertificateID(ctx context.Context, tx *sql.Tx, fingerprint string) (int64, error)
- func GetClusterGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetConfig(ctx context.Context, tx *sql.Tx, parent string, filters ...ConfigFilter) (map[int]map[string]string, error)
- func GetDevices(ctx context.Context, tx *sql.Tx, parent string, filters ...DeviceFilter) (map[int][]Device, error)
- func GetDistinctAuthGroupNamesFromIDPGroupNames(ctx context.Context, tx *sql.Tx, idpGroupNames []string) ([]string, error)
- func GetEntityURL(ctx context.Context, tx *sql.Tx, entityType entity.Type, entityID int) (*api.URL, error)
- func GetEntityURLs(ctx context.Context, tx *sql.Tx, projectName string, ...) (map[entity.Type]map[int]*api.URL, error)
- func GetIdentityID(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (int64, error)
- func GetIdentityProviderGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int, filters ...ConfigFilter) (map[string]string, error)
- func GetInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int, filters ...DeviceFilter) (map[string]Device, error)
- func GetInstanceID(ctx context.Context, tx *sql.Tx, project string, name string) (int64, error)
- func GetInstanceSnapshotConfig(ctx context.Context, tx *sql.Tx, instanceSnapshotID int, ...) (map[string]string, error)
- func GetInstanceSnapshotDevices(ctx context.Context, tx *sql.Tx, instanceSnapshotID int, ...) (map[string]Device, error)
- func GetInstanceSnapshotID(ctx context.Context, tx *sql.Tx, project string, instance string, name string) (int64, error)
- func GetNodeClusterGroupID(ctx context.Context, tx *sql.Tx, groupID int) (int64, error)
- func GetNodeID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetProfileConfig(ctx context.Context, tx *sql.Tx, profileID int, filters ...ConfigFilter) (map[string]string, error)
- func GetProfileDevices(ctx context.Context, tx *sql.Tx, profileID int, filters ...DeviceFilter) (map[string]Device, error)
- func GetProfileID(ctx context.Context, tx *sql.Tx, project string, name string) (int64, error)
- func GetProjectConfig(ctx context.Context, tx *sql.Tx, projectID int, filters ...ConfigFilter) (map[string]string, error)
- func GetProjectID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetProjectIDsToNames(ctx context.Context, tx *sql.Tx) (map[int64]string, error)
- func GetProjectNames(ctx context.Context, tx *sql.Tx) ([]string, error)
- func GetWarningID(ctx context.Context, tx *sql.Tx, uuid string) (int64, error)
- func IdentityExists(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (bool, error)
- func IdentityProviderGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func InitProjectWithoutImages(ctx context.Context, tx *sql.Tx, project string) error
- func InstanceExists(ctx context.Context, tx *sql.Tx, project string, name string) (bool, error)
- func InstanceSnapshotExists(ctx context.Context, tx *sql.Tx, project string, instance string, name string) (bool, error)
- func NodeClusterGroupExists(ctx context.Context, tx *sql.Tx, groupID int) (bool, error)
- func Open(name string, store driver.NodeStore, options ...driver.Option) (*sql.DB, error)
- func PopulateEntityReferencesFromURLs(ctx context.Context, tx *sql.Tx, entityURLMap map[*api.URL]*EntityRef) error
- func PrepareStmts(db *sql.DB, skipErrors bool) (map[int]*sql.Stmt, error)
- func ProfileExists(ctx context.Context, tx *sql.Tx, project string, name string) (bool, error)
- func ProjectExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func ProjectHasImages(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func ProjectHasProfiles(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func RegisterStmt(sql string) int
- func RenameAuthGroup(ctx context.Context, tx *sql.Tx, name string, to string) error
- func RenameClusterGroup(ctx context.Context, tx *sql.Tx, name string, to string) error
- func RenameIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string, to string) error
- func RenameInstance(ctx context.Context, tx *sql.Tx, project string, name string, to string) error
- func RenameInstanceSnapshot(ctx context.Context, tx *sql.Tx, project string, instance string, name string, ...) error
- func RenameProfile(ctx context.Context, tx *sql.Tx, project string, name string, to string) error
- func RenameProject(ctx context.Context, tx *sql.Tx, name string, to string) error
- func Schema() *schema.Schema
- func SchemaDotGo() error
- func SetAuthGroupPermissions(ctx context.Context, tx *sql.Tx, groupID int, ...) error
- func SetIdentityAuthGroups(ctx context.Context, tx *sql.Tx, identityID int, groupNames []string) error
- func SetIdentityProviderGroupMapping(ctx context.Context, tx *sql.Tx, identityProviderGroupID int, ...) error
- func Stmt(tx *sql.Tx, code int) (*sql.Stmt, error)
- func StmtString(code int) (string, error)
- func UpdateAuthGroup(ctx context.Context, tx *sql.Tx, name string, object AuthGroup) error
- func UpdateCertificate(ctx context.Context, tx *sql.Tx, fingerprint string, object Certificate) error
- func UpdateCertificateProjects(ctx context.Context, tx *sql.Tx, certificateID int, projectNames []string) error
- func UpdateClusterGroup(ctx context.Context, tx *sql.Tx, name string, object ClusterGroup) error
- func UpdateConfig(ctx context.Context, tx *sql.Tx, parent string, referenceID int, ...) error
- func UpdateDevices(ctx context.Context, tx *sql.Tx, parent string, referenceID int, ...) error
- func UpdateIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string, ...) error
- func UpdateIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int, projectNames []string) error
- func UpdateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string, object IdentityProviderGroup) error
- func UpdateInstance(ctx context.Context, tx *sql.Tx, project string, name string, object Instance) error
- func UpdateInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int64, config map[string]string) error
- func UpdateInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int64, devices map[string]Device) error
- func UpdateInstanceProfiles(ctx context.Context, tx *sql.Tx, instanceID int, projectName string, ...) error
- func UpdateProfile(ctx context.Context, tx *sql.Tx, project string, name string, object Profile) error
- func UpdateProfileConfig(ctx context.Context, tx *sql.Tx, profileID int64, config map[string]string) error
- func UpdateProfileDevices(ctx context.Context, tx *sql.Tx, profileID int64, devices map[string]Device) error
- func UpdateProject(ctx context.Context, tx *sql.Tx, name string, object api.ProjectPut) error
- func WarningExists(ctx context.Context, tx *sql.Tx, uuid string) (bool, error)
- type AuthGroup
- func GetAuthGroup(ctx context.Context, tx *sql.Tx, name string) (*AuthGroup, error)
- func GetAuthGroups(ctx context.Context, tx *sql.Tx, filters ...AuthGroupFilter) ([]AuthGroup, error)
- func GetAuthGroupsByIdentityID(ctx context.Context, tx *sql.Tx, identityID int) ([]AuthGroup, error)
- func GetAuthGroupsByIdentityProviderGroupID(ctx context.Context, tx *sql.Tx, idpGroupID int) ([]AuthGroup, error)
- type AuthGroupFilter
- type AuthGroupGenerated
- type AuthMethod
- type Certificate
- func GetCertificate(ctx context.Context, tx *sql.Tx, fingerprint string) (*Certificate, error)
- func GetCertificateByFingerprintPrefix(ctx context.Context, tx *sql.Tx, fingerprintPrefix string) (*Certificate, error)
- func GetCertificates(ctx context.Context, tx *sql.Tx, filters ...CertificateFilter) ([]Certificate, error)
- type CertificateFilter
- type CertificateMetadata
- type CertificateProject
- type CertificateProjectFilter
- type ClusterGroup
- type ClusterGroupFilter
- type ClusterGroupGenerated
- type Config
- type ConfigFilter
- type ConfigGenerated
- type Device
- type DeviceFilter
- type DeviceGenerated
- type DeviceType
- type EntityRef
- type EntityType
- type Identity
- func GetIdentitiesByAuthGroupID(ctx context.Context, tx *sql.Tx, groupID int) ([]Identity, error)
- func GetIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (*Identity, error)
- func GetIdentityByNameOrIdentifier(ctx context.Context, tx *sql.Tx, authenticationMethod string, nameOrID string) (*Identity, error)
- func GetIdentitys(ctx context.Context, tx *sql.Tx, filters ...IdentityFilter) ([]Identity, error)
- type IdentityFilter
- type IdentityGenerated
- type IdentityProject
- type IdentityProjectFilter
- type IdentityProjectGenerated
- type IdentityProviderGroup
- func GetIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string) (*IdentityProviderGroup, error)
- func GetIdentityProviderGroups(ctx context.Context, tx *sql.Tx, filters ...IdentityProviderGroupFilter) ([]IdentityProviderGroup, error)
- func GetIdentityProviderGroupsByGroupID(ctx context.Context, tx *sql.Tx, groupID int) ([]IdentityProviderGroup, error)
- type IdentityProviderGroupFilter
- type IdentityProviderGroupGenerated
- type IdentityType
- type Image
- type ImageFilter
- type ImageGenerated
- type Instance
- type InstanceFilter
- type InstanceGenerated
- type InstanceProfile
- type InstanceProfileFilter
- type InstanceProfileGenerated
- type InstanceSnapshot
- type InstanceSnapshotFilter
- type InstanceSnapshotGenerated
- type Node
- type NodeClusterGroup
- type NodeClusterGroupFilter
- type NodeFilter
- type NodeGenerated
- type OIDCMetadata
- type Operation
- type OperationFilter
- type OperationGenerated
- type Permission
- func GetDistinctPermissionsByGroupNames(ctx context.Context, tx *sql.Tx, groupNames []string) ([]Permission, error)
- func GetPermissionEntityURLs(ctx context.Context, tx *sql.Tx, permissions []Permission) ([]Permission, map[entity.Type]map[int]*api.URL, error)
- func GetPermissions(ctx context.Context, tx *sql.Tx) ([]Permission, error)
- func GetPermissionsByAuthGroupID(ctx context.Context, tx *sql.Tx, groupID int) ([]Permission, error)
- type Profile
- func GetInstanceProfiles(ctx context.Context, tx *sql.Tx, instanceID int) ([]Profile, error)
- func GetProfile(ctx context.Context, tx *sql.Tx, project string, name string) (*Profile, error)
- func GetProfiles(ctx context.Context, tx *sql.Tx, filters ...ProfileFilter) ([]Profile, error)
- func GetProfilesIfEnabled(ctx context.Context, tx *sql.Tx, projectName string, names []string) ([]Profile, error)
- type ProfileFilter
- type ProfileGenerated
- type Project
- func GetCertificateProjects(ctx context.Context, tx *sql.Tx, certificateID int) ([]Project, error)
- func GetIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int) ([]Project, error)
- func GetProject(ctx context.Context, tx *sql.Tx, name string) (*Project, error)
- func GetProjects(ctx context.Context, tx *sql.Tx, filters ...ProjectFilter) ([]Project, error)
- type ProjectFeature
- type ProjectFilter
- type ProjectGenerated
- type Warning
- type WarningFilter
- type WarningGenerated
Constants ¶
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.
const ( StoragePoolVolumeTypeContainer = iota StoragePoolVolumeTypeImage StoragePoolVolumeTypeCustom StoragePoolVolumeTypeVM )
XXX: this was extracted from lxd/storage_volume_utils.go, we find a way to factor it independently from both the db and main packages.
const ( StoragePoolVolumeTypeNameContainer string = "container" StoragePoolVolumeTypeNameVM string = "virtual-machine" StoragePoolVolumeTypeNameImage string = "image" StoragePoolVolumeTypeNameCustom string = "custom" )
Leave the string type in here! This guarantees that go treats this is as a typed string constant. Removing it causes go to treat these as untyped string constants which is not what we want.
const ( StoragePoolVolumeContentTypeFS = iota StoragePoolVolumeContentTypeBlock StoragePoolVolumeContentTypeISO )
Content types.
const ( StoragePoolVolumeContentTypeNameFS string = "filesystem" StoragePoolVolumeContentTypeNameBlock string = "block" StoragePoolVolumeContentTypeNameISO string = "iso" )
Content type names.
Variables ¶
var PreparedStmts = map[int]*sql.Stmt{}
PreparedStmts is a placeholder for transitioning to package-scoped transaction functions.
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.
var SchemaVersion = len(updates)
SchemaVersion is the current version of the cluster database schema.
var StoragePoolVolumeTypeNames = map[int]string{ StoragePoolVolumeTypeContainer: "container", StoragePoolVolumeTypeImage: "image", StoragePoolVolumeTypeCustom: "custom", StoragePoolVolumeTypeVM: "virtual-machine", }
StoragePoolVolumeTypeNames represents a map of storage volume types and their names.
Functions ¶
func APIToDevices ¶
APIToDevices takes an API format devices map and converts it to a map of db.Device.
func AuthGroupExists ¶
AuthGroupExists checks if a auth_group with the given key exists. generator: auth_group Exists
func CertificateExists ¶
CertificateExists checks if a certificate with the given key exists.
func ClusterGroupExists ¶
ClusterGroupExists checks if a cluster_group with the given key exists. generator: cluster_group Exists
func CreateAuthGroup ¶
CreateAuthGroup adds a new auth_group to the database. generator: auth_group Create
func CreateCertificate ¶
CreateCertificate adds a new certificate to the database.
func CreateCertificateProjects ¶
CreateCertificateProjects adds a new certificate_project to the database.
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 ¶
CreateClusterGroup adds a new cluster_group to the database. generator: cluster_group Create
func CreateConfig ¶
CreateConfig adds a new config to the database. generator: config Create
func CreateDevices ¶
CreateDevices adds a new device to the database. generator: device Create
func CreateIdentity ¶
CreateIdentity adds a new identity to the database. generator: identity Create
func CreateIdentityProjects ¶
CreateIdentityProjects adds a new identity_project to the database. generator: identity_project Create
func CreateIdentityProviderGroup ¶
func CreateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, object IdentityProviderGroup) (int64, error)
CreateIdentityProviderGroup adds a new identity_provider_group to the database. generator: identity_provider_group Create
func CreateInstance ¶
CreateInstance adds a new instance to the database. generator: instance Create
func CreateInstanceConfig ¶
func CreateInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int64, config map[string]string) error
CreateInstanceConfig adds new instance Config to the database. generator: instance Create
func CreateInstanceDevices ¶
func CreateInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int64, devices map[string]Device) error
CreateInstanceDevices adds new instance Devices to the database. generator: instance Create
func CreateInstanceProfiles ¶
CreateInstanceProfiles adds a new instance_profile to the database. generator: instance_profile Create
func CreateInstanceSnapshot ¶
func CreateInstanceSnapshot(ctx context.Context, tx *sql.Tx, object InstanceSnapshot) (int64, error)
CreateInstanceSnapshot adds a new instance_snapshot to the database. generator: instance_snapshot Create
func CreateInstanceSnapshotConfig ¶
func CreateInstanceSnapshotConfig(ctx context.Context, tx *sql.Tx, instanceSnapshotID int64, config map[string]string) error
CreateInstanceSnapshotConfig adds new instance_snapshot Config to the database. generator: instance_snapshot Create
func CreateInstanceSnapshotDevices ¶
func CreateInstanceSnapshotDevices(ctx context.Context, tx *sql.Tx, instanceSnapshotID int64, devices map[string]Device) error
CreateInstanceSnapshotDevices adds new instance_snapshot Devices to the database. generator: instance_snapshot Create
func CreateNodeClusterGroup ¶
func CreateNodeClusterGroup(ctx context.Context, tx *sql.Tx, object NodeClusterGroup) (int64, error)
CreateNodeClusterGroup adds a new node_cluster_group to the database. generator: node_cluster_group Create
func CreateOrReplaceOperation ¶
CreateOrReplaceOperation adds a new operation to the database. generator: operation CreateOrReplace
func CreateProfile ¶
CreateProfile adds a new profile to the database. generator: profile Create
func CreateProfileConfig ¶
func CreateProfileConfig(ctx context.Context, tx *sql.Tx, profileID int64, config map[string]string) error
CreateProfileConfig adds new profile Config to the database. generator: profile Create
func CreateProfileDevices ¶
func CreateProfileDevices(ctx context.Context, tx *sql.Tx, profileID int64, devices map[string]Device) error
CreateProfileDevices adds new profile Devices to the database. generator: profile Create
func CreateProject ¶
CreateProject adds a new project to the database. generator: project Create
func CreateProjectConfig ¶
func CreateProjectConfig(ctx context.Context, tx *sql.Tx, projectID int64, config map[string]string) error
CreateProjectConfig adds new project Config to the database. generator: project Create
func DeleteAuthGroup ¶
DeleteAuthGroup deletes the auth_group matching the given key parameters. generator: auth_group DeleteOne-by-Name
func DeleteCertificate ¶
DeleteCertificate deletes the certificate matching the given key parameters.
func DeleteCertificateProjects ¶
DeleteCertificateProjects deletes the certificate_project matching the given key parameters.
func DeleteCertificates ¶
func DeleteCertificates(ctx context.Context, tx *sql.Tx, name string, certificateType certificate.Type) error
DeleteCertificates deletes the certificate matching the given key parameters.
func DeleteClusterGroup ¶
DeleteClusterGroup deletes the cluster_group matching the given key parameters. generator: cluster_group DeleteOne-by-Name
func DeleteConfig ¶
DeleteConfig deletes the config matching the given key parameters. generator: config DeleteMany
func DeleteDevices ¶
DeleteDevices deletes the device matching the given key parameters. generator: device DeleteMany
func DeleteIdentity ¶
func DeleteIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) error
DeleteIdentity deletes the identity matching the given key parameters. generator: identity DeleteOne-by-AuthMethod-and-Identifier
func DeleteIdentityProjects ¶
DeleteIdentityProjects deletes the identity_project matching the given key parameters. generator: identity_project DeleteMany
func DeleteIdentityProviderGroup ¶
DeleteIdentityProviderGroup deletes the identity_provider_group matching the given key parameters. generator: identity_provider_group DeleteOne-by-Name
func DeleteIdentitys ¶
DeleteIdentitys deletes the identity matching the given key parameters. generator: identity DeleteMany-by-Name-and-Type
func DeleteInstance ¶
DeleteInstance deletes the instance matching the given key parameters. generator: instance DeleteOne-by-Project-and-Name
func DeleteInstanceProfiles ¶
DeleteInstanceProfiles deletes the instance_profile matching the given key parameters. generator: instance_profile DeleteMany
func DeleteInstanceSnapshot ¶
func DeleteInstanceSnapshot(ctx context.Context, tx *sql.Tx, project string, instance string, name string) error
DeleteInstanceSnapshot deletes the instance_snapshot matching the given key parameters. generator: instance_snapshot DeleteOne-by-Project-and-Instance-and-Name
func DeleteNodeClusterGroup ¶
DeleteNodeClusterGroup deletes the node_cluster_group matching the given key parameters. generator: node_cluster_group DeleteOne-by-GroupID
func DeleteOperation ¶
DeleteOperation deletes the operation matching the given key parameters. generator: operation DeleteOne-by-UUID
func DeleteOperations ¶
DeleteOperations deletes the operation matching the given key parameters. generator: operation DeleteMany-by-NodeID
func DeleteProfile ¶
DeleteProfile deletes the profile matching the given key parameters. generator: profile DeleteOne-by-Project-and-Name
func DeleteProject ¶
DeleteProject deletes the project matching the given key parameters. generator: project DeleteOne-by-Name
func DeleteWarning ¶
DeleteWarning deletes the warning matching the given key parameters. generator: warning DeleteOne-by-UUID
func DeleteWarnings ¶
DeleteWarnings deletes the warning matching the given key parameters. generator: warning DeleteMany-by-EntityType-and-EntityID
func DevicesToAPI ¶
DevicesToAPI takes a map of devices and converts them to API format.
func EnsureSchema ¶
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 FreshSchema ¶
func FreshSchema() string
FreshSchema returns the fresh schema definition of the global database.
func GetAllAuthGroupsByIdentityIDs ¶
GetAllAuthGroupsByIdentityIDs returns a map of identity ID to slice of groups the identity with that ID is a member of.
func GetAllIdentitiesByAuthGroupIDs ¶
GetAllIdentitiesByAuthGroupIDs returns a map of group IDs to the identities that are members of the group with that ID.
func GetAllIdentityProviderGroupsByGroupIDs ¶
func GetAllIdentityProviderGroupsByGroupIDs(ctx context.Context, tx *sql.Tx) (map[int][]IdentityProviderGroup, error)
GetAllIdentityProviderGroupsByGroupIDs returns a map of group IDs to the IdentityProviderGroups that map to the group with that ID.
func GetAuthGroupID ¶
GetAuthGroupID return the ID of the auth_group with the given key. generator: auth_group ID
func GetCertificateID ¶
GetCertificateID return the ID of the certificate with the given key.
func GetClusterGroupID ¶
GetClusterGroupID return the ID of the cluster_group with the given key. generator: cluster_group ID
func GetConfig ¶
func GetConfig(ctx context.Context, tx *sql.Tx, parent string, filters ...ConfigFilter) (map[int]map[string]string, error)
GetConfig returns all available config. generator: config GetMany
func GetDevices ¶
func GetDevices(ctx context.Context, tx *sql.Tx, parent string, filters ...DeviceFilter) (map[int][]Device, error)
GetDevices returns all available devices for the parent entity. generator: device GetMany
func GetDistinctAuthGroupNamesFromIDPGroupNames ¶
func GetDistinctAuthGroupNamesFromIDPGroupNames(ctx context.Context, tx *sql.Tx, idpGroupNames []string) ([]string, error)
GetDistinctAuthGroupNamesFromIDPGroupNames returns all of the distinct group names that are mapped to from the given list of identity provider group names.
func GetEntityURL ¶
func GetEntityURL(ctx context.Context, tx *sql.Tx, entityType entity.Type, entityID int) (*api.URL, error)
GetEntityURL returns the *api.URL of a single entity by its type and ID.
func GetEntityURLs ¶
func GetEntityURLs(ctx context.Context, tx *sql.Tx, projectName string, entityTypes ...entity.Type) (map[entity.Type]map[int]*api.URL, error)
GetEntityURLs accepts a project name and a variadic of entity types and returns a map of entity.Type to map of entity ID, to *api.URL. This method combines the above queries into a single query using the UNION operator. If no entity types are given, this function will return URLs for all entity types. If no project name is given, this function will return URLs for all projects. This may result in stupendously large queries, so use with caution!
func GetIdentityID ¶
func GetIdentityID(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (int64, error)
GetIdentityID return the ID of the identity with the given key. generator: identity ID
func GetIdentityProviderGroupID ¶
GetIdentityProviderGroupID return the ID of the identity_provider_group with the given key. generator: identity_provider_group ID
func GetInstanceConfig ¶
func GetInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int, filters ...ConfigFilter) (map[string]string, error)
GetInstanceConfig returns all available Instance Config generator: instance GetMany
func GetInstanceDevices ¶
func GetInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int, filters ...DeviceFilter) (map[string]Device, error)
GetInstanceDevices returns all available Instance Devices generator: instance GetMany
func GetInstanceID ¶
GetInstanceID return the ID of the instance with the given key. generator: instance ID
func GetInstanceSnapshotConfig ¶
func GetInstanceSnapshotConfig(ctx context.Context, tx *sql.Tx, instanceSnapshotID int, filters ...ConfigFilter) (map[string]string, error)
GetInstanceSnapshotConfig returns all available InstanceSnapshot Config generator: instance_snapshot GetMany
func GetInstanceSnapshotDevices ¶
func GetInstanceSnapshotDevices(ctx context.Context, tx *sql.Tx, instanceSnapshotID int, filters ...DeviceFilter) (map[string]Device, error)
GetInstanceSnapshotDevices returns all available InstanceSnapshot Devices generator: instance_snapshot GetMany
func GetInstanceSnapshotID ¶
func GetInstanceSnapshotID(ctx context.Context, tx *sql.Tx, project string, instance string, name string) (int64, error)
GetInstanceSnapshotID return the ID of the instance_snapshot with the given key. generator: instance_snapshot ID
func GetNodeClusterGroupID ¶
GetNodeClusterGroupID return the ID of the node_cluster_group with the given key. generator: node_cluster_group ID
func GetProfileConfig ¶
func GetProfileConfig(ctx context.Context, tx *sql.Tx, profileID int, filters ...ConfigFilter) (map[string]string, error)
GetProfileConfig returns all available Profile Config generator: profile GetMany
func GetProfileDevices ¶
func GetProfileDevices(ctx context.Context, tx *sql.Tx, profileID int, filters ...DeviceFilter) (map[string]Device, error)
GetProfileDevices returns all available Profile Devices generator: profile GetMany
func GetProfileID ¶
GetProfileID return the ID of the profile with the given key. generator: profile ID
func GetProjectConfig ¶
func GetProjectConfig(ctx context.Context, tx *sql.Tx, projectID int, filters ...ConfigFilter) (map[string]string, error)
GetProjectConfig returns all available Project Config generator: project GetMany
func GetProjectID ¶
GetProjectID return the ID of the project with the given key. generator: project ID
func GetProjectIDsToNames ¶
GetProjectIDsToNames returns a map associating each prect ID to its project name.
func GetProjectNames ¶
GetProjectNames returns the names of all availablprojects.
func GetWarningID ¶
GetWarningID return the ID of the warning with the given key. generator: warning ID
func IdentityExists ¶
func IdentityExists(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (bool, error)
IdentityExists checks if a identity with the given key exists. generator: identity Exists
func IdentityProviderGroupExists ¶
IdentityProviderGroupExists checks if a identity_provider_group with the given key exists. generator: identity_provider_group Exists
func InitProjectWithoutImages ¶
InitProjectWithoutImages populates the images_profiles table with all images from the default project when a project is created with features.images=false.
func InstanceExists ¶
InstanceExists checks if a instance with the given key exists. generator: instance Exists
func InstanceSnapshotExists ¶
func InstanceSnapshotExists(ctx context.Context, tx *sql.Tx, project string, instance string, name string) (bool, error)
InstanceSnapshotExists checks if a instance_snapshot with the given key exists. generator: instance_snapshot Exists
func NodeClusterGroupExists ¶
NodeClusterGroupExists checks if a node_cluster_group with the given key exists. generator: node_cluster_group Exists
func Open ¶
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 PopulateEntityReferencesFromURLs ¶
func PopulateEntityReferencesFromURLs(ctx context.Context, tx *sql.Tx, entityURLMap map[*api.URL]*EntityRef) error
PopulateEntityReferencesFromURLs populates the values in the given map with entity references corresponding to the api.URL keys. It will return an error if any of the given URLs do not correspond to a LXD entity.
func PrepareStmts ¶
PrepareStmts prepares all registered statements and returns an index from statement code to prepared statement object.
func ProfileExists ¶
ProfileExists checks if a profile with the given key exists. generator: profile Exists
func ProjectExists ¶
ProjectExists checks if a project with the given key exists. generator: project Exists
func ProjectHasImages ¶
ProjectHasImages is a helper to check if a project has the images feature enabled.
func ProjectHasProfiles ¶
ProjectHasProfiles is a helper to check if a project has the profiles feature enabled.
func RegisterStmt ¶
RegisterStmt register a SQL statement.
Registered statements will be prepared upfront and re-used, to speed up execution.
Return a unique registration code.
func RenameAuthGroup ¶
RenameAuthGroup renames the auth_group matching the given key parameters. generator: auth_group Rename
func RenameClusterGroup ¶
RenameClusterGroup renames the cluster_group matching the given key parameters. generator: cluster_group Rename
func RenameIdentityProviderGroup ¶
RenameIdentityProviderGroup renames the identity_provider_group matching the given key parameters. generator: identity_provider_group Rename
func RenameInstance ¶
RenameInstance renames the instance matching the given key parameters. generator: instance Rename
func RenameInstanceSnapshot ¶
func RenameInstanceSnapshot(ctx context.Context, tx *sql.Tx, project string, instance string, name string, to string) error
RenameInstanceSnapshot renames the instance_snapshot matching the given key parameters. generator: instance_snapshot Rename
func RenameProfile ¶
RenameProfile renames the profile matching the given key parameters. generator: profile Rename
func RenameProject ¶
RenameProject renames the project matching the given key parameters. generator: project Rename
func SchemaDotGo ¶
func SchemaDotGo() error
SchemaDotGo refreshes the schema.go file in this package, using the updates defined here.
func SetAuthGroupPermissions ¶
func SetAuthGroupPermissions(ctx context.Context, tx *sql.Tx, groupID int, authGroupPermissions []Permission) error
SetAuthGroupPermissions deletes all auth_group -> permission mappings from the `auth_group_permissions` table where the group ID is equal to the given value. Then it inserts a new row for each given permission ID.
func SetIdentityAuthGroups ¶
func SetIdentityAuthGroups(ctx context.Context, tx *sql.Tx, identityID int, groupNames []string) error
SetIdentityAuthGroups deletes all auth_group -> identity mappings from the `identities_auth_groups` table where the identity ID is equal to the given value. Then it inserts new associations into the table where the group IDs correspond to the given group names.
func SetIdentityProviderGroupMapping ¶
func SetIdentityProviderGroupMapping(ctx context.Context, tx *sql.Tx, identityProviderGroupID int, groupNames []string) error
SetIdentityProviderGroupMapping deletes all auth_group -> identity_provider_group mappings from the `ath_groups_identity_provider_groups` table where the identity provider group ID is equal to the given value. Then it inserts new assocations into the table where the group IDs correspond to the given group names.
func StmtString ¶
StmtString returns the in-memory query string with the given code.
func UpdateAuthGroup ¶
UpdateAuthGroup updates the auth_group matching the given key parameters. generator: auth_group Update
func UpdateCertificate ¶
func UpdateCertificate(ctx context.Context, tx *sql.Tx, fingerprint string, object Certificate) error
UpdateCertificate updates the certificate matching the given key parameters.
func UpdateCertificateProjects ¶
func UpdateCertificateProjects(ctx context.Context, tx *sql.Tx, certificateID int, projectNames []string) error
UpdateCertificateProjects updates the certificate_project matching the given key parameters.
func UpdateClusterGroup ¶
UpdateClusterGroup updates the cluster_group matching the given key parameters. generator: cluster_group Update
func UpdateConfig ¶
func UpdateConfig(ctx context.Context, tx *sql.Tx, parent string, referenceID int, config map[string]string) error
UpdateConfig updates the config matching the given key parameters. generator: config Update
func UpdateDevices ¶
func UpdateDevices(ctx context.Context, tx *sql.Tx, parent string, referenceID int, devices map[string]Device) error
UpdateDevices updates the device matching the given key parameters. generator: device Update
func UpdateIdentity ¶
func UpdateIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string, object Identity) error
UpdateIdentity updates the identity matching the given key parameters. generator: identity Update
func UpdateIdentityProjects ¶
func UpdateIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int, projectNames []string) error
UpdateIdentityProjects updates the identity_project matching the given key parameters. generator: identity_project Update
func UpdateIdentityProviderGroup ¶
func UpdateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string, object IdentityProviderGroup) error
UpdateIdentityProviderGroup updates the identity_provider_group matching the given key parameters. generator: identity_provider_group Update
func UpdateInstance ¶
func UpdateInstance(ctx context.Context, tx *sql.Tx, project string, name string, object Instance) error
UpdateInstance updates the instance matching the given key parameters. generator: instance Update
func UpdateInstanceConfig ¶
func UpdateInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int64, config map[string]string) error
UpdateInstanceConfig updates the instance Config matching the given key parameters. generator: instance Update
func UpdateInstanceDevices ¶
func UpdateInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int64, devices map[string]Device) 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 UpdateProfile ¶
func UpdateProfile(ctx context.Context, tx *sql.Tx, project string, name string, object Profile) error
UpdateProfile updates the profile matching the given key parameters. generator: profile Update
func UpdateProfileConfig ¶
func UpdateProfileConfig(ctx context.Context, tx *sql.Tx, profileID int64, config map[string]string) error
UpdateProfileConfig updates the profile Config matching the given key parameters. generator: profile Update
func UpdateProfileDevices ¶
func UpdateProfileDevices(ctx context.Context, tx *sql.Tx, profileID int64, devices map[string]Device) error
UpdateProfileDevices updates the profile Device matching the given key parameters. generator: profile Update
func UpdateProject ¶
UpdateProject updates the project matching the given key parameters.
Types ¶
type AuthGroup ¶
AuthGroup is the database representation of an api.AuthGroup.
func GetAuthGroup ¶
GetAuthGroup returns the auth_group with the given key. generator: auth_group GetOne
func GetAuthGroups ¶
func GetAuthGroups(ctx context.Context, tx *sql.Tx, filters ...AuthGroupFilter) ([]AuthGroup, error)
GetAuthGroups returns all available auth_groups. generator: auth_group GetMany
func GetAuthGroupsByIdentityID ¶
func GetAuthGroupsByIdentityID(ctx context.Context, tx *sql.Tx, identityID int) ([]AuthGroup, error)
GetAuthGroupsByIdentityID returns a slice of groups that the identity with the given ID is a member of.
type AuthGroupFilter ¶
AuthGroupFilter contains fields upon which an AuthGroup can be filtered.
type AuthGroupGenerated ¶
type AuthGroupGenerated interface { // GetAuthGroups returns all available auth_groups. // generator: auth_group GetMany GetAuthGroups(ctx context.Context, tx *sql.Tx, filters ...AuthGroupFilter) ([]AuthGroup, error) // GetAuthGroup returns the auth_group with the given key. // generator: auth_group GetOne GetAuthGroup(ctx context.Context, tx *sql.Tx, name string) (*AuthGroup, error) // GetAuthGroupID return the ID of the auth_group with the given key. // generator: auth_group ID GetAuthGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error) // AuthGroupExists checks if a auth_group with the given key exists. // generator: auth_group Exists AuthGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error) // CreateAuthGroup adds a new auth_group to the database. // generator: auth_group Create CreateAuthGroup(ctx context.Context, tx *sql.Tx, object AuthGroup) (int64, error) // DeleteAuthGroup deletes the auth_group matching the given key parameters. // generator: auth_group DeleteOne-by-Name DeleteAuthGroup(ctx context.Context, tx *sql.Tx, name string) error // UpdateAuthGroup updates the auth_group matching the given key parameters. // generator: auth_group Update UpdateAuthGroup(ctx context.Context, tx *sql.Tx, name string, object AuthGroup) error // RenameAuthGroup renames the auth_group matching the given key parameters. // generator: auth_group Rename RenameAuthGroup(ctx context.Context, tx *sql.Tx, name string, to string) error }
AuthGroupGenerated is an interface of generated methods for AuthGroup.
type AuthMethod ¶
type AuthMethod string
AuthMethod is a database representation of an authentication method.
AuthMethod is defined on string so that API constants can be converted by casting. The sql.Scanner and driver.Valuer interfaces are implemented on this type such that the string constants are converted into their int64 counterparts as they are written to the database, or converted back into an AuthMethod as they are read from the database. It is not possible to read/write an invalid authentication methods from/to the database when using this type.
func (*AuthMethod) Scan ¶
func (a *AuthMethod) Scan(value any) error
Scan implements sql.Scanner for AuthMethod. This converts the integer value back into the correct API constant or returns an error.
type Certificate ¶
type Certificate struct { ID int Fingerprint string `db:"primary=yes"` Type certificate.Type Name string Certificate string Restricted bool }
Certificate is here to pass the certificates content from the database around.
func GetCertificate ¶
GetCertificate returns the certificate with the given key.
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, tx *sql.Tx, filters ...CertificateFilter) ([]Certificate, error)
GetCertificates returns all available certificates.
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.
func (Certificate) ToIdentity ¶
func (cert Certificate) ToIdentity() (*Identity, error)
ToIdentity converts a Certificate to an Identity.
func (*Certificate) ToIdentityType ¶
func (cert *Certificate) ToIdentityType() (IdentityType, error)
ToIdentityType returns a suitable IdentityType for the certificate.
type CertificateFilter ¶
type CertificateFilter struct { ID *int Fingerprint *string Name *string Type *certificate.Type }
CertificateFilter specifies potential query parameter fields.
type CertificateMetadata ¶
type CertificateMetadata struct {
Certificate string `json:"cert"`
}
CertificateMetadata contains metadata for certificate identities. Currently this is only the certificate itself.
func (CertificateMetadata) X509 ¶
func (c CertificateMetadata) X509() (*x509.Certificate, error)
X509 returns an x509.Certificate from the CertificateMetadata.
type CertificateProject ¶
CertificateProject is an association table struct that associates Certificates to Projects.
type CertificateProjectFilter ¶
CertificateProjectFilter specifies potential query parameter fields.
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 ¶
GetClusterGroup returns the cluster_group with the given key. generator: cluster_group GetOne
func GetClusterGroups ¶
func GetClusterGroups(ctx context.Context, tx *sql.Tx, filters ...ClusterGroupFilter) ([]ClusterGroup, error)
GetClusterGroups returns all available cluster_groups. generator: cluster_group GetMany
func (*ClusterGroup) ToAPI ¶
func (c *ClusterGroup) ToAPI() (*api.ClusterGroup, error)
ToAPI returns a LXD API entry.
type ClusterGroupFilter ¶
ClusterGroupFilter specifies potential query parameter fields.
type ClusterGroupGenerated ¶
type ClusterGroupGenerated interface { // GetClusterGroups returns all available cluster_groups. // generator: cluster_group GetMany GetClusterGroups(ctx context.Context, tx *sql.Tx, filters ...ClusterGroupFilter) ([]ClusterGroup, error) // GetClusterGroup returns the cluster_group with the given key. // generator: cluster_group GetOne GetClusterGroup(ctx context.Context, tx *sql.Tx, name string) (*ClusterGroup, error) // GetClusterGroupID return the ID of the cluster_group with the given key. // generator: cluster_group ID GetClusterGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error) // ClusterGroupExists checks if a cluster_group with the given key exists. // generator: cluster_group Exists ClusterGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error) // RenameClusterGroup renames the cluster_group matching the given key parameters. // generator: cluster_group Rename RenameClusterGroup(ctx context.Context, tx *sql.Tx, name string, to string) error // CreateClusterGroup adds a new cluster_group to the database. // generator: cluster_group Create CreateClusterGroup(ctx context.Context, tx *sql.Tx, object ClusterGroup) (int64, error) // UpdateClusterGroup updates the cluster_group matching the given key parameters. // generator: cluster_group Update UpdateClusterGroup(ctx context.Context, tx *sql.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, tx *sql.Tx, name string) error }
ClusterGroupGenerated is an interface of generated methods for ClusterGroup.
type ConfigFilter ¶
ConfigFilter specifies potential query parameter fields.
type ConfigGenerated ¶
type ConfigGenerated interface { // GetConfig returns all available config. // generator: config GetMany GetConfig(ctx context.Context, tx *sql.Tx, parent string, filters ...ConfigFilter) (map[int]map[string]string, error) // CreateConfig adds a new config to the database. // generator: config Create CreateConfig(ctx context.Context, tx *sql.Tx, parent string, object Config) error // UpdateConfig updates the config matching the given key parameters. // generator: config Update UpdateConfig(ctx context.Context, tx *sql.Tx, parent string, referenceID int, config map[string]string) error // DeleteConfig deletes the config matching the given key parameters. // generator: config DeleteMany DeleteConfig(ctx context.Context, tx *sql.Tx, parent string, referenceID int) error }
ConfigGenerated is an interface of generated methods for Config.
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, tx *sql.Tx, parent string, filters ...DeviceFilter) (map[int][]Device, error) // CreateDevices adds a new device to the database. // generator: device Create CreateDevices(ctx context.Context, tx *sql.Tx, parent string, objects map[string]Device) error // UpdateDevices updates the device matching the given key parameters. // generator: device Update UpdateDevices(ctx context.Context, tx *sql.Tx, parent string, referenceID int, devices map[string]Device) error // DeleteDevices deletes the device matching the given key parameters. // generator: device DeleteMany DeleteDevices(ctx context.Context, tx *sql.Tx, parent 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 EntityRef ¶
type EntityRef struct { EntityType EntityType EntityID int ProjectName string Location string PathArgs []string }
EntityRef represents the expected format of entity URL queries.
func GetEntityReferenceFromURL ¶
func GetEntityReferenceFromURL(ctx context.Context, tx *sql.Tx, entityURL *api.URL) (*EntityRef, error)
GetEntityReferenceFromURL gets a single EntityRef by parsing the given api.URL and finding the ID of the entity. It is used by the OpenFGA datastore implementation to find permissions for the entity with the given URL.
type EntityType ¶
type EntityType string
EntityType is a database representation of an entity type.
EntityType is defined on string so that entity.Type constants can be converted by casting. The sql.Scanner and driver.Valuer interfaces are implemented on this type such that the string constants are converted into their int64 counterparts as they are written to the database, or converted back into an EntityType as they are read from the database. It is not possible to read/write invalid entity types from/to the database when using this type.
func (*EntityType) Scan ¶
func (e *EntityType) Scan(value any) error
Scan implements sql.Scanner for EntityType. This converts the integer value back into the correct entity.Type constant or returns an error.
type Identity ¶
type Identity struct { ID int AuthMethod AuthMethod `db:"primary=yes"` Type IdentityType Identifier string `db:"primary=yes"` Name string Metadata string }
Identity is a database representation of any authenticated party.
func GetIdentitiesByAuthGroupID ¶
GetIdentitiesByAuthGroupID returns the identities that are members of the group with the given ID.
func GetIdentity ¶
func GetIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (*Identity, error)
GetIdentity returns the identity with the given key. generator: identity GetOne
func GetIdentityByNameOrIdentifier ¶
func GetIdentityByNameOrIdentifier(ctx context.Context, tx *sql.Tx, authenticationMethod string, nameOrID string) (*Identity, error)
GetIdentityByNameOrIdentifier attempts to get an identity by the authentication method and identifier. If that fails it will try to use the nameOrID argument as a name and will return the result only if the query matches a single Identity. It will return an api.StatusError with http.StatusNotFound if none are found or http.StatusBadRequest if multiple are found.
func GetIdentitys ¶
GetIdentitys returns all available identitys. generator: identity GetMany
func (Identity) Subject ¶
Subject returns OIDC subject from the identity metadata. The AuthMethod of the Identity must be api.AuthenticationMethodOIDC.
func (*Identity) ToAPI ¶
func (i *Identity) ToAPI(ctx context.Context, tx *sql.Tx, canViewGroup auth.PermissionChecker) (*api.Identity, error)
ToAPI converts an Identity to an api.Identity, executing database queries as necessary.
func (Identity) ToCertificate ¶
func (i Identity) ToCertificate() (*Certificate, error)
ToCertificate converts an Identity to a Certificate.
type IdentityFilter ¶
type IdentityFilter struct { ID *int AuthMethod *AuthMethod Type *IdentityType Identifier *string Name *string }
IdentityFilter contains fields upon which identities can be filtered.
type IdentityGenerated ¶
type IdentityGenerated interface { // GetIdentitys returns all available identitys. // generator: identity GetMany GetIdentitys(ctx context.Context, tx *sql.Tx, filters ...IdentityFilter) ([]Identity, error) // GetIdentity returns the identity with the given key. // generator: identity GetOne GetIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (*Identity, error) // GetIdentityID return the ID of the identity with the given key. // generator: identity ID GetIdentityID(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (int64, error) // IdentityExists checks if a identity with the given key exists. // generator: identity Exists IdentityExists(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) (bool, error) // CreateIdentity adds a new identity to the database. // generator: identity Create CreateIdentity(ctx context.Context, tx *sql.Tx, object Identity) (int64, error) // DeleteIdentity deletes the identity matching the given key parameters. // generator: identity DeleteOne-by-AuthMethod-and-Identifier DeleteIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string) error // DeleteIdentitys deletes the identity matching the given key parameters. // generator: identity DeleteMany-by-Name-and-Type DeleteIdentitys(ctx context.Context, tx *sql.Tx, name string, identityType IdentityType) error // UpdateIdentity updates the identity matching the given key parameters. // generator: identity Update UpdateIdentity(ctx context.Context, tx *sql.Tx, authMethod AuthMethod, identifier string, object Identity) error }
IdentityGenerated is an interface of generated methods for Identity.
type IdentityProject ¶
IdentityProject is an association table struct that associates identities to projects.
type IdentityProjectFilter ¶
IdentityProjectFilter specifies potential query parameter fields.
type IdentityProjectGenerated ¶
type IdentityProjectGenerated interface { // GetIdentityProjects returns all available Projects for the Identity. // generator: identity_project GetMany GetIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int) ([]Project, error) // DeleteIdentityProjects deletes the identity_project matching the given key parameters. // generator: identity_project DeleteMany DeleteIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int) error // CreateIdentityProjects adds a new identity_project to the database. // generator: identity_project Create CreateIdentityProjects(ctx context.Context, tx *sql.Tx, objects []IdentityProject) error // UpdateIdentityProjects updates the identity_project matching the given key parameters. // generator: identity_project Update UpdateIdentityProjects(ctx context.Context, tx *sql.Tx, identityID int, projectNames []string) error }
IdentityProjectGenerated is an interface of generated methods for IdentityProject.
type IdentityProviderGroup ¶
IdentityProviderGroup is the database representation of an api.IdentityProviderGroup.
func GetIdentityProviderGroup ¶
func GetIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string) (*IdentityProviderGroup, error)
GetIdentityProviderGroup returns the identity_provider_group with the given key. generator: identity_provider_group GetOne
func GetIdentityProviderGroups ¶
func GetIdentityProviderGroups(ctx context.Context, tx *sql.Tx, filters ...IdentityProviderGroupFilter) ([]IdentityProviderGroup, error)
GetIdentityProviderGroups returns all available identity_provider_groups. generator: identity_provider_group GetMany
func GetIdentityProviderGroupsByGroupID ¶
func GetIdentityProviderGroupsByGroupID(ctx context.Context, tx *sql.Tx, groupID int) ([]IdentityProviderGroup, error)
GetIdentityProviderGroupsByGroupID returns the identity provider groups that map to the group with the given ID.
func (*IdentityProviderGroup) ToAPI ¶
func (i *IdentityProviderGroup) ToAPI(ctx context.Context, tx *sql.Tx, canViewGroup auth.PermissionChecker) (*api.IdentityProviderGroup, error)
ToAPI converts the IdentityProviderGroup to an api.IdentityProviderGroup, making more database calls as necessary.
type IdentityProviderGroupFilter ¶
IdentityProviderGroupFilter contains the columns that a queries for identity provider groups can be filtered upon.
type IdentityProviderGroupGenerated ¶
type IdentityProviderGroupGenerated interface { // GetIdentityProviderGroups returns all available identity_provider_groups. // generator: identity_provider_group GetMany GetIdentityProviderGroups(ctx context.Context, tx *sql.Tx, filters ...IdentityProviderGroupFilter) ([]IdentityProviderGroup, error) // GetIdentityProviderGroup returns the identity_provider_group with the given key. // generator: identity_provider_group GetOne GetIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string) (*IdentityProviderGroup, error) // GetIdentityProviderGroupID return the ID of the identity_provider_group with the given key. // generator: identity_provider_group ID GetIdentityProviderGroupID(ctx context.Context, tx *sql.Tx, name string) (int64, error) // IdentityProviderGroupExists checks if a identity_provider_group with the given key exists. // generator: identity_provider_group Exists IdentityProviderGroupExists(ctx context.Context, tx *sql.Tx, name string) (bool, error) // CreateIdentityProviderGroup adds a new identity_provider_group to the database. // generator: identity_provider_group Create CreateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, object IdentityProviderGroup) (int64, error) // DeleteIdentityProviderGroup deletes the identity_provider_group matching the given key parameters. // generator: identity_provider_group DeleteOne-by-Name DeleteIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string) error // UpdateIdentityProviderGroup updates the identity_provider_group matching the given key parameters. // generator: identity_provider_group Update UpdateIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string, object IdentityProviderGroup) error // RenameIdentityProviderGroup renames the identity_provider_group matching the given key parameters. // generator: identity_provider_group Rename RenameIdentityProviderGroup(ctx context.Context, tx *sql.Tx, name string, to string) error }
IdentityProviderGroupGenerated is an interface of generated methods for IdentityProviderGroup.
type IdentityType ¶
type IdentityType string
IdentityType indicates the type of the identity.
IdentityType is defined on string so that API constants can be converted by casting. The sql.Scanner and driver.Valuer interfaces are implemented on this type such that the string constants are converted into their int64 counterparts as they are written to the database, or converted back into an IdentityType as they are read from the database. It is not possible to read/write an invalid identity types from/to the database when using this type.
func (*IdentityType) Scan ¶
func (i *IdentityType) Scan(value any) error
Scan implements sql.Scanner for IdentityType. This converts the integer value back into the correct API constant or returns an error.
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.
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, tx *sql.Tx, filters ...ImageFilter) ([]Image, error) // GetImage returns the image with the given key. // generator: image GetOne GetImage(ctx context.Context, tx *sql.Tx, 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 ¶
GetInstance returns the instance with the given key. generator: instance GetOne
func GetInstances ¶
GetInstances returns all available instances. generator: instance GetMany
func GetProfileInstances ¶
GetProfileInstances returns all available Instances for the Profile. generator: instance_profile GetMany
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, tx *sql.Tx, instanceID int, filters ...ConfigFilter) (map[string]string, error) // GetInstanceDevices returns all available Instance Devices // generator: instance GetMany GetInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int, filters ...DeviceFilter) (map[string]Device, error) // GetInstances returns all available instances. // generator: instance GetMany GetInstances(ctx context.Context, tx *sql.Tx, filters ...InstanceFilter) ([]Instance, error) // GetInstance returns the instance with the given key. // generator: instance GetOne GetInstance(ctx context.Context, tx *sql.Tx, project string, name string) (*Instance, error) // GetInstanceID return the ID of the instance with the given key. // generator: instance ID GetInstanceID(ctx context.Context, tx *sql.Tx, project string, name string) (int64, error) // InstanceExists checks if a instance with the given key exists. // generator: instance Exists InstanceExists(ctx context.Context, tx *sql.Tx, project string, name string) (bool, error) // CreateInstanceConfig adds new instance Config to the database. // generator: instance Create CreateInstanceConfig(ctx context.Context, tx *sql.Tx, instanceID int64, config map[string]string) error // CreateInstanceDevices adds new instance Devices to the database. // generator: instance Create CreateInstanceDevices(ctx context.Context, tx *sql.Tx, instanceID int64, devices map[string]Device) error // CreateInstance adds a new instance to the database. // generator: instance Create CreateInstance(ctx context.Context, tx *sql.Tx, object Instance) (int64, error) // RenameInstance renames the instance matching the given key parameters. // generator: instance Rename RenameInstance(ctx context.Context, tx *sql.Tx, 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, tx *sql.Tx, project string, name string) error // UpdateInstanceConfig updates the instance Config matching the given key parameters. // generator: instance Update UpdateInstanceConfig(ctx context.Context, tx *sql.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, tx *sql.Tx, instanceID int64, devices map[string]Device) error // UpdateInstance updates the instance matching the given key parameters. // generator: instance Update UpdateInstance(ctx context.Context, tx *sql.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 ¶
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, tx *sql.Tx, profileID int) ([]Instance, error) // GetInstanceProfiles returns all available Profiles for the Instance. // generator: instance_profile GetMany GetInstanceProfiles(ctx context.Context, tx *sql.Tx, instanceID int) ([]Profile, error) // CreateInstanceProfiles adds a new instance_profile to the database. // generator: instance_profile Create CreateInstanceProfiles(ctx context.Context, tx *sql.Tx, objects []InstanceProfile) error // DeleteInstanceProfiles deletes the instance_profile matching the given key parameters. // generator: instance_profile DeleteMany DeleteInstanceProfiles(ctx context.Context, tx *sql.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, tx *sql.Tx, project string, instance string, name string) (*InstanceSnapshot, error)
GetInstanceSnapshot returns the instance_snapshot with the given key. generator: instance_snapshot GetOne
func GetInstanceSnapshots ¶
func GetInstanceSnapshots(ctx context.Context, tx *sql.Tx, filters ...InstanceSnapshotFilter) ([]InstanceSnapshot, 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 ¶
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, tx *sql.Tx, instanceSnapshotID int, filters ...ConfigFilter) (map[string]string, error) // GetInstanceSnapshotDevices returns all available InstanceSnapshot Devices // generator: instance_snapshot GetMany GetInstanceSnapshotDevices(ctx context.Context, tx *sql.Tx, instanceSnapshotID int, filters ...DeviceFilter) (map[string]Device, error) // GetInstanceSnapshots returns all available instance_snapshots. // generator: instance_snapshot GetMany GetInstanceSnapshots(ctx context.Context, tx *sql.Tx, filters ...InstanceSnapshotFilter) ([]InstanceSnapshot, error) // GetInstanceSnapshot returns the instance_snapshot with the given key. // generator: instance_snapshot GetOne GetInstanceSnapshot(ctx context.Context, tx *sql.Tx, 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, tx *sql.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, tx *sql.Tx, 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, tx *sql.Tx, instanceSnapshotID int64, config map[string]string) error // CreateInstanceSnapshotDevices adds new instance_snapshot Devices to the database. // generator: instance_snapshot Create CreateInstanceSnapshotDevices(ctx context.Context, tx *sql.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, tx *sql.Tx, object InstanceSnapshot) (int64, error) // RenameInstanceSnapshot renames the instance_snapshot matching the given key parameters. // generator: instance_snapshot Rename RenameInstanceSnapshot(ctx context.Context, tx *sql.Tx, 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, tx *sql.Tx, project string, instance string, name string) error }
InstanceSnapshotGenerated is an interface of generated methods for InstanceSnapshot.
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, tx *sql.Tx, filters ...NodeClusterGroupFilter) ([]NodeClusterGroup, 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, tx *sql.Tx, name string) (int64, error) }
NodeGenerated is an interface of generated methods for Node.
type OIDCMetadata ¶
type OIDCMetadata struct {
Subject string `json:"subject"`
}
OIDCMetadata contains metadata for OIDC identities.
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 LXD operation running on a node in the cluster.
func GetOperations ¶
func GetOperations(ctx context.Context, tx *sql.Tx, filters ...OperationFilter) ([]Operation, error)
GetOperations returns all available operations. generator: operation GetMany
type OperationFilter ¶
OperationFilter specifies potential query parameter fields.
type OperationGenerated ¶
type OperationGenerated interface { // GetOperations returns all available operations. // generator: operation GetMany GetOperations(ctx context.Context, tx *sql.Tx, filters ...OperationFilter) ([]Operation, error) // CreateOrReplaceOperation adds a new operation to the database. // generator: operation CreateOrReplace CreateOrReplaceOperation(ctx context.Context, tx *sql.Tx, object Operation) (int64, error) // DeleteOperation deletes the operation matching the given key parameters. // generator: operation DeleteOne-by-UUID DeleteOperation(ctx context.Context, tx *sql.Tx, uuid string) error // DeleteOperations deletes the operation matching the given key parameters. // generator: operation DeleteMany-by-NodeID DeleteOperations(ctx context.Context, tx *sql.Tx, nodeID int64) error }
OperationGenerated is an interface of generated methods for Operation.
type Permission ¶
type Permission struct { ID int GroupID int Entitlement auth.Entitlement EntityType EntityType EntityID int }
Permission is the database representation of an api.Permission.
func GetDistinctPermissionsByGroupNames ¶
func GetDistinctPermissionsByGroupNames(ctx context.Context, tx *sql.Tx, groupNames []string) ([]Permission, error)
GetDistinctPermissionsByGroupNames gets all distinct permissions that the groups with the given names have been granted.
func GetPermissionEntityURLs ¶
func GetPermissionEntityURLs(ctx context.Context, tx *sql.Tx, permissions []Permission) ([]Permission, map[entity.Type]map[int]*api.URL, error)
GetPermissionEntityURLs accepts a slice of Permission as input. The input Permission slice may include permissions that are no longer valid because the entity against which they are defined no longer exists. This method determines which permissions are valid and which are not valid by attempting to retrieve their entity URL. It uses as few queries as possible to do this. It returns a slice of valid permissions and a map of entity.Type, to entity ID, to api.URL. The returned map contains the URL of the entity of each returned valid permission. It is used for populating api.Permission. A warning is logged if any invalid permissions are found. And error is returned if any query returns unexpected error.
func GetPermissions ¶
GetPermissions returns a map of group ID to the permissions that belong to the auth group with that ID.
func GetPermissionsByAuthGroupID ¶
func GetPermissionsByAuthGroupID(ctx context.Context, tx *sql.Tx, groupID int) ([]Permission, error)
GetPermissionsByAuthGroupID returns the permissions that belong to the group with the given ID.
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 ¶
GetInstanceProfiles returns all available Profiles for the Instance. generator: instance_profile GetMany
func GetProfile ¶
GetProfile returns the profile with the given key. generator: profile GetOne
func GetProfiles ¶
GetProfiles returns all available profiles. generator: profile GetMany
type ProfileFilter ¶
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, tx *sql.Tx, project string, name string) (int64, error) // ProfileExists checks if a profile with the given key exists. // generator: profile Exists ProfileExists(ctx context.Context, tx *sql.Tx, project string, name string) (bool, error) // GetProfileConfig returns all available Profile Config // generator: profile GetMany GetProfileConfig(ctx context.Context, tx *sql.Tx, profileID int, filters ...ConfigFilter) (map[string]string, error) // GetProfileDevices returns all available Profile Devices // generator: profile GetMany GetProfileDevices(ctx context.Context, tx *sql.Tx, profileID int, filters ...DeviceFilter) (map[string]Device, error) // GetProfiles returns all available profiles. // generator: profile GetMany GetProfiles(ctx context.Context, tx *sql.Tx, filters ...ProfileFilter) ([]Profile, error) // GetProfile returns the profile with the given key. // generator: profile GetOne GetProfile(ctx context.Context, tx *sql.Tx, project string, name string) (*Profile, error) // CreateProfileConfig adds new profile Config to the database. // generator: profile Create CreateProfileConfig(ctx context.Context, tx *sql.Tx, profileID int64, config map[string]string) error // CreateProfileDevices adds new profile Devices to the database. // generator: profile Create CreateProfileDevices(ctx context.Context, tx *sql.Tx, profileID int64, devices map[string]Device) error // CreateProfile adds a new profile to the database. // generator: profile Create CreateProfile(ctx context.Context, tx *sql.Tx, object Profile) (int64, error) // RenameProfile renames the profile matching the given key parameters. // generator: profile Rename RenameProfile(ctx context.Context, tx *sql.Tx, project string, name string, to string) error // UpdateProfileConfig updates the profile Config matching the given key parameters. // generator: profile Update UpdateProfileConfig(ctx context.Context, tx *sql.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, tx *sql.Tx, profileID int64, devices map[string]Device) error // UpdateProfile updates the profile matching the given key parameters. // generator: profile Update UpdateProfile(ctx context.Context, tx *sql.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, tx *sql.Tx, project string, name string) error }
ProfileGenerated is an interface of generated methods for Profile.
type Project ¶
Project represents a LXD project.
func GetCertificateProjects ¶
GetCertificateProjects returns all available Projects for the Certificate.
func GetIdentityProjects ¶
GetIdentityProjects returns all available Projects for the Identity. generator: identity_project GetMany
func GetProject ¶
GetProject returns the project with the given key. generator: project GetOne
func GetProjects ¶
GetProjects returns all available projects. generator: project GetMany
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, tx *sql.Tx, projectID int, filters ...ConfigFilter) (map[string]string, error) // GetProjects returns all available projects. // generator: project GetMany GetProjects(ctx context.Context, tx *sql.Tx, filters ...ProjectFilter) ([]Project, error) // GetProject returns the project with the given key. // generator: project GetOne GetProject(ctx context.Context, tx *sql.Tx, name string) (*Project, error) // ProjectExists checks if a project with the given key exists. // generator: project Exists ProjectExists(ctx context.Context, tx *sql.Tx, name string) (bool, error) // CreateProjectConfig adds new project Config to the database. // generator: project Create CreateProjectConfig(ctx context.Context, tx *sql.Tx, projectID int64, config map[string]string) error // CreateProject adds a new project to the database. // generator: project Create CreateProject(ctx context.Context, tx *sql.Tx, object Project) (int64, error) // GetProjectID return the ID of the project with the given key. // generator: project ID GetProjectID(ctx context.Context, tx *sql.Tx, name string) (int64, error) // RenameProject renames the project matching the given key parameters. // generator: project Rename RenameProject(ctx context.Context, tx *sql.Tx, name string, to string) error // DeleteProject deletes the project matching the given key parameters. // generator: project DeleteOne-by-Name DeleteProject(ctx context.Context, tx *sql.Tx, name string) error }
ProjectGenerated is an interface of generated methods for Project.
type Warning ¶
type Warning struct { ID int Node string `db:"coalesce=''&leftjoin=nodes.name"` Project string `db:"coalesce=''&leftjoin=projects.name"` EntityType EntityType `db:"coalesce=-1&sql=warnings.entity_type_code"` 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 ¶
GetWarning returns the warning with the given key. generator: warning GetOne-by-UUID
func GetWarnings ¶
GetWarnings returns all available warnings. generator: warning GetMany
type WarningFilter ¶
type WarningFilter struct { ID *int UUID *string Project *string Node *string TypeCode *warningtype.Type EntityType *EntityType 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, tx *sql.Tx, filters ...WarningFilter) ([]Warning, error) // GetWarning returns the warning with the given key. // generator: warning GetOne-by-UUID GetWarning(ctx context.Context, tx *sql.Tx, uuid string) (*Warning, error) // DeleteWarning deletes the warning matching the given key parameters. // generator: warning DeleteOne-by-UUID DeleteWarning(ctx context.Context, tx *sql.Tx, uuid string) error // DeleteWarnings deletes the warning matching the given key parameters. // generator: warning DeleteMany-by-EntityType-and-EntityID DeleteWarnings(ctx context.Context, tx *sql.Tx, entityType EntityType, entityID int) error // GetWarningID return the ID of the warning with the given key. // generator: warning ID GetWarningID(ctx context.Context, tx *sql.Tx, uuid string) (int64, error) // WarningExists checks if a warning with the given key exists. // generator: warning Exists WarningExists(ctx context.Context, tx *sql.Tx, uuid string) (bool, error) }
WarningGenerated is an interface of generated methods for Warning.
Source Files ¶
- auth_groups.go
- auth_groups.interface.mapper.go
- auth_groups.mapper.go
- certificate_projects.go
- certificates.go
- cluster_groups.go
- cluster_groups.interface.mapper.go
- cluster_groups.mapper.go
- config.go
- config.interface.mapper.go
- config.mapper.go
- devices.go
- devices.interface.mapper.go
- devices.mapper.go
- entities.go
- identities.go
- identities.interface.mapper.go
- identities.mapper.go
- identity_projects.go
- identity_projects.interface.mapper.go
- identity_projects.mapper.go
- identity_provider_groups.go
- identity_provider_groups.interface.mapper.go
- identity_provider_groups.mapper.go
- images.go
- images.interface.mapper.go
- images.mapper.go
- instance_profiles.go
- instance_profiles.interface.mapper.go
- instance_profiles.mapper.go
- instances.go
- instances.interface.mapper.go
- instances.mapper.go
- nodes.go
- nodes.interface.mapper.go
- nodes.mapper.go
- nodes_cluster_groups.go
- nodes_cluster_groups.interface.mapper.go
- nodes_cluster_groups.mapper.go
- open.go
- operations.go
- operations.interface.mapper.go
- operations.mapper.go
- permissions.go
- profiles.go
- profiles.interface.mapper.go
- profiles.mapper.go
- projects.go
- projects.interface.mapper.go
- projects.mapper.go
- query.go
- schema.go
- snapshots.go
- snapshots.interface.mapper.go
- snapshots.mapper.go
- stmt.go
- storage_volume_type.go
- update.go
- warnings.go
- warnings.interface.mapper.go
- warnings.mapper.go