Documentation
¶
Index ¶
- func AllowBackupCreation(tx *db.ClusterTx, projectName string) error
- func AllowClusterGroup(p *api.Project, groupName string) error
- func AllowClusterMember(p *api.Project, member *db.NodeInfo) error
- func AllowInstanceCreation(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func AllowInstanceUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func AllowProfileUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func AllowProjectUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func AllowSnapshotCreation(p *api.Project) error
- func AllowVolumeCreation(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func AllowVolumeUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) error
- func CheckClusterTargetRestriction(ctx context.Context, authorizer auth.Authorizer, project *api.Project, ...) error
- func CheckTarget(ctx context.Context, authorizer auth.Authorizer, tx *db.ClusterTx, ...) (*db.NodeInfo, string, error)
- func CheckTargetGroup(ctx context.Context, tx *db.ClusterTx, p *api.Project, groupName string) error
- func CheckTargetMember(p *api.Project, targetMemberName string, allMembers []db.NodeInfo) (*db.NodeInfo, error)
- func GetCurrentAllocations(ctx context.Context, globalConfig map[string]string, tx *db.ClusterTx, ...) (map[string]api.ProjectStateResource, error)
- func GetImageSpaceBudget(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, ...) (int64, error)
- func GetRestrictedClusterGroups(p *api.Project) []string
- func HiddenStoragePools(ctx context.Context, tx *db.ClusterTx, projectName string) ([]string, error)
- func TargetDetect(target string) (targetNode string, targetGroup string)
- func UplinkAddressQuotasExceeded(ctx context.Context, tx *db.ClusterTx, projectName string, networkName string, ...) (V4QuotaExceeded bool, V6QuotaExceeded bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowBackupCreation ¶
AllowBackupCreation returns an error if any project-specific restriction is violated when creating a new backup in a project.
func AllowClusterGroup ¶
AllowClusterGroup returns nil if the given project is allowed to use the cluster groupName.
func AllowClusterMember ¶
AllowClusterMember returns nil if the given project is allowed to use the cluster member.
func AllowInstanceCreation ¶
func AllowInstanceCreation(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName string, req api.InstancesPost) error
AllowInstanceCreation returns an error if any project-specific limit or restriction is violated when creating a new instance.
func AllowInstanceUpdate ¶
func AllowInstanceUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName, instanceName string, req api.InstancePut, currentConfig map[string]string) error
AllowInstanceUpdate returns an error if any project-specific limit or restriction is violated when updating an existing instance.
func AllowProfileUpdate ¶
func AllowProfileUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName, profileName string, req api.ProfilePut) error
AllowProfileUpdate checks that project limits and restrictions are not violated when changing a profile.
func AllowProjectUpdate ¶
func AllowProjectUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName string, config map[string]string, changed []string) error
AllowProjectUpdate checks the new config to be set on a project is valid.
func AllowSnapshotCreation ¶
AllowSnapshotCreation returns an error if any project-specific restriction is violated when creating a new snapshot in a project.
func AllowVolumeCreation ¶
func AllowVolumeCreation(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName string, poolName string, req api.StorageVolumesPost) error
AllowVolumeCreation returns an error if any project-specific limit or restriction is violated when creating a new custom volume in a project.
func AllowVolumeUpdate ¶
func AllowVolumeUpdate(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName, volumeName string, req api.StorageVolumePut, currentConfig map[string]string) error
AllowVolumeUpdate returns an error if any project-specific limit or restriction is violated when updating an existing custom volume.
func CheckClusterTargetRestriction ¶
func CheckClusterTargetRestriction(ctx context.Context, authorizer auth.Authorizer, project *api.Project, targetFlag string) error
CheckClusterTargetRestriction check if user is allowed to use cluster member targeting.
func CheckTarget ¶
func CheckTarget(ctx context.Context, authorizer auth.Authorizer, tx *db.ClusterTx, p *api.Project, target string, allMembers []db.NodeInfo) (*db.NodeInfo, string, error)
CheckTarget checks if the given cluster target (member or group) is allowed. If target is a cluster member and is found in allMembers it returns the resolved node information object. If target is a cluster group it returns the cluster group name. In case of error, neither node information nor cluster group name gets returned.
func CheckTargetGroup ¶
func CheckTargetGroup(ctx context.Context, tx *db.ClusterTx, p *api.Project, groupName string) error
CheckTargetGroup checks if the given groupName is allowed for the project.
func CheckTargetMember ¶
func CheckTargetMember(p *api.Project, targetMemberName string, allMembers []db.NodeInfo) (*db.NodeInfo, error)
CheckTargetMember checks if the given targetMemberName is present in allMembers and is allowed for the project. If the target member is allowed it returns the resolved node information.
func GetCurrentAllocations ¶
func GetCurrentAllocations(ctx context.Context, globalConfig map[string]string, tx *db.ClusterTx, projectName string) (map[string]api.ProjectStateResource, error)
GetCurrentAllocations returns the current resource utilization for a given project.
func GetImageSpaceBudget ¶
func GetImageSpaceBudget(ctx context.Context, globalConfig *clusterConfig.Config, tx *db.ClusterTx, projectName string) (int64, error)
GetImageSpaceBudget returns how much disk space is left in the given project for writing images.
If no limit is in place, return -1.
func GetRestrictedClusterGroups ¶
GetRestrictedClusterGroups returns a slice of restricted cluster groups for the given project.
func HiddenStoragePools ¶
func HiddenStoragePools(ctx context.Context, tx *db.ClusterTx, projectName string) ([]string, error)
HiddenStoragePools returns a list of storage pools that should be hidden from users of the project.
func TargetDetect ¶
TargetDetect returns either target node or group based on the provided prefix: An invocation with `target=h1` returns "h1", "" and `target=@g1` returns "", "g1".
func UplinkAddressQuotasExceeded ¶
func UplinkAddressQuotasExceeded(ctx context.Context, tx *db.ClusterTx, projectName string, networkName string, uplinkIPV4Quota int, uplinkIPV6Quota int, projectNetworks map[int64]api.Network) (V4QuotaExceeded bool, V6QuotaExceeded bool, err error)
UplinkAddressQuotasExceeded checks whether the number of current uplink addresses used in project projectName on network networkName is higher than their provided quota for each IP protocol. Uplink addresses can be consumed by load balancers, network forwards and networks. For simplicity, this function assumes both limits are provided and returns early if both provided quotas are exceeded. So if one of the limits is not of the caller's interest, -1 should be provided and the result for that protocol should be ignored. The projectNetworks argument accepts cached networks for the provided project to avoid redundant DB queries.
Types ¶
This section is empty.