charmhub

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SeriesAll defines a platform that targets all series.
	SeriesAll = "all"
	// ArchAll defines a platform that targets all architectures.
	ArchAll = "all"
)

Variables

This section is empty.

Functions

func InfoASCIIMap

func InfoASCIIMap() map[UnicodeCharIdent]string

InfoASCIIMap defines the ascii character map that is used for outputting the fallback to unicode characters when not supported.

func InfoUnicodeMap

func InfoUnicodeMap() map[UnicodeCharIdent]string

InfoUnicodeMap defines the unicode character map that is used for outputting unicode characters.

func NewDownloadCommand

func NewDownloadCommand() cmd.Command

NewDownloadCommand wraps downloadCommand with sane model settings.

func NewFindCommand

func NewFindCommand() cmd.Command

NewFindCommand wraps findCommand with sane model settings.

func NewInfoCommand

func NewInfoCommand() cmd.Command

NewInfoCommand wraps infoCommand with sane model settings.

Types

type Bundle

type Bundle struct {
	Charms []BundleCharm `json:"charms,omitempty" yaml:"charms,omitempty"`
}

type BundleCharm

type BundleCharm struct {
	Name string `json:"name" yaml:"name"`
}

type Channel

type Channel struct {
	ReleasedAt string   `json:"released-at" yaml:"released-at"`
	Track      string   `json:"track" yaml:"track"`
	Risk       string   `json:"risk" yaml:"risk"`
	Revision   int      `json:"revision" yaml:"revision"`
	Size       int      `json:"size" yaml:"size"`
	Version    string   `json:"version" yaml:"version"`
	Arches     []string `json:"architectures" yaml:"architectures"`
	Series     []string `json:"series" yaml:"series"`
}

type Charm

type Charm struct {
	Config      *charm.Config                `json:"config,omitempty" yaml:"config,omitempty"`
	Relations   map[string]map[string]string `json:"relations,omitempty" yaml:"relations,omitempty"`
	Subordinate bool                         `json:"subordinate,omitempty" yaml:"subordinate,omitempty"`
	UsedBy      []string                     `json:"used-by,omitempty" yaml:"used-by,omitempty"` // bundles which use the charm
}

Charm matches a params.CharmHubCharm

type CharmHubClient

type CharmHubClient interface {
	// Refresh returns the charm/bundle response for a given configuration.
	Refresh(context.Context, charmhub.RefreshConfig) ([]transport.RefreshResponse, error)

	// Download defines a client for downloading charms directly.
	Download(context.Context, *url.URL, string) error
}

CharmHubClient defines a charmhub client, used for querying the charmhub store.

type Column

type Column struct {
	Index int
	Name  ColumnName
}

Column holds the column name and the index location.

type ColumnName

type ColumnName = string

ColumnName describes the column name when outputting the find query.

const (
	ColumnNameName          ColumnName = "Name"
	ColumnNameBundle        ColumnName = "Bundle"
	ColumnNameVersion       ColumnName = "Version"
	ColumnNameArchitectures ColumnName = "Architectures"
	ColumnNameOS            ColumnName = "OS"
	ColumnNameSupports      ColumnName = "Supports"
	ColumnNamePublisher     ColumnName = "Publisher"
	ColumnNameSummary       ColumnName = "Summary"
)

type Columns

type Columns map[rune]Column

Columns represents the find columns for the find writer.

func DefaultColumns

func DefaultColumns() Columns

DefaultColumns represents the default columns for the output of the find.

func MakeColumns

func MakeColumns(d Columns, s string) (Columns, error)

MakeColumns creates a new set of columns using the string for selecting each column from a base set of columns.

func (Columns) Names

func (c Columns) Names() []string

Names returns the names of all the columns.

type DownloadCommandAPI

DownloadCommandAPI describes API methods required to execute the download command.

type FindCommandAPI

type FindCommandAPI interface {
	Find(string, ...apicharmhub.FindOption) ([]apicharmhub.FindResponse, error)
	Close() error
}

FindCommandAPI describes API methods required to execute the find command.

type FindResponse

type FindResponse struct {
	Type      string   `json:"type" yaml:"type"`
	ID        string   `json:"id" yaml:"id"`
	Name      string   `json:"name" yaml:"name"`
	Publisher string   `json:"publisher" yaml:"publisher"`
	Summary   string   `json:"summary" yaml:"summary"`
	Version   string   `json:"version" yaml:"version"`
	Arches    []string `json:"architectures,omitempty" yaml:"architectures,omitempty"`
	OS        []string `json:"os,omitempty" yaml:"os,omitempty"`
	Series    []string `json:"series,omitempty" yaml:"series,omitempty"`
	StoreURL  string   `json:"store-url" yaml:"store-url"`
}

type InfoCommandAPI

type InfoCommandAPI interface {
	Info(string, ...apicharmhub.InfoOption) (apicharmhub.InfoResponse, error)
	Close() error
}

InfoCommandAPI describes API methods required to execute the info command.

type InfoResponse

type InfoResponse struct {
	Type        string             `json:"type" yaml:"type"`
	ID          string             `json:"id" yaml:"id"`
	Name        string             `json:"name" yaml:"name"`
	Description string             `json:"description" yaml:"description"`
	Publisher   string             `json:"publisher" yaml:"publisher"`
	Summary     string             `json:"summary" yaml:"summary"`
	Series      []string           `json:"series,omitempty" yaml:"series,omitempty"`
	StoreURL    string             `json:"store-url" yaml:"store-url"`
	Tags        []string           `json:"tags,omitempty" yaml:"tags,omitempty"`
	Charm       *Charm             `json:"charm,omitempty" yaml:"charm,omitempty"`
	Bundle      *Bundle            `json:"bundle,omitempty" yaml:"bundle,omitempty"`
	Channels    map[string]Channel `json:"channel-map" yaml:"channel-map"`
	Tracks      []string           `json:"tracks,omitempty" yaml:"tracks,omitempty"`
}

type Log

type Log = func(format string, params ...interface{})

Log describes a log format function to output to.

type ModelConfigClient

type ModelConfigClient interface {
	ModelConfigGetter
	Close() error
}

ModelConfigClient represents a model config client for requesting model configurations.

type ModelConfigGetter

type ModelConfigGetter interface {
	ModelGet() (map[string]interface{}, error)
}

type OSEnviron

type OSEnviron interface {
	Getenv(string) string
	IsTerminal() bool
}

OSEnviron represents an interface around the os environment.

type Printer

type Printer interface {
	Print() error
}

Printer defines an interface for printing out values.

type UnicodeCharIdent

type UnicodeCharIdent string

UnicodeCharIdent represents a type of character to print when using the writer.

const (
	UnicodeDash    UnicodeCharIdent = "dash"
	UnicodeUpArrow UnicodeCharIdent = "up-arrow"
	UnicodeTick    UnicodeCharIdent = "tick"
)

type UnicodeWriter

type UnicodeWriter struct {
	output.Wrapper
	// contains filtered or unexported fields
}

UnicodeWriter allows the addition of printing unicode characters if available.

func InfoUnicodeWriter

func InfoUnicodeWriter(writer output.Wrapper, mode string) *UnicodeWriter

InfoUnicodeWriter creates a unicode writer that wraps a writer for writing data from the info endpoint.

func (*UnicodeWriter) PrintlnUnicode

func (w *UnicodeWriter) PrintlnUnicode(char UnicodeCharIdent) (int, error)

PrintlnUnicode prints a unicode character from a map of stored unicodes available to the writer.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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