Documentation ¶
Overview ¶
Package client connects to the Epinio API's endpoints
Index ¶
- func Delete[T any](c *Client, endpoint string, request any, response T) (T, error)
- func Do[T any](c *Client, endpoint string, method string, requestBody any, response T) (T, error)
- func DoWithHandlers[T any](c *Client, endpoint string, method string, requestHandler RequestHandler, ...) (T, error)
- func Get[T any](c *Client, endpoint string, response T) (T, error)
- func Patch[T any](c *Client, endpoint string, request any, response T) (T, error)
- func Post[T any](c *Client, endpoint string, request any, response T) (T, error)
- type APIError
- type Client
- func (c *Client) AllApps() (models.AppList, error)
- func (c *Client) AllConfigurations() (models.ConfigurationResponseList, error)
- func (c *Client) AllServices() (models.ServiceList, error)
- func (c *Client) AppCreate(request models.ApplicationCreateRequest, namespace string) (models.Response, error)
- func (c *Client) AppDelete(namespace string, names []string) (models.ApplicationDeleteResponse, error)
- func (c *Client) AppDeploy(request models.DeployRequest) (*models.DeployResponse, error)
- func (c *Client) AppExec(ctx context.Context, namespace string, appName, instance string, ...) error
- func (c *Client) AppExport(namespace, appName string, request models.AppExportRequest) (models.Response, error)
- func (c *Client) AppGetPart(namespace, appName, part string) (models.AppPartResponse, error)
- func (c *Client) AppImportGit(namespace string, name string, gitRef models.GitRef) (models.ImportGitResponse, error)
- func (c *Client) AppLogs(namespace, appName, stageID string, follow bool, ...) error
- func (c *Client) AppMatch(namespace, prefix string) (models.AppMatchResponse, error)
- func (c *Client) AppPortForward(namespace string, appName, instance string, opts *PortForwardOpts) error
- func (c *Client) AppRestart(namespace string, appName string) (models.Response, error)
- func (c *Client) AppRunning(app models.AppRef) (models.Response, error)
- func (c *Client) AppShow(namespace string, appName string) (models.App, error)
- func (c *Client) AppStage(request models.StageRequest) (*models.StageResponse, error)
- func (c *Client) AppUpdate(request models.ApplicationUpdateRequest, namespace string, appName string) (models.Response, error)
- func (c *Client) AppUpload(namespace string, name string, file FormFile) (models.UploadResponse, error)
- func (c *Client) AppValidateCV(namespace string, name string) (models.Response, error)
- func (c *Client) Apps(namespace string) (models.AppList, error)
- func (c *Client) AuthToken() (models.AuthTokenResponse, error)
- func (c *Client) ChartList() ([]models.AppChart, error)
- func (c *Client) ChartMatch(prefix string) (models.ChartMatchResponse, error)
- func (c *Client) ChartShow(name string) (models.AppChart, error)
- func (c *Client) ConfigurationApps(namespace string) (models.ConfigurationAppsResponse, error)
- func (c *Client) ConfigurationBindingCreate(request models.BindRequest, namespace string, appName string) (models.BindResponse, error)
- func (c *Client) ConfigurationBindingDelete(namespace string, appName string, configurationName string) (models.Response, error)
- func (c *Client) ConfigurationCreate(request models.ConfigurationCreateRequest, namespace string) (models.Response, error)
- func (c *Client) ConfigurationDelete(req models.ConfigurationDeleteRequest, namespace string, names []string) (models.ConfigurationDeleteResponse, error)
- func (c *Client) ConfigurationMatch(namespace, prefix string) (models.ConfigurationMatchResponse, error)
- func (c *Client) ConfigurationShow(namespace string, name string) (models.ConfigurationResponse, error)
- func (c *Client) ConfigurationUpdate(request models.ConfigurationUpdateRequest, namespace, name string) (models.Response, error)
- func (c *Client) Configurations(namespace string) (models.ConfigurationResponseList, error)
- func (c *Client) DisableVersionWarning()
- func (c *Client) Do(endpoint string, method string, body io.Reader) (*http.Response, error)
- func (c *Client) EnvList(namespace string, appName string) (models.EnvVariableMap, error)
- func (c *Client) EnvMatch(namespace string, appName string, prefix string) (models.EnvMatchResponse, error)
- func (c *Client) EnvSet(request models.EnvVariableMap, namespace string, appName string) (models.Response, error)
- func (c *Client) EnvShow(namespace string, appName string, envName string) (models.EnvVariable, error)
- func (c *Client) EnvUnset(namespace string, appName string, envName string) (models.Response, error)
- func (c *Client) ExportregistryList() ([]models.ExportregistryResponse, error)
- func (c *Client) ExportregistryMatch(prefix string) (models.ExportregistriesMatchResponse, error)
- func (c *Client) GitconfigCreate(request models.GitconfigCreateRequest) (models.Response, error)
- func (c *Client) GitconfigDelete(gitconfigs []string) (models.Response, error)
- func (c *Client) GitconfigShow(gitconfig string) (models.Gitconfig, error)
- func (c *Client) Gitconfigs() (models.GitconfigList, error)
- func (c *Client) GitconfigsMatch(prefix string) (models.GitconfigsMatchResponse, error)
- func (c *Client) Headers() http.Header
- func (c *Client) Info() (models.InfoResponse, error)
- func (c *Client) Me() (models.MeResponse, error)
- func (c *Client) NamespaceCreate(request models.NamespaceCreateRequest) (models.Response, error)
- func (c *Client) NamespaceDelete(namespaces []string) (models.Response, error)
- func (c *Client) NamespaceShow(namespace string) (models.Namespace, error)
- func (c *Client) Namespaces() (models.NamespaceList, error)
- func (c *Client) NamespacesMatch(prefix string) (models.NamespacesMatchResponse, error)
- func (c *Client) ServiceApps(namespace string) (models.ServiceAppsResponse, error)
- func (c *Client) ServiceBind(request models.ServiceBindRequest, namespace, name string) (models.Response, error)
- func (c *Client) ServiceCatalog() (models.CatalogServices, error)
- func (c *Client) ServiceCatalogMatch(prefix string) (models.CatalogMatchResponse, error)
- func (c *Client) ServiceCatalogShow(serviceName string) (*models.CatalogService, error)
- func (c *Client) ServiceCreate(request models.ServiceCreateRequest, namespace string) (models.Response, error)
- func (c *Client) ServiceDelete(request models.ServiceDeleteRequest, namespace string, names []string) (models.ServiceDeleteResponse, error)
- func (c *Client) ServiceList(namespace string) (models.ServiceList, error)
- func (c *Client) ServiceMatch(namespace, prefix string) (models.ServiceMatchResponse, error)
- func (c *Client) ServicePortForward(namespace string, serviceName string, opts *PortForwardOpts) error
- func (c *Client) ServiceShow(namespace, name string) (*models.Service, error)
- func (c *Client) ServiceUnbind(request models.ServiceUnbindRequest, namespace, name string) (models.Response, error)
- func (c *Client) ServiceUpdate(request models.ServiceUpdateRequest, namespace, name string) (models.Response, error)
- func (c *Client) SetHeader(key, value string)
- func (c *Client) StagingComplete(namespace string, id string) (models.Response, error)
- func (c *Client) VersionWarningEnabled() bool
- type FormFile
- type PortForwardOpts
- type RequestHandler
- type ResponseHandler
- type ServicePortForwarder
- type Upgrader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶ added in v1.9.0
Do will execute a common JSON http request, marshalling the provided body, and unmarshalling the httpResponse into the response struct
func DoWithHandlers ¶ added in v1.9.0
func DoWithHandlers[T any]( c *Client, endpoint string, method string, requestHandler RequestHandler, responseHandler ResponseHandler[T], ) (T, error)
DoWithHandlers will execute the request using the provided RequestHandler and ResponseHandler.
Types ¶
type APIError ¶ added in v1.9.0
type APIError struct { StatusCode int Err *apierrors.ErrorResponse }
type Client ¶
type Client struct { Settings *epiniosettings.Settings HttpClient *http.Client // contains filtered or unexported fields }
Client provides functionality for talking to an Epinio API server
func New ¶
func New(ctx context.Context, settings *epiniosettings.Settings) *Client
New returns a new Epinio API client
func (*Client) AllConfigurations ¶ added in v0.6.0
func (c *Client) AllConfigurations() (models.ConfigurationResponseList, error)
AllConfigurations returns a list of all configurations, across all namespaces
func (*Client) AllServices ¶ added in v0.1.5
func (c *Client) AllServices() (models.ServiceList, error)
func (*Client) AppCreate ¶
func (c *Client) AppCreate(request models.ApplicationCreateRequest, namespace string) (models.Response, error)
AppCreate creates an application resource
func (*Client) AppDelete ¶
func (c *Client) AppDelete(namespace string, names []string) (models.ApplicationDeleteResponse, error)
AppDelete deletes an app
func (*Client) AppDeploy ¶
func (c *Client) AppDeploy(request models.DeployRequest) (*models.DeployResponse, error)
AppDeploy deploys a staged app
func (*Client) AppExport ¶ added in v1.10.0
func (c *Client) AppExport(namespace, appName string, request models.AppExportRequest) (models.Response, error)
AppExport triggers an export of the app to a registry
func (*Client) AppGetPart ¶ added in v0.6.3
func (c *Client) AppGetPart(namespace, appName, part string) (models.AppPartResponse, error)
AppGetPart retrieves part of an app (values.yaml, chart, image)
func (*Client) AppImportGit ¶
func (c *Client) AppImportGit(namespace string, name string, gitRef models.GitRef) (models.ImportGitResponse, error)
AppImportGit asks the server to import a git repo and put in into the blob store
func (*Client) AppLogs ¶ added in v0.6.1
func (c *Client) AppLogs(namespace, appName, stageID string, follow bool, printCallback func(tailer.ContainerLogLine)) 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. Logs are streamed through the returned channel. There are 2 ways of stopping this method: 1. The websocket connection closes. 2. The context is canceled (used by the caller when printing of logs should be stopped).
func (*Client) AppMatch ¶ added in v0.9.0
func (c *Client) AppMatch(namespace, prefix string) (models.AppMatchResponse, error)
AppMatch returns all matching namespaces for the prefix
func (*Client) AppPortForward ¶ added in v0.4.0
func (c *Client) AppPortForward(namespace string, appName, instance string, opts *PortForwardOpts) error
AppPortForward will forward the local traffic to a remote app
func (*Client) AppRestart ¶ added in v0.6.0
AppRestart restarts an app
func (*Client) AppRunning ¶
AppRunning checks if the app is running
func (*Client) AppStage ¶
func (c *Client) AppStage(request models.StageRequest) (*models.StageResponse, error)
AppStage stages an app
func (*Client) AppUpdate ¶
func (c *Client) AppUpdate(request models.ApplicationUpdateRequest, namespace string, appName string) (models.Response, error)
AppUpdate updates an app
func (*Client) AppUpload ¶
func (c *Client) AppUpload(namespace string, name string, file FormFile) (models.UploadResponse, error)
AppUpload uploads a tarball for the named app, which is later used in staging
func (*Client) AppValidateCV ¶ added in v1.2.0
AppValidateCV validates the chart values of the specified app against its appchart
func (*Client) AuthToken ¶ added in v0.3.6
func (c *Client) AuthToken() (models.AuthTokenResponse, error)
func (*Client) ChartMatch ¶ added in v0.8.0
func (c *Client) ChartMatch(prefix string) (models.ChartMatchResponse, error)
ChartMatch returns all application charts whose name matches the prefix
func (*Client) ConfigurationApps ¶ added in v0.6.0
func (c *Client) ConfigurationApps(namespace string) (models.ConfigurationAppsResponse, error)
ConfigurationApps lists all the apps by configurations
func (*Client) ConfigurationBindingCreate ¶ added in v0.6.0
func (c *Client) ConfigurationBindingCreate(request models.BindRequest, namespace string, appName string) (models.BindResponse, error)
ConfigurationBindingCreate creates a binding from an app to a configurationclass
func (*Client) ConfigurationBindingDelete ¶ added in v0.6.0
func (c *Client) ConfigurationBindingDelete(namespace string, appName string, configurationName string) (models.Response, error)
ConfigurationBindingDelete deletes a binding from an app to a configurationclass
func (*Client) ConfigurationCreate ¶ added in v0.6.0
func (c *Client) ConfigurationCreate(request models.ConfigurationCreateRequest, namespace string) (models.Response, error)
ConfigurationCreate creates a configuration by invoking the associated API endpoint
func (*Client) ConfigurationDelete ¶ added in v0.6.0
func (c *Client) ConfigurationDelete(req models.ConfigurationDeleteRequest, namespace string, names []string) (models.ConfigurationDeleteResponse, error)
ConfigurationDelete deletes a configuration
func (*Client) ConfigurationMatch ¶ added in v0.9.0
func (c *Client) ConfigurationMatch(namespace, prefix string) (models.ConfigurationMatchResponse, error)
ConfigurationMatch returns all matching configurations for the prefix
func (*Client) ConfigurationShow ¶ added in v0.6.0
func (c *Client) ConfigurationShow(namespace string, name string) (models.ConfigurationResponse, error)
ConfigurationShow shows a configuration
func (*Client) ConfigurationUpdate ¶ added in v0.6.0
func (c *Client) ConfigurationUpdate(request models.ConfigurationUpdateRequest, namespace, name string) (models.Response, error)
ConfigurationUpdate updates a configuration by invoking the associated API endpoint
func (*Client) Configurations ¶ added in v0.6.0
func (c *Client) Configurations(namespace string) (models.ConfigurationResponseList, error)
Configurations returns a list of configurations for the specified namespace
func (*Client) DisableVersionWarning ¶ added in v1.4.0
func (c *Client) DisableVersionWarning()
func (*Client) Do ¶ added in v1.9.0
Do will execute a plain http request, returning the *http.Response
func (*Client) EnvMatch ¶
func (c *Client) EnvMatch(namespace string, appName string, prefix string) (models.EnvMatchResponse, error)
EnvMatch returns all env vars matching the prefix
func (*Client) EnvSet ¶
func (c *Client) EnvSet(request models.EnvVariableMap, namespace string, appName string) (models.Response, error)
EnvSet set env vars for an app
func (*Client) EnvShow ¶
func (c *Client) EnvShow(namespace string, appName string, envName string) (models.EnvVariable, error)
EnvShow shows an env variable
func (*Client) EnvUnset ¶
func (c *Client) EnvUnset(namespace string, appName string, envName string) (models.Response, error)
EnvUnset removes an env var
func (*Client) ExportregistryList ¶ added in v1.10.0
func (c *Client) ExportregistryList() ([]models.ExportregistryResponse, error)
ExportregistryList returns a list of all known application exportregistries
func (*Client) ExportregistryMatch ¶ added in v1.10.0
func (c *Client) ExportregistryMatch(prefix string) (models.ExportregistriesMatchResponse, error)
ExportregistryMatch returns all application exportregistries whose name matches the prefix
func (*Client) GitconfigCreate ¶ added in v1.10.0
GitconfigCreate creates a gitconfig
func (*Client) GitconfigDelete ¶ added in v1.10.0
GitconfigDelete deletes a gitconfig
func (*Client) GitconfigShow ¶ added in v1.10.0
GitconfigShow shows a gitconfig
func (*Client) Gitconfigs ¶ added in v1.10.0
func (c *Client) Gitconfigs() (models.GitconfigList, error)
Gitconfigs returns a list of gitconfigs
func (*Client) GitconfigsMatch ¶ added in v1.10.0
func (c *Client) GitconfigsMatch(prefix string) (models.GitconfigsMatchResponse, error)
GitconfigsMatch returns all matching gitconfigs for the prefix
func (*Client) Info ¶
func (c *Client) Info() (models.InfoResponse, error)
Info returns information about Epinio and its components
func (*Client) Me ¶ added in v1.11.0
func (c *Client) Me() (models.MeResponse, error)
Me returns the current user
func (*Client) NamespaceCreate ¶
NamespaceCreate creates a namespace
func (*Client) NamespaceDelete ¶
NamespaceDelete deletes a namespace
func (*Client) NamespaceShow ¶ added in v0.1.4
NamespaceShow shows a namespace
func (*Client) Namespaces ¶
func (c *Client) Namespaces() (models.NamespaceList, error)
Namespaces returns a list of namespaces
func (*Client) NamespacesMatch ¶
func (c *Client) NamespacesMatch(prefix string) (models.NamespacesMatchResponse, error)
NamespacesMatch returns all matching namespaces for the prefix
func (*Client) ServiceApps ¶
func (c *Client) ServiceApps(namespace string) (models.ServiceAppsResponse, error)
ServiceApps lists a map from services to bound apps, for the namespace
func (*Client) ServiceBind ¶ added in v0.6.3
func (*Client) ServiceCatalog ¶ added in v0.6.2
func (c *Client) ServiceCatalog() (models.CatalogServices, error)
func (*Client) ServiceCatalogMatch ¶ added in v0.9.0
func (c *Client) ServiceCatalogMatch(prefix string) (models.CatalogMatchResponse, error)
ServiceCatalogMatch returns all matching namespaces for the prefix
func (*Client) ServiceCatalogShow ¶ added in v0.6.2
func (c *Client) ServiceCatalogShow(serviceName string) (*models.CatalogService, error)
func (*Client) ServiceCreate ¶
func (*Client) ServiceDelete ¶
func (c *Client) ServiceDelete(request models.ServiceDeleteRequest, namespace string, names []string) (models.ServiceDeleteResponse, error)
func (*Client) ServiceList ¶ added in v0.7.0
func (c *Client) ServiceList(namespace string) (models.ServiceList, error)
func (*Client) ServiceMatch ¶ added in v0.9.0
func (c *Client) ServiceMatch(namespace, prefix string) (models.ServiceMatchResponse, error)
ServiceMatch returns all matching services for the prefix
func (*Client) ServicePortForward ¶ added in v1.9.0
func (c *Client) ServicePortForward(namespace string, serviceName string, opts *PortForwardOpts) error
ServicePortForward will forward the local traffic to a remote app
func (*Client) ServiceShow ¶
func (*Client) ServiceUnbind ¶ added in v0.8.0
func (*Client) ServiceUpdate ¶ added in v0.3.0
func (c *Client) ServiceUpdate(request models.ServiceUpdateRequest, namespace, name string) (models.Response, error)
ServiceUpdate updates a service by invoking the associated API endpoint
func (*Client) StagingComplete ¶
StagingComplete checks if the staging process is complete
func (*Client) VersionWarningEnabled ¶ added in v1.4.0
VersionWarningEnabled returns true if versionWarning field is either not set of true. That makes "true" the default value unless DisableVersionWarning is called.
type FormFile ¶ added in v1.9.0
FormFile is a file that can be used with the FileUpload request handler
type PortForwardOpts ¶ added in v0.4.0
type PortForwardOpts struct { Address []string Ports []string StopChannel chan struct{} ReadyChannel chan struct{} Out io.Writer ErrOut io.Writer }
func NewPortForwardOpts ¶ added in v0.4.0
func NewPortForwardOpts(address, ports []string) *PortForwardOpts
type RequestHandler ¶ added in v1.9.0
RequestHandler is a method that will return a *http.Request from a method and url
func NewFileUploadRequestHandler ¶ added in v1.9.0
func NewFileUploadRequestHandler(file FormFile) RequestHandler
NewFileUploadRequestHandler creates a multipart/form-data request to upload the provided file
func NewFormURLEncodedRequestHandler ¶ added in v1.9.0
func NewFormURLEncodedRequestHandler(data url.Values) RequestHandler
NewFormURLEncodedRequestHandler creates a application/x-www-form-urlencoded request encoding the provided data
func NewHTTPRequestHandler ¶ added in v1.9.0
func NewHTTPRequestHandler(body io.Reader) RequestHandler
NewHTTPRequestHandler return a plain *http.Request with the provided body
func NewJSONRequestHandler ¶ added in v1.9.0
func NewJSONRequestHandler(body any) RequestHandler
NewJSONRequestHandler creates a request marshalling the provided body into JSON
type ResponseHandler ¶ added in v1.9.0
ResponseHandler is a method that will handle a *http.Response to return a typed struct
func NewHTTPResponseHandler ¶ added in v1.9.0
func NewHTTPResponseHandler[T *http.Response]() ResponseHandler[T]
NewHTTPResponseHandler is a no-op ResponseHandler that returns the plain *http.Response that can be directly used
func NewJSONResponseHandler ¶ added in v1.9.0
func NewJSONResponseHandler[T any](logger logr.Logger, response T) ResponseHandler[T]
NewJSONResponseHandler will try to unmarshal the response body into the provided struct
type ServicePortForwarder ¶ added in v1.9.0
type ServicePortForwarder struct { Client *Client Endpoint string ListeningAddresses []ListenAddress Ports []ForwardedPort StopChan <-chan struct{} }
func NewServicePortForwarder ¶ added in v1.9.0
func (*ServicePortForwarder) ForwardPorts ¶ added in v1.9.0
func (pf *ServicePortForwarder) ForwardPorts() error
type Upgrader ¶ added in v0.3.6
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader implements the spdy.Upgrader interface. It delegates to spdy.SpdyRoundTripper but handles Epinio errors (like 404) first. The upstream upgrader would simply ignore 404 in cases when app or namespace is not found. Here: https://github.com/kubernetes/apimachinery/blob/v0.21.4/pkg/util/httpstream/spdy/roundtripper.go#L343
func NewUpgrader ¶ added in v0.3.6
func NewUpgrader(cfg spdy.RoundTripperConfig) *Upgrader
func (*Upgrader) NewConnection ¶ added in v0.3.6
func (upgr *Upgrader) NewConnection(resp *http.Response) (httpstream.Connection, error)