Documentation
¶
Index ¶
- Constants
- func AnySlice[T any](in []T) []any
- func ConvertStringSlice[T ~string](ss []string) []T
- func Deref[T any](val *T) T
- func DerefStr[T ~string](val *T) string
- func ExpandPath(path string) string
- func GenerateServiceName() string
- func IsValidAddon(addon string) bool
- func Must[T any](v T, err error) T
- func ParseCPUMemory(cpuMemoryStr string) (int, int, error)
- func Ptr[T any](val T) *T
- func ValidAddons() []string
- func ValidateAddons(addons []string) ([]string, error)
- func ValidateAndNormalizeCPUMemory(cpuMillis int, memoryGbs int, cpuFlagSet, memoryFlagSet bool) (int, int, error)
- type CPUMemoryConfig
- type CPUMemoryConfigs
Constants ¶
const ( AddonTimeSeries = "time-series" AddonAI = "ai" AddonNone = "none" // Special value for no add-ons )
Addon constants - these match the ServiceCreateAddons from the API
Variables ¶
This section is empty.
Functions ¶
func ConvertStringSlice ¶ added in v0.4.1
ConvertStringSlice converts a slice of strings to another string-like type. Returns nil if the input slice is empty or nil.
func ExpandPath ¶ added in v0.4.0
ExpandPath expands environment variables and tilde in file paths. It handles: - Empty paths (returns empty string) - Environment variable expansion (e.g., $HOME/config) - Home directory expansion (e.g., ~/config or ~) - Path normalization for cross-platform compatibility
func GenerateServiceName ¶
func GenerateServiceName() string
Matches front-end logic for generating a random service name
func IsValidAddon ¶ added in v0.1.2
IsValidAddon checks if the given add-on is valid (case-sensitive as per API spec)
func ParseCPUMemory ¶
ParseCPUMemory parses a CPU/Memory combination string (e.g., "2 CPU/8GB") and returns millicores and GB
func ValidAddons ¶ added in v0.1.2
func ValidAddons() []string
ValidAddons returns a slice of all valid add-on values
func ValidateAddons ¶ added in v0.1.2
ValidateAddons validates a slice of add-ons and removes duplicate values
Types ¶
type CPUMemoryConfig ¶
CPUMemoryConfig represents an allowed CPU/Memory configuration
func (*CPUMemoryConfig) CPUString ¶
func (c *CPUMemoryConfig) CPUString() string
func (*CPUMemoryConfig) MemoryString ¶
func (c *CPUMemoryConfig) MemoryString() string
func (*CPUMemoryConfig) String ¶
func (c *CPUMemoryConfig) String() string
type CPUMemoryConfigs ¶
type CPUMemoryConfigs []CPUMemoryConfig
func GetAllowedCPUMemoryConfigs ¶
func GetAllowedCPUMemoryConfigs() CPUMemoryConfigs
GetAllowedCPUMemoryConfigs returns the allowed CPU/Memory configurations from the spec TODO: It would be great if we could fetch these from the API instead of hard coding them.
func (CPUMemoryConfigs) CPUString ¶
func (c CPUMemoryConfigs) CPUString() string
String returns a user-friendly string of allowed CPU values
func (CPUMemoryConfigs) MemoryString ¶
func (c CPUMemoryConfigs) MemoryString() string
String returns a user-friendly string of allowed memory values
func (CPUMemoryConfigs) String ¶
func (c CPUMemoryConfigs) String() string
String returns a user-friendly string of allowed CPU/Memory combinations
func (CPUMemoryConfigs) Strings ¶
func (c CPUMemoryConfigs) Strings() []string
Strings returns a slice of user-friendly strings of allowed CPU/Memory combinations