utils

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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduceOrigin

func DeduceOrigin(url *charm.URL, channel corecharm.Channel, platform corecharm.Platform) (commoncharm.Origin, error)

DeduceOrigin attempts to deduce the origin from a channel and a platform. Depending on what the charm URL schema is, will then construct the correct origin for that application.

func DeducePlatform

func DeducePlatform(cons constraints.Value, series string, modelCons constraints.Value) (corecharm.Platform, error)

DeducePlatform attempts to create a Platform (architecture, os and series) from a set of constraints or a free style series.

func GetFlags

func GetFlags(flagSet *gnuflag.FlagSet, flagNames []string) []string

GetFlags returns the flags with the given names. Only flags that are set and whose name is included in flagNames are included.

func GetMetaResources

func GetMetaResources(charmURL *charm.URL, client CharmClient) (map[string]charmresource.Meta, error)

GetMetaResources retrieves metadata resources for the given charm.URL.

func GetUpgradeResources

func GetUpgradeResources(
	resourceLister ResourceLister,
	applicationID string,
	cliResources map[string]string,
	meta map[string]charmresource.Meta,
) (map[string]charmresource.Meta, error)

GetUpgradeResources

func ParsePlacement

func ParsePlacement(spec string) (*instance.Placement, error)

ParsePlacement validates provided placement of a unit and returns instance.Placement.

func ReadValue

func ReadValue(ctx *cmd.Context, filesystem modelcmd.Filesystem, filename string) (string, error)

ReadValue reads the value of an option out of the named file. An empty content is valid, like in parsing the options. The upper size is 5M.

Types

type CharmClient

type CharmClient interface {
	CharmInfo(string) (*charms.CharmInfo, error)
}

CharmClient defines a subset of the charms facade, as required by the upgrade-charm command and to GetMetaResources.

type ResourceLister

type ResourceLister interface {
	ListResources([]string) ([]resource.ApplicationResources, error)
}

ResourceLister defines a subset of the resources facade, as required by the upgrade-charm command and to deploy bundles.

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