Documentation
¶
Index ¶
- Constants
- func AnySlice[T any](in []T) []any
- func Deref[T any](val *T) T
- func DerefStr[T ~string](val *T) string
- func GenerateServiceName() string
- func IsValidServiceType(serviceType string) bool
- func Must[T any](v T, err error) T
- func ParseCPUMemory(cpuMemoryStr string) (int, float64, error)
- func Ptr[T any](val T) *T
- func ValidServiceTypes() []string
- func ValidateAndNormalizeCPUMemory(cpuMillis int, memoryGbs float64, cpuFlagSet, memoryFlagSet bool) (int, float64, error)
- type CPUMemoryConfig
- type CPUMemoryConfigs
- type KeyringStorage
- type NoStorage
- type PasswordStorage
- type PasswordStorageResult
- type PgpassStorage
Constants ¶
const ( ServiceTypeTimescaleDB = "timescaledb" ServiceTypePostgres = "postgres" ServiceTypeVector = "vector" )
Service type constants
Variables ¶
This section is empty.
Functions ¶
func GenerateServiceName ¶
func GenerateServiceName() string
Matches front-end logic for generating a random service name
func IsValidServiceType ¶
IsValidServiceType checks if the given service type is valid (case-insensitive)
func ParseCPUMemory ¶
ParseCPUMemory parses a CPU/Memory combination string (e.g., "2 CPU/8GB") and returns millicores and GB
func ValidServiceTypes ¶
func ValidServiceTypes() []string
ValidServiceTypes returns a slice of all valid service types
Types ¶
type CPUMemoryConfig ¶
type CPUMemoryConfig struct {
CPUMillis int // CPU in millicores
MemoryGbs float64 // Memory in GB
}
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
type KeyringStorage ¶
type KeyringStorage struct{}
KeyringStorage implements password storage using system keyring
func (*KeyringStorage) GetStorageResult ¶
func (k *KeyringStorage) GetStorageResult(err error, password string) PasswordStorageResult
type NoStorage ¶
type NoStorage struct{}
NoStorage implements no password storage (passwords are not saved)
func (*NoStorage) GetStorageResult ¶
func (n *NoStorage) GetStorageResult(err error, password string) PasswordStorageResult
type PasswordStorage ¶
type PasswordStorage interface {
Save(service api.Service, password string) error
Get(service api.Service) (string, error)
Remove(service api.Service) error
GetStorageResult(err error, password string) PasswordStorageResult
}
PasswordStorage defines the interface for password storage implementations
func GetPasswordStorage ¶
func GetPasswordStorage() PasswordStorage
GetPasswordStorage returns the appropriate PasswordStorage implementation based on configuration
type PasswordStorageResult ¶
type PasswordStorageResult struct {
Success bool `json:"success"`
Method string `json:"method"` // "keyring", "pgpass", or "none"
Message string `json:"message"` // Human-readable message
}
PasswordStorageResult contains the result of password storage operations
func SavePasswordWithResult ¶
func SavePasswordWithResult(service api.Service, password string) (PasswordStorageResult, error)
SavePasswordWithResult handles saving a password and returns both error and result info
type PgpassStorage ¶
type PgpassStorage struct{}
PgpassStorage implements password storage using ~/.pgpass file
func (*PgpassStorage) GetStorageResult ¶
func (p *PgpassStorage) GetStorageResult(err error, password string) PasswordStorageResult