server

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VPNDeviceType = "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 DeleteDevicePort added in v1.0.10

func DeleteDevicePort(ports []DevicePort) error

func EnsureAccount

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

func EnsureApp

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

func EnsureCluster

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

func EnsureDevice

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

func EnsureEnv

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

func EnsureProject added in v1.0.10

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

func GetEnvs added in v1.0.10

func GetEnvs(appId string) (string, error)

func GetFromResp

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

func GetFromRespForEdge

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

func GetLoadMaps

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

func GetMresConfigValues

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

func InterceptApp

func InterceptApp(status bool, options ...fn.Option) error

func ListMresKeys

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

func Login

func Login(loginId string) error

func SelectApp

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

func SelectMresKey

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

func SyncKubeConfig

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

func UpdateDevice added in v1.0.10

func UpdateDevice(ports []DevicePort) error

func UpdateDeviceClusterName added in v1.0.10

func UpdateDeviceClusterName(clusterName string) error

func UpdateDeviceEnv added in v1.0.10

func UpdateDeviceEnv(options ...fn.Option) error

func UpdateDeviceNS added in v1.0.10

func UpdateDeviceNS(namespace 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"`
	Status      Status   `json:"status"`
}

func ListApps

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

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"`
}

func GetDeviceName added in v1.0.10

func GetDeviceName(devName string) (*CheckName, error)

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 {
	Metadata    Metadata `json:"metadata"`
	DisplayName string   `json:"displayName"`
	Status      Status   `json:"status"`
	EnvName     string   `json:"environmentName"`
	ProjectName string   `json:"projectName"`
	ClusterName string   `json:"clusterName"`
	Spec        struct {
		CnameRecords []struct {
			Host   string `json:"host"`
			Target string `json:"target"`
		} `json:"cnameRecords"`
		ActiveNamespace string       `json:"activeNamespace"`
		Ports           []DevicePort `json:"ports"`
	} `json:"spec"`
	WireguardConfig *struct {
		Encoding string `json:"encoding"`
		Value    string `json:"value"`
	} `json:"wireguardConfig,omitempty"`
}

func CreateDevice added in v1.0.10

func CreateDevice(selectedDeviceName string, devName string) (*Device, error)

func GetDevice added in v1.0.10

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

type DevicePort added in v1.0.10

type DevicePort struct {
	Port       int `json:"port"`
	TargetPort int `json:"targetPort,omitempty"`
}

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"`
	Spec        struct {
		TargetNamespace string `json:"targetNamespace"`
	} `json:"spec"`
}

func GetEnvironment added in v1.0.10

func GetEnvironment(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 Mres

type Mres struct {
	DisplayName string   `json:"display_name"`
	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 Project added in v1.0.10

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

func ListProjects added in v1.0.10

func ListProjects(options ...fn.Option) ([]Project, error)

func SelectProject added in v1.0.10

func SelectProject(projectName string) (*Project, error)

type ProjectList added in v1.0.10

type ProjectList struct {
	Edges Edges[Project] `json:"edges"`
}

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 string `json:"RawMessage"`
	} `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