helpers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeProject

func DecodeProject(encoded string) (string, string, error)

func EncodeProject

func EncodeProject(uuid, project string) string

func HumanizeDuration

func HumanizeDuration(duration time.Duration) string

func ImageClassificationFromString

func ImageClassificationFromString(classification string) (apiv2.ImageClassification, error)

func ImageFeatureFromString

func ImageFeatureFromString(feature string) (*apiv2.ImageFeature, error)

func ImageFeaturesFromStringSlice

func ImageFeaturesFromStringSlice(features []string) ([]apiv2.ImageFeature, error)

func IsAnyViperFlagSet

func IsAnyViperFlagSet(names ...string) bool

func LabelsFromSlice

func LabelsFromSlice(labelSlice []string) (*apiv2.Labels, error)

LabelsFromSlice converts a given label slice (e.g. ["a=b"]) into apiv2 labels. When an empty slice is provided be aware that this function returns nil without an error.

func ToAdminRole

func ToAdminRole(roleString string) (*apiv2.AdminRole, error)

func ToInfraRole

func ToInfraRole(roleString string) (*apiv2.InfraRole, error)

func ToMachineRoles

func ToMachineRoles(machineRolesSlice []string) (map[string]apiv2.MachineRole, error)

func ToPermissionsByVisibility

func ToPermissionsByVisibility(perms []*apiv2.MethodPermission) ([]*apiv2.PermissionsByVisibility, error)

func ToProjectRoles

func ToProjectRoles(projectRolesSlice []string) (map[string]apiv2.ProjectRole, error)

func ToTenantRoles

func ToTenantRoles(tenantRolesSlice []string) (map[string]apiv2.TenantRole, error)

func TrimProvider

func TrimProvider(subject string) string

func UpdateLabelsFromCLI

func UpdateLabelsFromCLI() (*apiv2.UpdateLabels, error)

UpdateLabelsFromCLI returns update labels from CLI args. Make sure you use --add-labels, --remove-labels and --labels in the command. Note that this function returns nil without an error in case none of the flags are used.

func UpdateLabelsFromMeta

func UpdateLabelsFromMeta(meta *apiv2.Meta) *apiv2.UpdateLabels

UpdateLabelsFromMeta returns update labels with replace strategy from a given meta.

func UpdateMetaFromMeta

func UpdateMetaFromMeta(meta *apiv2.Meta) *apiv2.UpdateMeta

UpdateMetaFromMeta returns an update for a given meta. When the updated at field is set, it uses client locking, otherwise server locking.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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