Documentation ¶
Index ¶
- Constants
- Variables
- func AskInput(prompt string, silent bool) (string, error)
- func ConnectErrorHandler(rcmd RunCommand) func(*cobra.Command, []string) error
- func DoFilter[T any](objects []T, objectFilterKeyFunc func(T) []string, f Filter) []T
- func ExtractSessionToken(res *connect.Response[dashv1alpha1.LoginResponse]) string
- func GetCurrentWorkspaceName() string
- func InClusterHTTPClient(ca []byte) (*http.Client, error)
- func NewRequestWithToken[T any](message *T, cfg *Config) *connect.Request[T]
- func OutputTable(output io.Writer, headers []string, data [][]string)
- func ReadFromPipedStdin() (string, error)
- func ServiceAccountLogin(ctx context.Context, cfg *Config) error
- func UseServiceAccount(cfg *Config) bool
- type Config
- type CosmoDashClient
- type Filter
- type RootOptions
- func (o *RootOptions) AddFlags(cmd *cobra.Command)
- func (o *RootOptions) Complete(cmd *cobra.Command, args []string) error
- func (o *RootOptions) CompleteWithoutClient(cmd *cobra.Command, args []string) error
- func (o *RootOptions) GetConfigFilePath() (string, error)
- func (o *RootOptions) GetDashboardURL() string
- func (o *RootOptions) Logger() *clog.Logger
- func (o *RootOptions) Validate(cmd *cobra.Command, args []string) error
- type RunCommand
- type VersionInfo
Constants ¶
View Source
const ( OperatorEqual = "==" OperatorNotEqual = "!=" )
View Source
const ( InClusterCAFile string = "ca.crt" InClusterCertFile string = "tls.crt" )
View Source
const ( DefaultDashboardNamespace = "cosmo-system" DefaultDashboardPort = 8443 DefaultDashboardInclusterPort = 8080 )
View Source
const ( ENV_CONFIG = "COSMOCTL_CONFIG" ENV_DASHBOARD_URL = "COSMOCTL_DASHBOARD_URL" )
View Source
const (
ServiceAccountTokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token"
)
Variables ¶
View Source
var (
InClusterDashboardURL = inClusterDashboardURL()
)
Functions ¶
func ConnectErrorHandler ¶
func ConnectErrorHandler(rcmd RunCommand) func(*cobra.Command, []string) error
func ExtractSessionToken ¶
func ExtractSessionToken(res *connect.Response[dashv1alpha1.LoginResponse]) string
func GetCurrentWorkspaceName ¶
func GetCurrentWorkspaceName() string
GetCurrentWorkspaceName returns current workspace name. If running in Workspace pod, hostname is like `$INSTANCE-deploy-podsufix`(e.g.`ws1-workspace-575db4c9cd-h558m`) the first part is workspace name prefixed by cosmo.
func NewRequestWithToken ¶
func ReadFromPipedStdin ¶
func UseServiceAccount ¶
Types ¶
type Config ¶
type Config struct { Endpoint string `json:"endpoint"` Token string `json:"token"` User string `json:"user"` UseServiceAccount bool `json:"useServiceAccount,omitempty"` CACert string `json:"cacert,omitempty"` // contains filtered or unexported fields }
func NewOrLoadConfigFile ¶
type CosmoDashClient ¶
type CosmoDashClient struct { AuthServiceClient dashboardv1alpha1connect.AuthServiceClient UserServiceClient dashboardv1alpha1connect.UserServiceClient WorkspaceServiceClient dashboardv1alpha1connect.WorkspaceServiceClient TemplateServiceClient dashboardv1alpha1connect.TemplateServiceClient WebAuthnServiceClient dashboardv1alpha1connect.WebAuthnServiceClient }
func NewCosmoDashClient ¶
func NewCosmoDashClient(httpClient connect.HTTPClient, baseURL string) (*CosmoDashClient, error)
type Filter ¶
func ParseFilters ¶
type RootOptions ¶
type RootOptions struct { UseKubeAPI bool KubeConfigPath string KubeContext string DashboardURL string ConfigPath string LogLevel int DisableUseServiceAccount bool Versions VersionInfo Ctx context.Context Logr *clog.Logger KosmoClient *kosmo.Client CosmoDashClient *CosmoDashClient CliConfig *Config }
func NewRootOptions ¶
func NewRootOptions() *RootOptions
func (*RootOptions) AddFlags ¶
func (o *RootOptions) AddFlags(cmd *cobra.Command)
func (*RootOptions) Complete ¶
func (o *RootOptions) Complete(cmd *cobra.Command, args []string) error
func (*RootOptions) CompleteWithoutClient ¶
func (o *RootOptions) CompleteWithoutClient(cmd *cobra.Command, args []string) error
func (*RootOptions) GetConfigFilePath ¶
func (o *RootOptions) GetConfigFilePath() (string, error)
func (*RootOptions) GetDashboardURL ¶
func (o *RootOptions) GetDashboardURL() string
func (*RootOptions) Logger ¶
func (o *RootOptions) Logger() *clog.Logger
type RunCommand ¶
type VersionInfo ¶
Click to show internal directories.
Click to hide internal directories.