Documentation ¶
Overview ¶
Package charmhub implements the Charmhub-related CLI commands, such as "juju download", "juju find", and "juju info".
Index ¶
- Constants
- func InfoASCIIMap() map[UnicodeCharIdent]string
- func InfoUnicodeMap() map[UnicodeCharIdent]string
- func NewDownloadCommand() cmd.Command
- func NewFindCommand() cmd.Command
- func NewInfoCommand() cmd.Command
- type Base
- type Bundle
- type BundleCharm
- type Charm
- type CharmHubClient
- type Column
- type ColumnName
- type Columns
- type FindResponse
- type InfoResponse
- type Log
- type OSEnviron
- type Printer
- type Revision
- type RevisionsMap
- type UnicodeCharIdent
- type UnicodeWriter
Constants ¶
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 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 { URL() string Info(ctx context.Context, name string, options ...charmhub.InfoOption) (transport.InfoResponse, error) Find(ctx context.Context, query string, options ...charmhub.FindOption) ([]transport.FindResponse, error) Refresh(context.Context, charmhub.RefreshConfig) ([]transport.RefreshResponse, error) Download(ctx context.Context, resourceURL *url.URL, archivePath string, options ...charmhub.DownloadOption) error }
CharmHubClient represents a CharmHub Client for making queries to the CharmHub API.
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 ¶
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 ¶
MakeColumns creates a new set of columns using the string for selecting each column from a base set of columns.
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"` Supports []Base `json:"supports,omitempty" yaml:"supports,omitempty"` StoreURL string `json:"store-url" yaml:"store-url"` }
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"` Supports []Base `json:"supports,omitempty" yaml:"supports,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 RevisionsMap `json:"channels" yaml:"channels"` 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 Printer ¶
type Printer interface {
Print() error
}
Printer defines an interface for printing out values.
type Revision ¶
type Revision struct { Track string `json:"track" yaml:"track"` Risk string `json:"risk" yaml:"risk"` Version string `json:"version" yaml:"version"` Revision int `json:"revision" yaml:"revision"` ReleasedAt string `json:"released-at" yaml:"released-at"` Size int `json:"size" yaml:"size"` Arches []string `json:"architectures" yaml:"architectures"` Bases []Base `json:"bases" yaml:"bases"` }
type RevisionsMap ¶
RevisionsMap is a map of tracks to risks to list of revisions, for example {"latest": {"stable": [r3, r2, r1]}}.
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 ¶
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.