usercmd

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package usercmd provides Epinio CLI commands for users

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() (string, 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, tarball string) (models.UploadResponse, error)
	AppImportGit(app models.AppRef, 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(namespace string, appName, instance string, tty kubectlterm.TTY) error
	AppPortForward(namespace string, appName, instance string, opts *epinioapi.PortForwardOpts) error
	AppRestart(namespace string, appName string) error
	AppGetPart(namespace, appName, part, destinationPath string) error
	AppMatch(namespace, prefix string) (models.AppMatchResponse, error)
	AppValidateCV(namespace string, name string) (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(namespace 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, f epinioapi.ErrorFunc) (models.ConfigurationDeleteResponse, error)
	ConfigurationCreate(req models.ConfigurationCreateRequest, namespace string) (models.Response, error)
	ConfigurationUpdate(req models.ConfigurationUpdateRequest, namespace, name string) (models.Response, error)
	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(req *models.ServiceShowRequest, namespace string) (*models.Service, error)
	ServiceCreate(req *models.ServiceCreateRequest, namespace string) error
	ServiceBind(req *models.ServiceBindRequest, namespace, name string) error
	ServiceUnbind(req *models.ServiceUnbindRequest, namespace, name string) error
	ServiceDelete(req models.ServiceDeleteRequest, namespace string, names []string, f epinioapi.ErrorFunc) (models.ServiceDeleteResponse, error)
	ServiceList(namespace string) (models.ServiceList, error)
	ServiceMatch(namespace, prefix string) (models.ServiceMatchResponse, error)

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

	DisableVersionWarning()
	VersionWarningEnabled() bool
}

type EpinioClient

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

	API APIClient
	// contains filtered or unexported fields
}

EpinioClient provides functionality for talking to a Epinio installation on Kubernetes

func New

func New(ctx context.Context) (*EpinioClient, error)

func NewEpinioClient added in v0.6.0

func NewEpinioClient(cfg *settings.Settings, apiClient APIClient) (*EpinioClient, error)

func (*EpinioClient) AppCreate

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

AppCreate creates an app without a workload

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, directory string) 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) AppRestage added in v0.6.1

func (c *EpinioClient) AppRestage(appName string) 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) 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(ctx context.Context, 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) CreateNamespace added in v0.2.1

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

CreateNamespace creates a namespace

func (*EpinioClient) Delete

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

Delete removes one or more applications, specified by name

func (*EpinioClient) DeleteConfiguration added in v0.6.0

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

DeleteConfiguration deletes one or more configurations, specified by name

func (*EpinioClient) DeleteNamespace added in v0.2.1

func (c *EpinioClient) DeleteNamespace(namespace string) 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) Info

func (c *EpinioClient) Info() error

Info displays information about environment

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) 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) Push

func (c *EpinioClient) Push(ctx context.Context, params PushParams) 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) 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(serviceName string) error

ServiceCatalogShow shows a service

func (*EpinioClient) ServiceCreate added in v0.6.3

func (c *EpinioClient) ServiceCreate(catalogServiceName, serviceName string) error

ServiceCreate creates a service

func (*EpinioClient) ServiceDelete added in v0.7.0

func (c *EpinioClient) ServiceDelete(serviceNames []string, unbind 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) 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) ShowNamespace added in v0.2.1

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

ShowNamepsace 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) 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