charmhub

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

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

type BundleCharm

type BundleCharm struct {
	Name      string `json:"name"`
	PackageID string `json:"package-id"`
}

type Channel

type Channel struct {
	ReleasedAt string     `json:"released-at"`
	Track      string     `json:"track"`
	Risk       string     `json:"risk"`
	Revision   int        `json:"revision"`
	Size       int        `json:"size"`
	Version    string     `json:"version"`
	Platforms  []Platform `json:"platforms"`
	Resources  []Resource `json:"resources"`
}

type Charm

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

Charm matches a params.CharmHubCharm

type Client

type Client struct {
	base.ClientFacade
	// contains filtered or unexported fields
}

Client allows access to the CharmHub API end point.

func NewClient

func NewClient(callCloser base.APICallCloser) *Client

NewClient creates a new client for accessing the CharmHub API.

func (*Client) Find

func (c *Client) Find(query string, options ...FindOption) ([]FindResponse, error)

Find queries the CharmHub API finding potential charms or bundles for the given query.

func (*Client) Info

func (c *Client) Info(name string, options ...InfoOption) (InfoResponse, error)

Info queries the CharmHub API for information for a given name.

type FindOption

type FindOption func(*findOptions)

FindOption to be passed to Find to customize the resulting request.

func WithFindCategory

func WithFindCategory(category string) FindOption

WithFindCategory sets the category on the option.

func WithFindChannel

func WithFindChannel(channel string) FindOption

WithFindChannel sets the channel on the option.

func WithFindPlatforms

func WithFindPlatforms(platforms string) FindOption

WithFindPlatforms sets the charmPlatforms on the option.

func WithFindPublisher

func WithFindPublisher(publisher string) FindOption

WithFindPublisher sets the publisher on the option.

func WithFindRelationProvides

func WithFindRelationProvides(relationProvides string) FindOption

WithFindRelationProvides sets the relationProvides on the option.

func WithFindRelationRequires

func WithFindRelationRequires(relationRequires string) FindOption

WithFindRelationRequires sets the relationRequires on the option.

func WithFindType

func WithFindType(charmType string) FindOption

WithFindType sets the charmType on the option.

type FindResponse

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

type InfoOption

type InfoOption func(*infoOptions)

InfoOption to be passed to Info to customize the resulting request.

func WithInfoChannel

func WithInfoChannel(ch string) InfoOption

WithInfoChannel sets the channel on the option.

type InfoResponse

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

type Platform

type Platform struct {
	Architecture string `json:"architecture"`
	OS           string `json:"os"`
	Series       string `json:"series"`
}

type Resource

type Resource struct {
	Name     string `json:"name"`
	Revision int    `json:"revision"`
	Type     string `json:"type"`
	Size     int    `json:"size"`
	URL      string `json:"url"`
}

Jump to

Keyboard shortcuts

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