usercmd

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package usercmd provides Epinio CLI commands for users

Package admincmd provides the commands of the admin CLI, which deals with installing and configurations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient added in v0.6.0

type APIClient interface {
	AuthToken() (models.AuthTokenResponse, error)
	Me() (models.MeResponse, error)

	// app
	AppCreate(req models.ApplicationCreateRequest, namespace string) (models.Response, error)
	Apps(namespace string) (models.AppList, error)
	AllApps() (models.AppList, error)
	AppShow(namespace string, appName string) (models.App, error)
	AppUpdate(req models.ApplicationUpdateRequest, namespace string, appName string) (models.Response, error)
	AppDelete(namespace string, names []string) (models.ApplicationDeleteResponse, error)
	AppUpload(namespace string, name string, file client.FormFile) (models.UploadResponse, error)
	AppImportGit(namespace string, name string, gitRef models.GitRef) (models.ImportGitResponse, error)
	AppStage(req models.StageRequest) (*models.StageResponse, error)
	AppDeploy(req models.DeployRequest) (*models.DeployResponse, error)
	AppLogs(namespace, appName, stageID string, follow bool, callback func(tailer.ContainerLogLine)) error
	StagingComplete(namespace string, id string) (models.Response, error)
	AppRunning(app models.AppRef) (models.Response, error)
	AppExec(ctx context.Context, namespace string, appName, instance string, tty kubectlterm.TTY) error
	AppPortForward(namespace string, appName, instance string, opts *epinioapi.PortForwardOpts) error
	AppRestart(namespace string, appName string) (models.Response, error)
	AppGetPart(namespace, appName, part string) (models.AppPartResponse, error)
	AppMatch(namespace, prefix string) (models.AppMatchResponse, error)
	AppValidateCV(namespace string, name string) (models.Response, error)
	AppExport(namespace, appName string, param models.AppExportRequest) (models.Response, error)

	// env
	EnvList(namespace string, appName string) (models.EnvVariableMap, error)
	EnvSet(req models.EnvVariableMap, namespace string, appName string) (models.Response, error)
	EnvShow(namespace string, appName string, envName string) (models.EnvVariable, error)
	EnvUnset(namespace string, appName string, envName string) (models.Response, error)
	EnvMatch(namespace string, appName string, prefix string) (models.EnvMatchResponse, error)

	// info
	Info() (models.InfoResponse, error)

	// namespaces
	NamespaceCreate(req models.NamespaceCreateRequest) (models.Response, error)
	NamespaceDelete(namespaces []string) (models.Response, error)
	NamespaceShow(namespace string) (models.Namespace, error)
	NamespacesMatch(prefix string) (models.NamespacesMatchResponse, error)
	Namespaces() (models.NamespaceList, error)

	// configurations
	Configurations(namespace string) (models.ConfigurationResponseList, error)
	AllConfigurations() (models.ConfigurationResponseList, error)
	ConfigurationBindingCreate(req models.BindRequest, namespace string, appName string) (models.BindResponse, error)
	ConfigurationBindingDelete(namespace string, appName string, configurationName string) (models.Response, error)
	ConfigurationDelete(req models.ConfigurationDeleteRequest, namespace string, names []string) (models.ConfigurationDeleteResponse, error)
	ConfigurationCreate(req models.ConfigurationCreateRequest, namespace string) (models.Response, error)
	ConfigurationUpdate(req models.ConfigurationUpdateRequest, namespace, name string) (models.Response, error)
	// note: The replace endpoint is not used by the cli.
	ConfigurationShow(namespace string, name string) (models.ConfigurationResponse, error)
	ConfigurationApps(namespace string) (models.ConfigurationAppsResponse, error)
	ConfigurationMatch(namespace, prefix string) (models.ConfigurationMatchResponse, error)

	// services
	ServiceCatalog() (models.CatalogServices, error)
	ServiceCatalogShow(serviceName string) (*models.CatalogService, error)
	ServiceCatalogMatch(prefix string) (models.CatalogMatchResponse, error)

	AllServices() (models.ServiceList, error)
	ServiceShow(namespace, name string) (*models.Service, error)
	ServiceCreate(req models.ServiceCreateRequest, namespace string) (models.Response, error)
	ServiceBind(req models.ServiceBindRequest, namespace, name string) (models.Response, error)
	ServiceUnbind(req models.ServiceUnbindRequest, namespace, name string) (models.Response, error)
	ServiceDelete(req models.ServiceDeleteRequest, namespace string, names []string) (models.ServiceDeleteResponse, error)
	ServiceList(namespace string) (models.ServiceList, error)
	ServiceMatch(namespace, prefix string) (models.ServiceMatchResponse, error)
	ServicePortForward(namespace string, serviceName string, opts *epinioapi.PortForwardOpts) error
	ServiceUpdate(req models.ServiceUpdateRequest, namespace, name string) (models.Response, error)

	// application charts
	ChartList() ([]models.AppChart, error)
	ChartShow(name string) (models.AppChart, error)
	ChartMatch(prefix string) (models.ChartMatchResponse, error)

	// gitconfigs
	GitconfigCreate(req models.GitconfigCreateRequest) (models.Response, error)
	GitconfigDelete(gitconfigs []string) (models.Response, error)
	GitconfigShow(gitconfig string) (models.Gitconfig, error)
	Gitconfigs() (models.GitconfigList, error)
	GitconfigsMatch(prefix string) (models.GitconfigsMatchResponse, error)

	// export registries
	ExportregistryList() ([]models.ExportregistryResponse, error)
	ExportregistryMatch(prefix string) (models.ExportregistriesMatchResponse, error)

	DisableVersionWarning()
	VersionWarningEnabled() bool

	SetHeader(k, v string)
	Headers() http.Header
}

type EpinioClient

type EpinioClient struct {
	Settings *settings.Settings
	Log      logr.Logger

	API     APIClient
	Updater selfupdater.Updater
	// contains filtered or unexported fields
}

EpinioClient provides functionality for talking to a Epinio installation on Kubernetes

func New

func New() (*EpinioClient, error)

func (*EpinioClient) AppCreate

func (c *EpinioClient) AppCreate(appName string, appConfig models.ApplicationUpdateRequest) error

AppCreate creates an app without a workload

func (*EpinioClient) AppDelete added in v1.11.0

func (c *EpinioClient) AppDelete(ctx context.Context, appNames []string, all bool) error

Delete removes one or more applications, specified by name

func (*EpinioClient) AppExec added in v0.3.6

func (c *EpinioClient) AppExec(ctx context.Context, appName, instance string) error

func (*EpinioClient) AppExport added in v0.6.3

func (c *EpinioClient) AppExport(appName string, toRegistry bool, param models.AppExportRequest) error

AppExport saves the named app, in the targeted namespace, to the directory.

func (*EpinioClient) AppLogs

func (c *EpinioClient) AppLogs(appName, stageID string, follow bool) error

AppLogs streams the logs of all the application instances, in the targeted namespace If stageID is an empty string, runtime application logs are streamed. If stageID is set, then the matching staging logs are streamed. The printLogs func will print the logs from the channel until the channel will be closed.

func (*EpinioClient) AppManifest added in v0.1.2

func (c *EpinioClient) AppManifest(appName, manifestPath string) error

AppManifest saves the information of the named app, in the targeted namespace, into a manifest file

func (*EpinioClient) AppPortForward added in v0.4.0

func (c *EpinioClient) AppPortForward(ctx context.Context, appName, instance string, address, ports []string) error

func (*EpinioClient) AppPush added in v1.11.0

func (c *EpinioClient) AppPush(ctx context.Context, manifest models.ApplicationManifest) error

Push pushes an app * validate * upload * stage * (tail logs) * wait for staging to be done (complete or fail) * deploy * wait for app

func (*EpinioClient) AppRestage added in v0.6.1

func (c *EpinioClient) AppRestage(appName string, restart bool) error

AppRestage restage an application

func (*EpinioClient) AppRestart added in v0.6.0

func (c *EpinioClient) AppRestart(appName string) error

AppRestart restarts an application

func (*EpinioClient) AppShow

func (c *EpinioClient) AppShow(appName string) error

AppShow displays the information of the named app, in the targeted namespace

func (*EpinioClient) AppStageID

func (c *EpinioClient) AppStageID(appName string) (string, error)

AppStageID returns the last stage id of the named app, in the targeted namespace

func (*EpinioClient) AppUpdate

func (c *EpinioClient) AppUpdate(appName string, appConfig models.ApplicationUpdateRequest) error

AppUpdate updates the specified running application's attributes (e.g. instances)

func (*EpinioClient) Apps

func (c *EpinioClient) Apps(all bool) error

Apps gets all Epinio apps in the targeted namespace, or all apps in all namespaces

func (*EpinioClient) AppsMatching

func (c *EpinioClient) AppsMatching(prefix string) []string

AppsMatching returns all Epinio apps having the specified prefix in their name.

func (*EpinioClient) BindConfiguration added in v0.6.0

func (c *EpinioClient) BindConfiguration(configurationName, appName string) error

BindConfiguration attaches a configuration specified by name to the named application, both in the targeted namespace.

func (*EpinioClient) CatalogMatching added in v0.9.0

func (c *EpinioClient) CatalogMatching(prefix string) []string

CatalogMatching returns all Epinio catalog entries having the specified prefix in their name

func (*EpinioClient) ChartDefaultSet added in v0.8.0

func (c *EpinioClient) ChartDefaultSet(ctx context.Context, chartName string) error

ChartDefaultSet sets the local app chart default

func (*EpinioClient) ChartDefaultShow added in v0.8.0

func (c *EpinioClient) ChartDefaultShow(ctx context.Context) error

ChartDefaultShow displays the current local app chart default

func (*EpinioClient) ChartList added in v0.8.0

func (c *EpinioClient) ChartList(ctx context.Context) error

ChartList displays a table of all known application charts.

func (*EpinioClient) ChartMatching added in v0.8.0

func (c *EpinioClient) ChartMatching(prefix string) []string

ChartMatching retrieves all application charts in the cluster, for the given prefix

func (*EpinioClient) ChartSettingsShow added in v1.9.0

func (c *EpinioClient) ChartSettingsShow(ctx context.Context, settings map[string]models.ChartSetting)

ChartSettingsShow shows the value of the specified environment variable in the named application.

func (*EpinioClient) ChartShow added in v0.8.0

func (c *EpinioClient) ChartShow(ctx context.Context, name string) error

ChartShow shows the value of the specified environment variable in the named application.

func (*EpinioClient) ClientSync added in v1.3.0

func (c *EpinioClient) ClientSync() error

ClientSync downloads the epinio client binary matching the current OS and architecture and replaces the currently running one.

func (*EpinioClient) ConfigurationDetails added in v0.6.0

func (c *EpinioClient) ConfigurationDetails(name string) error

ConfigurationDetails shows the information of a configuration specified by name

func (*EpinioClient) ConfigurationMatching added in v0.6.0

func (c *EpinioClient) ConfigurationMatching(prefix string) []string

ConfigurationMatching returns all Epinio configurations having the specified prefix in their name.

func (*EpinioClient) Configurations added in v0.6.0

func (c *EpinioClient) Configurations(all bool) error

Configurations gets all Epinio configurations in the targeted namespace

func (*EpinioClient) CreateConfiguration added in v0.6.0

func (c *EpinioClient) CreateConfiguration(name string, dict []string) error

CreateConfiguration creates a configuration specified by name and key/value dictionary TODO: Allow underscores in configuration names (right now they fail because of kubernetes naming rules for secrets)

func (*EpinioClient) CreateGitconfig added in v1.10.0

func (c *EpinioClient) CreateGitconfig(id,
	providerString, url, user, password, userorg, repo, certfile string,
	skipssl bool) error

CreateGitconfig creates a gitconfig

func (*EpinioClient) CreateNamespace added in v0.2.1

func (c *EpinioClient) CreateNamespace(namespace string) error

CreateNamespace creates a namespace

func (*EpinioClient) DeleteConfiguration added in v0.6.0

func (c *EpinioClient) DeleteConfiguration(names []string, unbind, all bool) error

DeleteConfiguration deletes one or more configurations, specified by name

func (*EpinioClient) DeleteGitconfig added in v1.10.0

func (c *EpinioClient) DeleteGitconfig(gitconfigs []string, all bool) error

DeleteGitconfig deletes a Gitconfig

func (*EpinioClient) DeleteNamespace added in v0.2.1

func (c *EpinioClient) DeleteNamespace(namespaces []string, force, all bool) error

DeleteNamespace deletes a Namespace

func (*EpinioClient) EnvList

func (c *EpinioClient) EnvList(ctx context.Context, appName string) error

EnvList displays a table of all environment variables and their values for the named application.

func (*EpinioClient) EnvMatching

func (c *EpinioClient) EnvMatching(ctx context.Context, appName, prefix string) []string

EnvMatching retrieves all environment variables in the cluster, for the specified application, and the given prefix

func (*EpinioClient) EnvSet

func (c *EpinioClient) EnvSet(ctx context.Context, appName, envName, envValue string) error

EnvSet adds or modifies the specified environment variable in the named application, with the given value. A workload is restarted.

func (*EpinioClient) EnvShow

func (c *EpinioClient) EnvShow(ctx context.Context, appName, envName string) error

EnvShow shows the value of the specified environment variable in the named application.

func (*EpinioClient) EnvUnset

func (c *EpinioClient) EnvUnset(ctx context.Context, appName, envName string) error

EnvUnset removes the specified environment variable from the named application. A workload is restarted.

func (*EpinioClient) ExportregistryList added in v1.10.0

func (c *EpinioClient) ExportregistryList(ctx context.Context) error

ExportregistryList displays a table of all known export registries.

func (*EpinioClient) ExportregistryMatching added in v1.10.0

func (c *EpinioClient) ExportregistryMatching(prefix string) []string

ExportregistryMatching retrieves all export registries in the cluster, for the given prefix

func (*EpinioClient) GetAPI added in v1.10.0

func (cli *EpinioClient) GetAPI() APIClient

func (*EpinioClient) Gitconfigs added in v1.10.0

func (c *EpinioClient) Gitconfigs() error

func (*EpinioClient) GitconfigsMatching added in v1.10.0

func (c *EpinioClient) GitconfigsMatching(prefix string) []string

GitconfigsMatching returns all Epinio gi tconfigurations having the specified prefix in their name

func (*EpinioClient) Info

func (c *EpinioClient) Info() error

Info displays information about environment

func (*EpinioClient) Init added in v1.10.0

func (c *EpinioClient) Init(ctx context.Context) error

func (*EpinioClient) Login added in v0.9.0

func (c *EpinioClient) Login(ctx context.Context, username, password, address string, trustCA bool) error

Login will ask the user for a username and password, and then it will update the settings file accordingly

func (*EpinioClient) LoginOIDC added in v1.3.0

func (c *EpinioClient) LoginOIDC(ctx context.Context, address string, trustCA, prompt bool) error

LoginOIDC implements the "public client" flow of dex: https://dexidp.io/docs/custom-scopes-claims-clients/#public-clients

func (*EpinioClient) Logout added in v1.9.0

func (c *EpinioClient) Logout(ctx context.Context) error

Login removes all authentication information from the settings file

func (*EpinioClient) Namespaces added in v0.2.1

func (c *EpinioClient) Namespaces() error

func (*EpinioClient) NamespacesMatching added in v0.2.1

func (c *EpinioClient) NamespacesMatching(prefix string) []string

NamespacesMatching returns all Epinio namespaces having the specified prefix in their name

func (*EpinioClient) ServiceBind added in v0.6.3

func (c *EpinioClient) ServiceBind(name, appName string) error

ServiceBind binds a service to an application

func (*EpinioClient) ServiceCatalog added in v0.6.2

func (c *EpinioClient) ServiceCatalog() error

ServiceCatalog lists available services

func (*EpinioClient) ServiceCatalogShow added in v0.6.2

func (c *EpinioClient) ServiceCatalogShow(ctx context.Context, serviceName string) error

ServiceCatalogShow shows a service

func (*EpinioClient) ServiceCreate added in v0.6.3

func (c *EpinioClient) ServiceCreate(catalogServiceName, serviceName string, wait bool,
	chartValues models.ChartValueSettings) error

ServiceCreate creates a service

func (*EpinioClient) ServiceDelete added in v0.7.0

func (c *EpinioClient) ServiceDelete(serviceNames []string, unbind, all bool) error

ServiceDelete deletes one or more services, specified by name

func (*EpinioClient) ServiceList added in v0.7.0

func (c *EpinioClient) ServiceList() error

ServiceList list of the service instances in the targeted namespace

func (*EpinioClient) ServiceListAll added in v0.9.0

func (c *EpinioClient) ServiceListAll() error

ServiceListAll list of all the services instances where the user has permissions

func (*EpinioClient) ServiceMatching

func (c *EpinioClient) ServiceMatching(prefix string) []string

ServiceMatching returns all Epinio services having the specified prefix in their name

func (*EpinioClient) ServicePortForward added in v1.9.0

func (c *EpinioClient) ServicePortForward(ctx context.Context, serviceName string, address, ports []string) error

func (*EpinioClient) ServiceShow added in v0.6.3

func (c *EpinioClient) ServiceShow(serviceName string) error

ServiceShow describes a service instance

func (*EpinioClient) ServiceUnbind added in v0.8.0

func (c *EpinioClient) ServiceUnbind(name, appName string) error

ServiceUnbind unbinds a service from an application

func (*EpinioClient) ServiceUpdate added in v1.10.0

func (c *EpinioClient) ServiceUpdate(name string, wait bool, removedKeys []string, assignments map[string]string) error

UpdateService updates a service specified by name and information about removed keys and changed assignments.

func (*EpinioClient) SettingsColors added in v1.10.0

func (c *EpinioClient) SettingsColors(ctx context.Context, colors bool) error

SettingsColors will update the settings colors configuration

func (*EpinioClient) SettingsShow added in v1.10.0

func (c *EpinioClient) SettingsShow(showPassword, showToken bool)

SettingsShow display the current settings configuration

func (*EpinioClient) SettingsUpdateCA added in v1.10.0

func (c *EpinioClient) SettingsUpdateCA(ctx context.Context) error

SettingsUpdateCA updates the CA credentials stored in the settings

func (*EpinioClient) ShowGitconfig added in v1.10.0

func (c *EpinioClient) ShowGitconfig(gcName string) error

ShowGitconfig shows a single Git configuration

func (*EpinioClient) ShowNamespace added in v0.2.1

func (c *EpinioClient) ShowNamespace(namespace string) error

ShowNamespace shows a Namespace

func (*EpinioClient) Target

func (c *EpinioClient) Target(namespace string) error

Target targets a namespace

func (*EpinioClient) TargetOk

func (c *EpinioClient) TargetOk() error

func (*EpinioClient) UI added in v1.8.1

func (cli *EpinioClient) UI() *termui.UI

func (*EpinioClient) UnbindConfiguration added in v0.6.0

func (c *EpinioClient) UnbindConfiguration(configurationName, appName string) error

UnbindConfiguration detaches the configuration specified by name from the named application, both in the targeted namespace.

func (*EpinioClient) UpdateConfiguration added in v0.6.0

func (c *EpinioClient) UpdateConfiguration(name string, removedKeys []string, assignments map[string]string) error

UpdateConfiguration updates a configuration specified by name and information about removed keys and changed assignments. TODO: Allow underscores in configuration names (right now they fail because of kubernetes naming rules for secrets)

type PushParams

type PushParams struct {
	models.ApplicationManifest
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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