Documentation ¶
Index ¶
- func DeployResources(args DeployResourcesArgs) (ids map[string]string, err error)
- func FormatCharmTabular(value interface{}) ([]byte, error)
- func FormatSvcTabular(value interface{}) ([]byte, error)
- type CharmCommandBase
- type CharmResourceLister
- type DeployClient
- type DeployResourcesArgs
- type FormattedCharmResource
- type FormattedDetailResource
- type FormattedServiceDetails
- type FormattedServiceInfo
- type FormattedSvcResource
- type FormattedUnitDetails
- type FormattedUnitResource
- type ListCharmResourcesCommand
- type ReadSeekCloser
- type ShowServiceClient
- type ShowServiceCommand
- type ShowServiceDeps
- type UploadClient
- type UploadCommand
- type UploadDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeployResources ¶
func DeployResources(args DeployResourcesArgs) (ids map[string]string, err error)
DeployResources uploads the bytes for the given files to the server and creates pending resource metadata for the all resource mentioned in the metadata. It returns a map of resource name to pending resource IDs.
func FormatCharmTabular ¶
FormatCharmTabular returns a tabular summary of charm resources.
func FormatSvcTabular ¶
FormatSvcTabular returns a tabular summary of resources.
Types ¶
type CharmCommandBase ¶
type CharmCommandBase interface { // Connect connects to the charm store and returns a client. // cmd.Context needs to be passed in so that we can do authentication // via the cli if available. Connect(*cmd.Context) (CharmResourceLister, error) }
CharmCommandBase exposes the functionality of charmcmd.CommandBase needed here.
type CharmResourceLister ¶
type CharmResourceLister interface { // ListResources lists the resources for each of the identified charms. ListResources([]charmstore.CharmID) ([][]charmresource.Resource, error) // Close closes the client. Close() error }
CharmResourceLister has the charm store API methods needed by ListCharmResourcesCommand.
type DeployClient ¶
type DeployClient interface { // AddPendingResources adds pending metadata for store-based resources. AddPendingResources(serviceID string, chID charmstore.CharmID, csMac *macaroon.Macaroon, resources []charmresource.Resource) (ids []string, err error) // AddPendingResource uploads data and metadata for a pending resource for the given service. AddPendingResource(serviceID string, resource charmresource.Resource, filename string, r io.ReadSeeker) (id string, err error) }
DeployClient exposes the functionality of the resources API needed for deploy.
type DeployResourcesArgs ¶
type DeployResourcesArgs struct { // ServiceID identifies the service being deployed. ServiceID string // CharmID identifies the service's charm. CharmID charmstore.CharmID // CharmStoreMacaroon is the macaroon to use for the charm when // interacting with the charm store. CharmStoreMacaroon *macaroon.Macaroon // Filenames is the set of resources for which a filename // was provided at the command-line. Filenames map[string]string // Revisions is the set of resources for which a revision // was provided at the command-line. Revisions map[string]int // ResourcesMeta holds the charm metadata for each of the resources // that should be added/updated on the controller. ResourcesMeta map[string]charmresource.Meta // Client is the resources API client to use during deploy. Client DeployClient }
DeployResourcesArgs holds the arguments to DeployResources().
type FormattedCharmResource ¶
type FormattedCharmResource struct { // These fields are exported for the sake of serialization. Name string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` Path string `json:"path" yaml:"path"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` Fingerprint string `json:"fingerprint" yaml:"fingerprint"` Size int64 `json:"size" yaml:"size"` Origin string `json:"origin" yaml:"origin"` }
FormattedCharmResource holds the formatted representation of a resource's info.
func FormatCharmResource ¶
func FormatCharmResource(res charmresource.Resource) FormattedCharmResource
FormatCharmResource converts the resource info into a FormattedCharmResource.
type FormattedDetailResource ¶
type FormattedDetailResource struct { UnitID string `json:"unitID" yaml:"unitID"` Unit FormattedSvcResource `json:"unit" yaml:"unit"` Expected FormattedSvcResource `json:"expected" yaml:"expected"` Progress int64 `json:"progress,omitempty" yaml:"progress,omitempty"` // contains filtered or unexported fields }
FormattedDetailResource is the data for a single line of tabular output for juju resources <service> --details.
func FormatDetailResource ¶
func FormatDetailResource(tag names.UnitTag, svc, unit resource.Resource, progress int64) (FormattedDetailResource, error)
FormatDetailResource converts the arguments into a FormattedServiceResource.
type FormattedServiceDetails ¶
type FormattedServiceDetails struct { Resources []FormattedDetailResource `json:"resources,omitempty" yaml:"resources,omitempty"` Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` }
FormattedServiceDetails is the data for the tabular output for juju resources <service> --details.
func FormatServiceDetails ¶
func FormatServiceDetails(sr resource.ServiceResources) (FormattedServiceDetails, error)
FormatServiceDetails converts a ServiceResources value into a formatted value for display on the command line.
type FormattedServiceInfo ¶
type FormattedServiceInfo struct { Resources []FormattedSvcResource `json:"resources,omitempty" yaml:"resources,omitempty"` Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` }
FormattedServiceInfo holds the formatted representation of the information about a service's resources.
type FormattedSvcResource ¶
type FormattedSvcResource struct { // These fields are exported for the sake of serialization. ID string `json:"resourceid,omitempty" yaml:"resourceid,omitempty"` ServiceID string `json:"serviceid,omitempty" yaml:"serviceid,omitempty"` Name string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` Path string `json:"path" yaml:"path"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` Fingerprint string `json:"fingerprint" yaml:"fingerprint"` Size int64 `json:"size" yaml:"size"` Origin string `json:"origin" yaml:"origin"` Used bool `json:"used" yaml:"used"` Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` Username string `json:"username,omitempty" yaml:"username,omitempty"` // contains filtered or unexported fields }
FormattedSvcResource holds the formatted representation of a resource's info.
func FormatSvcResource ¶
func FormatSvcResource(res resource.Resource) FormattedSvcResource
FormatSvcResource converts the resource info into a FormattedServiceResource.
type FormattedUnitDetails ¶
type FormattedUnitDetails []FormattedDetailResource
FormattedDetailResource is the data for the tabular output for juju resources <unit> --details.
type FormattedUnitResource ¶
type FormattedUnitResource FormattedSvcResource
FormattedUnitResource holds the formatted representation of a resource's info.
type ListCharmResourcesCommand ¶
type ListCharmResourcesCommand struct { modelcmd.ModelCommandBase CharmCommandBase // contains filtered or unexported fields }
ListCharmResourcesCommand implements the "juju charm list-resources" command.
func NewListCharmResourcesCommand ¶
func NewListCharmResourcesCommand(base CharmCommandBase) *ListCharmResourcesCommand
NewListCharmResourcesCommand returns a new command that lists resources defined by a charm.
func (*ListCharmResourcesCommand) Info ¶
func (c *ListCharmResourcesCommand) Info() *cmd.Info
Info implements cmd.Command.
func (*ListCharmResourcesCommand) Init ¶
func (c *ListCharmResourcesCommand) Init(args []string) error
Init implements cmd.Command.
func (*ListCharmResourcesCommand) Run ¶
func (c *ListCharmResourcesCommand) Run(ctx *cmd.Context) error
Run implements cmd.Command.
func (*ListCharmResourcesCommand) SetFlags ¶
func (c *ListCharmResourcesCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags implements cmd.Command.
type ReadSeekCloser ¶
type ReadSeekCloser interface { io.ReadCloser io.Seeker }
ReadSeekCloser combines 2 interfaces.
type ShowServiceClient ¶
type ShowServiceClient interface { // ListResources returns info about resources for services in the model. ListResources(services []string) ([]resource.ServiceResources, error) // Close closes the connection. Close() error }
ShowServiceClient has the API client methods needed by ShowServiceCommand.
type ShowServiceCommand ¶
type ShowServiceCommand struct { modelcmd.ModelCommandBase // contains filtered or unexported fields }
ShowServiceCommand implements the upload command.
func NewShowServiceCommand ¶
func NewShowServiceCommand(deps ShowServiceDeps) *ShowServiceCommand
NewShowServiceCommand returns a new command that lists resources defined by a charm.
func (*ShowServiceCommand) Info ¶
func (c *ShowServiceCommand) Info() *cmd.Info
Info implements cmd.Command.Info.
func (*ShowServiceCommand) Init ¶
func (c *ShowServiceCommand) Init(args []string) error
Init implements cmd.Command.Init. It will return an error satisfying errors.BadRequest if you give it an incorrect number of arguments.
func (*ShowServiceCommand) Run ¶
func (c *ShowServiceCommand) Run(ctx *cmd.Context) error
Run implements cmd.Command.Run.
func (*ShowServiceCommand) SetFlags ¶
func (c *ShowServiceCommand) SetFlags(f *gnuflag.FlagSet)
SetFlags implements cmd.Command.SetFlags.
type ShowServiceDeps ¶
type ShowServiceDeps struct { // NewClient returns the value that wraps the API for showing service // resources from the server. NewClient func(*ShowServiceCommand) (ShowServiceClient, error) }
ShowServiceDeps is a type that contains external functions that ShowService depends on to function.
type UploadClient ¶
type UploadClient interface { // Upload sends the resource to Juju. Upload(service, name, filename string, resource io.ReadSeeker) error // Close closes the client. Close() error }
UploadClient has the API client methods needed by UploadCommand.
type UploadCommand ¶
type UploadCommand struct { modelcmd.ModelCommandBase // contains filtered or unexported fields }
UploadCommand implements the upload command.
func NewUploadCommand ¶
func NewUploadCommand(deps UploadDeps) *UploadCommand
NewUploadCommand returns a new command that lists resources defined by a charm.
func (*UploadCommand) Info ¶
func (c *UploadCommand) Info() *cmd.Info
Info implements cmd.Command.Info
func (*UploadCommand) Init ¶
func (c *UploadCommand) Init(args []string) error
Init implements cmd.Command.Init. It will return an error satisfying errors.BadRequest if you give it an incorrect number of arguments.
type UploadDeps ¶
type UploadDeps struct { // NewClient returns the value that wraps the API for uploading to the server. NewClient func(*UploadCommand) (UploadClient, error) // OpenResource handles creating a reader from the resource path. OpenResource func(path string) (ReadSeekCloser, error) }
UploadDeps is a type that contains external functions that Upload depends on to function.