api

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	Send(url string, method string, body io.Reader) (*http.Response, []byte, error)
}

APIClient defines the contract for the http client implementation to send requests to the albatross api server

type Client

type Client interface {
	// List returns a list of release corresponding to the provided list flags
	List(ctx context.Context, fl flags.ListFlags) ([]release.Release, error)

	// Install installs a release, specified by the params, and returns a status
	// TODO: We should have the api return the release object, instead of just the status
	Install(ctx context.Context, name string, chart string, values Values, fl flags.InstallFlags) (string, error)

	// Upgrade installs a release, specified by the params, and returns a status.
	// UpgradeFlags govern the actions of upgrade action, i.e whether it should be installed if not present
	Upgrade(ctx context.Context, name string, chart string, values Values, fl flags.UpgradeFlags) (string, error)

	// Status returns the status of a release with the specific release and revision
	Status(ctx context.Context, name string, fl flags.StatusFlags) (release.Release, error)

	Uninstall(ctx context.Context, name string, fl flags.UninstallFlags) (release.Release, error)
}

Client represents a contract that a concrete client types(http/grpc) must implement

func NewClient

func NewClient(host string, opts ...config.Option) (Client, error)

NewClient returns a new http client for the corresponding host and config options. In case of invalid host, it returns an error

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

HttpClient is responsible to sending api requests and parsing their responses It embeds the base url of the albatross service and an underlying http apiclient that handles sending requests to the albatross api server

func (*HttpClient) Install

func (c *HttpClient) Install(ctx context.Context, name string, chart string, values Values, fl flags.InstallFlags) (string, error)

Install calls the install api and returns the status TODO: Make install api return an installed release rather than just the status

func (*HttpClient) List

func (c *HttpClient) List(ctx context.Context, fl flags.ListFlags) ([]release.Release, error)

List sends the list api request to the APIClient and returns a list of releases if successfull.

func (*HttpClient) Status

func (c *HttpClient) Status(ctx context.Context, name string, fl flags.StatusFlags) (release.Release, error)

func (*HttpClient) Uninstall

func (c *HttpClient) Uninstall(ctx context.Context, name string, fl flags.UninstallFlags) (release.Release, error)

func (*HttpClient) Upgrade

func (c *HttpClient) Upgrade(ctx context.Context, name string, chart string, values Values, fl flags.UpgradeFlags) (string, error)

Upgrade calls the upgrade api and returns the status

type Values

type Values map[string]interface{}

Values represents the chart values that need to be overriden

Jump to

Keyboard shortcuts

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