server

package
v1.0.7-nightly Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default_GVPN = "default"
)
View Source
const (
	VPNDeviceType = "global_vpn_device"
)

Variables

View Source
var PaginationDefault = map[string]any{
	"orderBy":       "name",
	"sortDirection": "ASC",
	"first":         99999999,
}

Functions

func CheckDeviceStatus

func CheckDeviceStatus() bool

func CreateRemoteLogin

func CreateRemoteLogin() (loginId string, err error)

func EnsureAccount

func EnsureAccount(options ...fn.Option) (string, error)

func EnsureCluster

func EnsureCluster(options ...fn.Option) (string, error)

func EnsureEnv

func EnsureEnv(env *client.Env, options ...fn.Option) (*client.Env, error)

func GetFromResp

func GetFromResp[T any](respData []byte) (*T, error)

func GetFromRespForEdge

func GetFromRespForEdge[T any](respData []byte) ([]T, error)

func GetMresConfigValues

func GetMresConfigValues(options ...fn.Option) (map[string]string, error)

func InterceptApp

func InterceptApp(status bool, ports []AppPort, options ...fn.Option) error

func ListMresKeys

func ListMresKeys(options ...fn.Option) ([]string, error)

func LoadDevboxConfig

func LoadDevboxConfig() (*devboxfile.DevboxConfig, error)

this function will fetch real envs from api and return DevboxKlfile with real envs

func Login

func Login(loginId string) error

func MountEnvs

func MountEnvs(c devboxfile.KlConfig) error

func SelectMresKey

func SelectMresKey(options ...fn.Option) (*string, error)

func SyncDevboxJsonFile

func SyncDevboxJsonFile() error

func SyncKubeConfig

func SyncKubeConfig(options ...fn.Option) (*string, error)

Types

type Account

type Account struct {
	Metadata    Metadata `json:"metadata"`
	DisplayName string   `json:"displayName"`
	Status      Status   `json:"status"`
}

func ListAccounts

func ListAccounts() ([]Account, error)

func SelectAccount

func SelectAccount(accountName string) (*Account, error)

type App

type App struct {
	DisplayName string   `json:"displayName"`
	Metadata    Metadata `json:"metadata"`
	Spec        AppSpec  `json:"spec"`
	Status      Status   `json:"status"`
	IsMainApp   bool     `json:"mapp"`
}

func EnsureApp

func EnsureApp(options ...fn.Option) (*App, error)

func ListApps

func ListApps(options ...fn.Option) ([]App, error)

func SelectApp

func SelectApp(options ...fn.Option) (*App, error)

type AppPort

type AppPort struct {
	AppPort    int `json:"appPort"`
	DevicePort int `json:"devicePort,omitempty"`
}

type AppSpec

type AppSpec struct {
	Services []struct {
		Port int `json:"port"`
	} `json:"services"`
	Intercept struct {
		PortMappings []AppPort `json:"portMappings"`
	} `json:"intercept"`
}

type CSResp

type CSResp map[string]map[string]*Kv

type Check

type Check struct {
	Generation int    `json:"generation"`
	Message    string `json:"message"`
}

type CheckName

type CheckName struct {
	Result         bool     `json:"result"`
	SuggestedNames []string `json:"suggestedNames"`
}

type Cluster

type Cluster struct {
	Metadata struct {
		Name string `json:"name"`
	}
	DisplayName string `json:"displayName"`
	Status      struct {
		IsReady bool `json:"isReady"`
	} `json:"status"`
}

func ListClusters

func ListClusters(options ...fn.Option) ([]Cluster, error)

func SelectCluster

func SelectCluster(clusterName string) (*Cluster, error)

type Config

type Config struct {
	DisplayName string            `yaml:"displayName"`
	Metadata    Metadata          `yaml:"metadata"`
	Status      Status            `yaml:"status"`
	Data        map[string]string `yaml:"data"`
}

func EnsureConfig

func EnsureConfig(options ...fn.Option) (*Config, error)

func GetConfig

func GetConfig(options ...fn.Option) (*Config, error)

func ListConfigs

func ListConfigs(options ...fn.Option) ([]Config, error)

func SelectConfig

func SelectConfig(options ...fn.Option) (*Config, error)

type ConfigEnv

type ConfigEnv struct {
	Key        string `json:"key"`
	ConfigName string `json:"configName"`
	Value      string `json:"value"`
}

type ConfigORSecret

type ConfigORSecret struct {
	Entries map[string]string `json:"entries"`
	Name    string            `json:"name"`
}

type Device

type Device struct {
	AccountName       string `json:"accountName"`
	CreationTime      string `json:"creationTime"`
	CreatedBy         User   `json:"createdBy"`
	DisplayName       string `json:"displayName"`
	GlobalVPNName     string `json:"globalVPNName"`
	ID                string `json:"id"`
	IPAddress         string `json:"ipAddr"`
	LastUpdatedBy     User   `json:"lastUpdatedBy"`
	MarkedForDeletion bool   `json:"markedForDeletion"`
	// TODO: match with api (envname)
	EnvironmentName string `json:"environmentName"`
	Metadata        struct {
		Annotations       map[string]string `json:"annotations"`
		CreationTimestamp string            `json:"creationTimestamp"`
		DeletionTimestamp string            `json:"deletionTimestamp"`
		Labels            map[string]string `json:"labels"`
		Name              string            `json:"name"`
	} `json:"metadata"`
	PrivateKey      string `json:"privateKey"`
	PublicEndpoint  string `json:"publicEndpoint"`
	PublicKey       string `json:"publicKey"`
	UpdateTime      string `json:"updateTime"`
	WireguardConfig struct {
		Value    string `json:"value"`
		Encoding string `json:"encoding"`
	} `json:"wireguardConfig,omitempty"`
}

func EnsureDevice

func EnsureDevice(options ...fn.Option) (*Device, error)

type DeviceList

type DeviceList struct {
	Edges Edges[Env] `json:"edges"`
}

type Edge

type Edge[T any] struct {
	Node T
}

type Edges

type Edges[T any] []Edge[T]

type Env

type Env struct {
	DisplayName string   `json:"displayName"`
	Metadata    Metadata `json:"metadata"`
	Status      Status   `json:"status"`
	ClusterName string   `json:"clusterName"`
	Spec        struct {
		TargetNamespace string `json:"targetNamespace"`
	} `json:"spec"`
}

func GetEnv

func GetEnv(envName string) (*Env, error)

func ListEnvs

func ListEnvs(options ...fn.Option) ([]Env, error)

func SelectEnv

func SelectEnv(envName string, options ...fn.Option) (*Env, error)

type EnvList

type EnvList struct {
	Edges Edges[Env] `json:"edges"`
}

type EnvRsp

type EnvRsp struct {
	Secrets []SecretEnv `json:"secrets"`
	Configs []ConfigEnv `json:"configs"`
	Mreses  []MresEnv   `json:"mreses"`
}

type GeneratedEnvs

type GeneratedEnvs struct {
	EnvVars    map[string]string `json:"envVars"`
	MountFiles map[string]string `json:"mountFiles"`
}

func GenerateEnv

func GenerateEnv() (*GeneratedEnvs, error)

type ItemList

type ItemList[T any] struct {
	Edges Edges[T] `json:"edges"`
}

type Kv

type Kv struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Metadata

type Metadata struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type MountMap

type MountMap map[string]string

func GetLoadMaps

func GetLoadMaps() (map[string]string, MountMap, error)

type Mres

type Mres struct {
	DisplayName string   `json:"displayName"`
	Metadata    Metadata `json:"metadata"`
}

func ListMreses

func ListMreses(options ...fn.Option) ([]Mres, error)

func SelectMres

func SelectMres(options ...fn.Option) (*Mres, error)

type MresEnv

type MresEnv struct {
	Key      string `json:"key"`
	MresName string `json:"mresName"`
	Value    string `json:"value"`
}

type MresResp

type MresResp struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	MresName string `json:"mresName"`
}

type Response

type Response[T any] struct {
	Data   T       `json:"data"`
	Errors []error `json:"errors"`
}

type Secret

type Secret struct {
	DisplayName string            `yaml:"displayName"`
	Metadata    Metadata          `yaml:"metadata"`
	Status      Status            `yaml:"status"`
	StringData  map[string]string `yaml:"stringData"`
}

func EnsureSecret

func EnsureSecret(options ...fn.Option) (*Secret, error)

func GetSecret

func GetSecret(options ...fn.Option) (*Secret, error)

func ListSecrets

func ListSecrets(options ...fn.Option) ([]Secret, error)

func SelectSecret

func SelectSecret(options ...fn.Option) (*Secret, error)

type SecretEnv

type SecretEnv struct {
	Key        string `json:"key"`
	SecretName string `json:"secretName"`
	Value      string `json:"value"`
}

type Status

type Status struct {
	IsReady bool `json:"isReady"`
	Message struct {
		RawMessage json.RawMessage `json:",inline"`
	} `json:"message"`
}

type User

type User struct {
	UserId string `json:"id"`
	Email  string `json:"email"`
	Name   string `json:"name"`
}

func GetCurrentUser

func GetCurrentUser() (*User, error)

Jump to

Keyboard shortcuts

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