bundlechanges

package module
v5.0.0-...-f5fb3bb Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: LGPL-3.0 Imports: 14 Imported by: 0

README

Juju Bundle Changes

A Go library to generate the list of changes required to deploy a bundle.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddApplicationChange

type AddApplicationChange struct {

	// Params holds parameters for adding an application.
	Params AddApplicationParams
	// contains filtered or unexported fields
}

AddApplicationChange holds a change for deploying a Juju application.

func (*AddApplicationChange) Args

func (ch *AddApplicationChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*AddApplicationChange) Description

func (ch *AddApplicationChange) Description() []string

Description implements Change.

func (*AddApplicationChange) GUIArgs

func (ch *AddApplicationChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*AddApplicationChange) GUIArgsWithDevices

func (ch *AddApplicationChange) GUIArgsWithDevices() []interface{}

GUIArgsWithDevices implements Change.GUIArgs and adds devices support

func (*AddApplicationChange) Id

func (ch *AddApplicationChange) Id() string

Id implements Change.Id.

func (*AddApplicationChange) Method

func (ch *AddApplicationChange) Method() string

Method implements Change.Method.

func (*AddApplicationChange) Requires

func (ch *AddApplicationChange) Requires() []string

Requires implements Change.Requires.

type AddApplicationParams

type AddApplicationParams struct {
	// Charm holds the URL of the charm to be used to deploy this application.
	Charm string `json:"charm"`
	// Series holds the series of the application to be deployed
	// if the charm default is not sufficient.
	Series string `json:"series,omitempty"`
	// Application holds the application name.
	Application string `json:"application,omitempty"`
	// NumUnits holds the number of units required.
	// For IAAS models, this will be 0 and separate AddUnitChanges will be used.
	// For Kubernetes models, this will be used to scale the application.
	NumUnits int `json:"num-units,omitempty"`
	// Options holds application options.
	Options map[string]interface{} `json:"options,omitempty"`
	// Constraints holds the optional application constraints.
	Constraints string `json:"constraints,omitempty"`
	// Storage holds the optional storage constraints.
	Storage map[string]string `json:"storage,omitempty"`
	// Devices holds the optional devices constraints.
	Devices map[string]string `json:"devices,omitempty"`
	// EndpointBindings holds the optional endpoint bindings
	EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"`
	// Resources identifies the revision to use for each resource
	// of the application's charm.
	Resources map[string]int `json:"resources,omitempty"`
	// LocalResources identifies the path to the local resource
	// of the application's charm.
	LocalResources map[string]string `json:"local-resources,omitempty"`
	// Channel holds the channel of the application to be deployed.
	Channel string `json:"channel,omitempty"`
	// contains filtered or unexported fields
}

AddApplicationParams holds parameters for deploying a Juju application.

type AddCharmChange

type AddCharmChange struct {

	// Params holds parameters for adding a charm.
	Params AddCharmParams
	// contains filtered or unexported fields
}

AddCharmChange holds a change for adding a charm to the environment.

func (*AddCharmChange) Args

func (ch *AddCharmChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*AddCharmChange) Description

func (ch *AddCharmChange) Description() []string

Description implements Change.

func (*AddCharmChange) GUIArgs

func (ch *AddCharmChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*AddCharmChange) Id

func (ch *AddCharmChange) Id() string

Id implements Change.Id.

func (*AddCharmChange) Method

func (ch *AddCharmChange) Method() string

Method implements Change.Method.

func (*AddCharmChange) Requires

func (ch *AddCharmChange) Requires() []string

Requires implements Change.Requires.

type AddCharmParams

type AddCharmParams struct {
	// Charm holds the URL of the charm to be added.
	Charm string `json:"charm"`
	// Series holds the series of the charm to be added
	// if the charm default is not sufficient.
	Series string `json:"series,omitempty"`
	// Channel holds the preferred channel for obtaining the charm.
	// Channel was added to 2.7 release, use omitempty so we're backwards
	// compatible with older clients.
	Channel string `json:"channel,omitempty"`
	// Architecture holds the preferred charm architecture to deploy the
	// application with.
	Architecture string `json:"architecture,omitempty"`
}

AddCharmParams holds parameters for adding a charm to the environment.

type AddMachineChange

type AddMachineChange struct {

	// Params holds parameters for adding a machine.
	Params AddMachineParams
	// contains filtered or unexported fields
}

AddMachineChange holds a change for adding a machine or container.

func (*AddMachineChange) Args

func (ch *AddMachineChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*AddMachineChange) Description

func (ch *AddMachineChange) Description() []string

Description implements Change.

func (*AddMachineChange) GUIArgs

func (ch *AddMachineChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*AddMachineChange) Id

func (ch *AddMachineChange) Id() string

Id implements Change.Id.

func (*AddMachineChange) Method

func (ch *AddMachineChange) Method() string

Method implements Change.Method.

func (*AddMachineChange) Requires

func (ch *AddMachineChange) Requires() []string

Requires implements Change.Requires.

type AddMachineOptions

type AddMachineOptions struct {
	// Series holds the machine OS series.
	Series string `json:"series,omitempty"`
	// Constraints holds the machine constraints.
	Constraints string `json:"constraints,omitempty"`
	// ContainerType holds the machine container type (like "lxc" or "kvm").
	ContainerType string `json:"containerType,omitempty"`
	// ParentId holds the id of the parent machine.
	ParentId string `json:"parentId,omitempty"`
}

AddMachineOptions holds GUI options for adding a machine or container.

type AddMachineParams

type AddMachineParams struct {
	// Series holds the optional machine OS series.
	Series string `json:"series,omitempty"`
	// Constraints holds the optional machine constraints.
	Constraints string `json:"constraints,omitempty"`
	// ContainerType optionally holds the type of the container (for instance
	// ""lxc" or kvm"). It is not specified for top level machines.
	ContainerType string `json:"container-type,omitempty"`
	// ParentId optionally holds a placeholder pointing to another machine
	// change or to a unit change. This value is only specified in the case
	// this machine is a container, in which case also ContainerType is set.
	ParentId string `json:"parent-id,omitempty"`
	// contains filtered or unexported fields
}

AddMachineParams holds parameters for adding a machine or container.

type AddRelationChange

type AddRelationChange struct {

	// Params holds parameters for adding a relation.
	Params AddRelationParams
	// contains filtered or unexported fields
}

AddRelationChange holds a change for adding a relation between two applications.

func (*AddRelationChange) Args

func (ch *AddRelationChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*AddRelationChange) Description

func (ch *AddRelationChange) Description() []string

Description implements Change.

func (*AddRelationChange) GUIArgs

func (ch *AddRelationChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*AddRelationChange) Id

func (ch *AddRelationChange) Id() string

Id implements Change.Id.

func (*AddRelationChange) Method

func (ch *AddRelationChange) Method() string

Method implements Change.Method.

func (*AddRelationChange) Requires

func (ch *AddRelationChange) Requires() []string

Requires implements Change.Requires.

type AddRelationParams

type AddRelationParams struct {
	// Endpoint1 and Endpoint2 hold relation endpoints in the
	// "application:interface" form, where the application is either a
	// placeholder pointing to an application change or in the case of a model
	// that already has this application deployed, the name of the
	// application, and the interface is optional. Examples are
	// "$deploy-42:web", "$deploy-42", "mysql:db".
	Endpoint1 string `json:"endpoint1"`
	Endpoint2 string `json:"endpoint2"`
	// contains filtered or unexported fields
}

AddRelationParams holds parameters for adding a relation between two applications.

type AddUnitChange

type AddUnitChange struct {

	// Params holds parameters for adding a unit.
	Params AddUnitParams
	// contains filtered or unexported fields
}

AddUnitChange holds a change for adding an application unit.

func (*AddUnitChange) Args

func (ch *AddUnitChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*AddUnitChange) Description

func (ch *AddUnitChange) Description() []string

Description implements Change.

func (*AddUnitChange) GUIArgs

func (ch *AddUnitChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*AddUnitChange) Id

func (ch *AddUnitChange) Id() string

Id implements Change.Id.

func (*AddUnitChange) Method

func (ch *AddUnitChange) Method() string

Method implements Change.Method.

func (*AddUnitChange) Requires

func (ch *AddUnitChange) Requires() []string

Requires implements Change.Requires.

type AddUnitParams

type AddUnitParams struct {
	// Application holds the application placeholder name for which a unit is added.
	Application string `json:"application"`
	// To holds the optional location where to add the unit, as a placeholder
	// pointing to another unit change or to a machine change.
	To string `json:"to,omitempty"`
	// contains filtered or unexported fields
}

AddUnitParams holds parameters for adding an application unit.

type Application

type Application struct {
	Name             string
	Charm            string // The charm URL.
	Scale            int
	Options          map[string]interface{}
	Annotations      map[string]string
	Constraints      string // TODO: not updated yet.
	Exposed          bool
	ExposedEndpoints map[string]ExposedEndpoint
	SubordinateTo    []string
	Series           string
	Channel          string
	Revision         int
	Placement        string
	Offers           []string

	Units []Unit
}

Application represents an existing charm deployed in the model.

type ApplicationDiff

type ApplicationDiff struct {
	Missing          DiffSide                       `yaml:"missing,omitempty"`
	Charm            *StringDiff                    `yaml:"charm,omitempty"`
	Series           *StringDiff                    `yaml:"series,omitempty"`
	Channel          *StringDiff                    `yaml:"channel,omitempty"`
	Placement        *StringDiff                    `yaml:"placement,omitempty"`
	NumUnits         *IntDiff                       `yaml:"num_units,omitempty"`
	Scale            *IntDiff                       `yaml:"scale,omitempty"`
	Expose           *BoolDiff                      `yaml:"expose,omitempty"`
	ExposedEndpoints map[string]ExposedEndpointDiff `yaml:"exposed_endpoints,omitempty"`
	Options          map[string]OptionDiff          `yaml:"options,omitempty"`
	Annotations      map[string]StringDiff          `yaml:"annotations,omitempty"`
	Constraints      *StringDiff                    `yaml:"constraints,omitempty"`
}

ApplicationDiff stores differences between an application in a bundle and a model.

func (*ApplicationDiff) Empty

func (d *ApplicationDiff) Empty() bool

Empty returns whether the compared bundle and model applications match.

type ArchConstraint

type ArchConstraint interface {
	// Arch returns the arch from the constraint or an error satisfying
	// errors.IsNotFound if the constraint does not include an arch component.
	Arch() (string, error)
}

ArchConstraint defines an architecture constraint. This is used to represent a parsed application architecture constraint.

type BoolDiff

type BoolDiff struct {
	Bundle bool `yaml:"bundle"`
	Model  bool `yaml:"model"`
}

BoolDiff stores different bundle and model values for some bool.

type BundleDiff

type BundleDiff struct {
	Applications map[string]*ApplicationDiff `yaml:"applications,omitempty"`
	Machines     map[string]*MachineDiff     `yaml:"machines,omitempty"`
	Relations    *RelationsDiff              `yaml:"relations,omitempty"`
}

BundleDiff stores differences between a bundle and a model.

func BuildDiff

func BuildDiff(config DiffConfig) (*BundleDiff, error)

BuildDiff returns a BundleDiff with the differences between the passed in bundle and model.

func (*BundleDiff) Empty

func (d *BundleDiff) Empty() bool

Empty returns whether the compared bundle and model match (at least in terms of the details we check).

type Change

type Change interface {
	// Id returns the unique identifier for this change.
	Id() string
	// Requires returns the ids of all the changes that must
	// be applied before this one.
	Requires() []string
	// Method returns the action to be performed to apply this change.
	Method() string
	// GUIArgs returns positional arguments to pass to the method, suitable for
	// being JSON-serialized and sent to the Juju GUI.
	GUIArgs() []interface{}
	// Description returns a human readable, potentially multi-line summary
	// of the change.
	Description() []string
	// Args returns a map of arguments that are named.
	Args() (map[string]interface{}, error)
	// contains filtered or unexported methods
}

Change holds a single change required to deploy a bundle.

func FromData

func FromData(config ChangesConfig) ([]Change, error)

FromData generates and returns the list of changes required to deploy the given bundle data. The changes are sorted by requirements, so that they can be applied in order. The bundle data is assumed to be already verified.

type ChangesConfig

type ChangesConfig struct {
	Bundle           *charm.BundleData
	Model            *Model
	Logger           Logger
	BundleURL        string
	ConstraintGetter ConstraintGetter
	CharmResolver    CharmResolver
	Force            bool
}

ChangesConfig is used to provide the required data for determining changes.

func (*ChangesConfig) Validate

func (c *ChangesConfig) Validate() error

Validate attempts to validate the changes config, before usage.

type CharmResolver

type CharmResolver func(charm string, series string, channel string, arch string) (string, int, error)

CharmResolver resolves the channel and revision of a charm from the list of parameters.

type ConstraintGetter

type ConstraintGetter func(string) ArchConstraint

ConstraintGetter represents a architecture constraint parser.

type ConsumeOfferChange

type ConsumeOfferChange struct {

	// Params holds the parameters for consuming an offer.
	Params ConsumeOfferParams
	// contains filtered or unexported fields
}

ConsumeOfferChange holds a change for consuming a offer.

func (*ConsumeOfferChange) Args

func (ch *ConsumeOfferChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*ConsumeOfferChange) Description

func (ch *ConsumeOfferChange) Description() []string

Description implements Change.

func (*ConsumeOfferChange) GUIArgs

func (ch *ConsumeOfferChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*ConsumeOfferChange) Id

func (ch *ConsumeOfferChange) Id() string

Id implements Change.Id.

func (*ConsumeOfferChange) Method

func (ch *ConsumeOfferChange) Method() string

Method implements Change.Method.

func (*ConsumeOfferChange) Requires

func (ch *ConsumeOfferChange) Requires() []string

Requires implements Change.Requires.

type ConsumeOfferParams

type ConsumeOfferParams struct {
	// URL contains the location of the offer
	URL string `json:"url"`
	// ApplicationName describes the application name on offer.
	ApplicationName string `json:"application-name,omitempty"`
}

ConsumeOfferParams holds the parameters for consuming an offer.

type CreateOfferChange

type CreateOfferChange struct {

	// Params holds parameters for creating an offer.
	Params CreateOfferParams
	// contains filtered or unexported fields
}

CreateOfferChange holds a change for creating a new application endpoint offer.

func (*CreateOfferChange) Args

func (ch *CreateOfferChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*CreateOfferChange) Description

func (ch *CreateOfferChange) Description() []string

Description implements Change.

func (*CreateOfferChange) GUIArgs

func (ch *CreateOfferChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*CreateOfferChange) Id

func (ch *CreateOfferChange) Id() string

Id implements Change.Id.

func (*CreateOfferChange) Method

func (ch *CreateOfferChange) Method() string

Method implements Change.Method.

func (*CreateOfferChange) Requires

func (ch *CreateOfferChange) Requires() []string

Requires implements Change.Requires.

type CreateOfferParams

type CreateOfferParams struct {
	// Application is the name of the application to create an offer for.
	Application string `json:"application"`
	// Endpoint is a list of application endpoint to expose as part of an offer.
	Endpoints []string `json:"endpoints"`
	// OfferName describes the offer name.
	OfferName string `json:"offer-name,omitempty"`
	// Update is set to true if an existing offer is to be updated.
	Update bool `json:"update,omitempty"`
}

CreateOfferParams holds parameters for creating an application offer.

type DiffConfig

type DiffConfig struct {
	Bundle *charm.BundleData
	Model  *Model

	IncludeAnnotations bool
	Logger             Logger
}

DiffConfig provides the values and configuration needed to diff the bundle and model.

func (DiffConfig) Validate

func (config DiffConfig) Validate() error

Validate returns whether this is a valid configuration for diffing.

type DiffSide

type DiffSide string

DiffSide represents one side of a bundle-model diff.

const (
	// None represents neither the bundle or model side (used when neither is missing).
	None DiffSide = ""

	// BundleSide represents the bundle side of a diff.
	BundleSide DiffSide = "bundle"

	// ModelSide represents the model side of a diff.
	ModelSide DiffSide = "model"
)

type EntityType

type EntityType string

EntityType holds entity types ("application" or "machine").

const (
	ApplicationType EntityType = "application"
	MachineType     EntityType = "machine"
)

type ExposeChange

type ExposeChange struct {

	// Params holds parameters for exposing an application.
	Params ExposeParams
	// contains filtered or unexported fields
}

ExposeChange holds a change for exposing an application.

func (*ExposeChange) Args

func (ch *ExposeChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*ExposeChange) Description

func (ch *ExposeChange) Description() []string

Description implements Change.

func (*ExposeChange) GUIArgs

func (ch *ExposeChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*ExposeChange) Id

func (ch *ExposeChange) Id() string

Id implements Change.Id.

func (*ExposeChange) Method

func (ch *ExposeChange) Method() string

Method implements Change.Method.

func (*ExposeChange) Requires

func (ch *ExposeChange) Requires() []string

Requires implements Change.Requires.

type ExposeParams

type ExposeParams struct {
	// Application holds the placeholder name of the application that must be exposed.
	Application string `json:"application"`

	// ExposedEndpoints stores a subset of the application endpoints that
	// are used to select the set of open ports that should be accessible
	// if the application is exposed. An empty value indicates that all
	// open ports should be made accessible.
	ExposedEndpoints map[string]*ExposedEndpointParams `json:"exposed-endpoints,omitempty"`
	// contains filtered or unexported fields
}

ExposeParams holds parameters for exposing an application.

type ExposedEndpoint

type ExposedEndpoint struct {
	ExposeToSpaces []string
	ExposeToCIDRs  []string
}

ExposedEndpoint encapsulates the expose-related parameters for a particular endpoint.

type ExposedEndpointDiff

type ExposedEndpointDiff struct {
	Bundle *ExposedEndpointDiffEntry `yaml:"bundle"`
	Model  *ExposedEndpointDiffEntry `yaml:"model"`
}

ExposedEndpointDiff stores different bundle and model values for the expose settings for a particular endpoint. Nil values indicate that the value was not present in the bundle or model.

type ExposedEndpointDiffEntry

type ExposedEndpointDiffEntry struct {
	ExposeToSpaces []string `yaml:"expose_to_spaces,omitempty"`
	ExposeToCIDRs  []string `yaml:"expose_to_cidrs,omitempty"`
}

ExposedEndpointDiffEntry stores the exposed endpoint parameters for an ExposedEndpointDiff entry.

type ExposedEndpointParams

type ExposedEndpointParams struct {
	// ExposeToSpaces contains a list of spaces that should be able to
	// access the application ports if the application is exposed.
	ExposeToSpaces []string `json:"expose-to-spaces,omitempty"`

	// ExposeToCIDRs contains a list of CIDRs that should be able to
	// access the application ports if the application is exposed.
	ExposeToCIDRs []string `json:"expose-to-cidrs,omitempty"`
}

ExposedEndpointParams encapsulates the expose-related parameters for a particular endpoint.

type GrantOfferAccessChange

type GrantOfferAccessChange struct {

	// Params holds the parameters for the grant.
	Params GrantOfferAccessParams
	// contains filtered or unexported fields
}

GrantOfferAccessChange holds a change for granting a user access to an offer.

func (*GrantOfferAccessChange) Args

func (ch *GrantOfferAccessChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*GrantOfferAccessChange) Description

func (ch *GrantOfferAccessChange) Description() []string

Description implements Change.

func (*GrantOfferAccessChange) GUIArgs

func (ch *GrantOfferAccessChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*GrantOfferAccessChange) Id

func (ch *GrantOfferAccessChange) Id() string

Id implements Change.Id.

func (*GrantOfferAccessChange) Method

func (ch *GrantOfferAccessChange) Method() string

Method implements Change.Method.

func (*GrantOfferAccessChange) Requires

func (ch *GrantOfferAccessChange) Requires() []string

Requires implements Change.Requires.

type GrantOfferAccessParams

type GrantOfferAccessParams struct {
	// User holds the user name to grant access to.
	User string `json:"user"`
	// The type of access to grant.
	Access string `json:"access"`
	// The offer name to be granted access to.
	Offer string `json:"offer"`
}

GrantOfferAccessParams holds the parameters for granting access to a user.

type InconsistentMachineMapError

type InconsistentMachineMapError struct {
	BundleMachine     string
	PossibleTargetIDs []string
	Applications      []string
}

InconsistentMachineMapError indicates that there is a mismatch between the bundle machines and the machine map which should be resolved with explicit entries.

func (*InconsistentMachineMapError) Error

func (err *InconsistentMachineMapError) Error() string

type IntDiff

type IntDiff struct {
	Bundle int `yaml:"bundle"`
	Model  int `yaml:"model"`
}

IntDiff stores different bundle and model values for some int.

type Logger

type Logger interface {
	Tracef(string, ...interface{})
}

Logger defines the logging methods needed

type Machine

type Machine struct {
	ID          string
	Series      string
	Annotations map[string]string
}

Machine represents an existing machine in the model.

type MachineDiff

type MachineDiff struct {
	Missing     DiffSide              `yaml:"missing,omitempty"`
	Annotations map[string]StringDiff `yaml:"annotations,omitempty"`
	Series      *StringDiff           `yaml:"series,omitempty"`
}

MachineDiff stores differences between a machine in a bundle and a model.

func (*MachineDiff) Empty

func (d *MachineDiff) Empty() bool

Empty returns whether the compared bundle and model machines match.

type Model

type Model struct {
	Applications map[string]*Application
	Machines     map[string]*Machine
	Relations    []Relation

	// ConstraintsEqual is a function that is able to determine if two
	// string values defining constraints are equal. This is to avoid a
	// hard dependency on the juju constraints package.
	ConstraintsEqual func(string, string) bool

	// ConstraintsGetter is a function that is able to extract a constraint
	// for inspection.
	ConstraintGetter ConstraintGetter

	// Sequence holds a map of names to the next "number" that relates
	// to the unit or machine. The keys are "application-<name>", the string
	// "machine", or "machine-id/c" where n is a machine id, and c is a
	// container type.
	Sequence map[string]int

	// This is a mapping of existing machines to machines in the bundle.
	MachineMap map[string]string
	// contains filtered or unexported fields
}

Model represents the existing deployment if any.

func (*Model) BundleMachine

func (m *Model) BundleMachine(id string) *Machine

BundleMachine will return a the existing machine for the specified bundle machine ID. If there is not a mapping available, nil is returned.

func (*Model) GetApplication

func (m *Model) GetApplication(name string) *Application

GetApplication returns the application specified or nil if it doesn't have it.

func (*Model) HasRelation

func (m *Model) HasRelation(app1, endpoint1, app2, endpoint2 string) bool

HasRelation checks to see if the model has a relation between two applications.

func (*Model) InferMachineMap

func (m *Model) InferMachineMap(data *charm.BundleData)

InferMachineMap looks at all the machines defined in the bundle and infers their mapping to the existing machine. This method assumes that the units of an application are sorted in the natural sort order, meaning we start at unit zero and work our way up the unit numbers.

type OptionDiff

type OptionDiff struct {
	Bundle interface{} `yaml:"bundle"`
	Model  interface{} `yaml:"model"`
}

OptionDiff stores different bundle and model values for some configuration value.

type Relation

type Relation struct {
	App1      string
	Endpoint1 string
	App2      string
	Endpoint2 string
}

Relation holds the information between two releations.

type RelationsDiff

type RelationsDiff struct {
	BundleAdditions [][]string `yaml:"bundle-additions,omitempty"`
	ModelAdditions  [][]string `yaml:"model-additions,omitempty"`
}

RelationsDiff stores differences between relations in a bundle and model.

type ScaleChange

type ScaleChange struct {

	// Params holds parameters for scaling an application.
	Params ScaleParams
	// contains filtered or unexported fields
}

ScaleChange holds a change for scaling an application.

func (*ScaleChange) Args

func (ch *ScaleChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*ScaleChange) Description

func (ch *ScaleChange) Description() []string

Description implements Change.

func (*ScaleChange) GUIArgs

func (ch *ScaleChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*ScaleChange) Id

func (ch *ScaleChange) Id() string

Id implements Change.Id.

func (*ScaleChange) Method

func (ch *ScaleChange) Method() string

Method implements Change.Method.

func (*ScaleChange) Requires

func (ch *ScaleChange) Requires() []string

Requires implements Change.Requires.

type ScaleParams

type ScaleParams struct {
	// Application holds the placeholder name of the application to be scaled.
	Application string `json:"application"`

	// Scale is the new scale value to use.
	Scale int `json:"scale"`
	// contains filtered or unexported fields
}

ScaleParams holds parameters for scaling an application.

type SetAnnotationsChange

type SetAnnotationsChange struct {

	// Params holds parameters for setting annotations.
	Params SetAnnotationsParams
	// contains filtered or unexported fields
}

SetAnnotationsChange holds a change for setting application and machine annotations.

func (*SetAnnotationsChange) Args

func (ch *SetAnnotationsChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*SetAnnotationsChange) Description

func (ch *SetAnnotationsChange) Description() []string

Description implements Change.

func (*SetAnnotationsChange) GUIArgs

func (ch *SetAnnotationsChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*SetAnnotationsChange) Id

func (ch *SetAnnotationsChange) Id() string

Id implements Change.Id.

func (*SetAnnotationsChange) Method

func (ch *SetAnnotationsChange) Method() string

Method implements Change.Method.

func (*SetAnnotationsChange) Requires

func (ch *SetAnnotationsChange) Requires() []string

Requires implements Change.Requires.

type SetAnnotationsParams

type SetAnnotationsParams struct {
	// Id is the placeholder for the application or machine change corresponding to
	// the entity to be annotated.
	Id string `json:"id"`
	// EntityType holds the type of the entity, "application" or "machine".
	EntityType EntityType `json:"entity-type"`
	// Annotations holds the annotations as key/value pairs.
	Annotations map[string]string `json:"annotations"`
	// contains filtered or unexported fields
}

SetAnnotationsParams holds parameters for setting annotations.

type SetConstraintsChange

type SetConstraintsChange struct {

	// Params holds parameters for setting constraints.
	Params SetConstraintsParams
	// contains filtered or unexported fields
}

SetConstraintsChange holds a change for setting application constraints.

func (*SetConstraintsChange) Args

func (ch *SetConstraintsChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*SetConstraintsChange) Description

func (ch *SetConstraintsChange) Description() []string

Description implements Change.

func (*SetConstraintsChange) GUIArgs

func (ch *SetConstraintsChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*SetConstraintsChange) Id

func (ch *SetConstraintsChange) Id() string

Id implements Change.Id.

func (*SetConstraintsChange) Method

func (ch *SetConstraintsChange) Method() string

Method implements Change.Method.

func (*SetConstraintsChange) Requires

func (ch *SetConstraintsChange) Requires() []string

Requires implements Change.Requires.

type SetConstraintsParams

type SetConstraintsParams struct {
	// Application is the name of the application.
	Application string `json:"application"`
	// Constraints holds the new constraints.
	Constraints string `json:"constraints,omitempty"`
}

SetConstraintsParams holds parameters for setting constraints.

type SetOptionsChange

type SetOptionsChange struct {

	// Params holds parameters for setting options.
	Params SetOptionsParams
	// contains filtered or unexported fields
}

SetOptionsChange holds a change for setting application options.

func (*SetOptionsChange) Args

func (ch *SetOptionsChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*SetOptionsChange) Description

func (ch *SetOptionsChange) Description() []string

Description implements Change.

func (*SetOptionsChange) GUIArgs

func (ch *SetOptionsChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*SetOptionsChange) Id

func (ch *SetOptionsChange) Id() string

Id implements Change.Id.

func (*SetOptionsChange) Method

func (ch *SetOptionsChange) Method() string

Method implements Change.Method.

func (*SetOptionsChange) Requires

func (ch *SetOptionsChange) Requires() []string

Requires implements Change.Requires.

type SetOptionsParams

type SetOptionsParams struct {
	// Application is the name of the application.
	Application string `json:"application"`
	// Options holds the changed options for the application.
	Options map[string]interface{} `json:"options,omitempty"`
}

SetOptionsParams holds parameters for setting options.

type StringDiff

type StringDiff struct {
	Bundle string `yaml:"bundle"`
	Model  string `yaml:"model"`
}

StringDiff stores different bundle and model values for some string.

type Unit

type Unit struct {
	Name    string
	Machine string
}

Unit represents a unit in the model.

type UpgradeCharmChange

type UpgradeCharmChange struct {

	// Params holds parameters for upgrading the charm for an application.
	Params UpgradeCharmParams
	// contains filtered or unexported fields
}

UpgradeCharmChange holds a change for adding a charm to the environment.

func (*UpgradeCharmChange) Args

func (ch *UpgradeCharmChange) Args() (map[string]interface{}, error)

Args implements Change.Args.

func (*UpgradeCharmChange) Description

func (ch *UpgradeCharmChange) Description() []string

Description implements Change.

func (*UpgradeCharmChange) GUIArgs

func (ch *UpgradeCharmChange) GUIArgs() []interface{}

GUIArgs implements Change.GUIArgs.

func (*UpgradeCharmChange) Id

func (ch *UpgradeCharmChange) Id() string

Id implements Change.Id.

func (*UpgradeCharmChange) Method

func (ch *UpgradeCharmChange) Method() string

Method implements Change.Method.

func (*UpgradeCharmChange) Requires

func (ch *UpgradeCharmChange) Requires() []string

Requires implements Change.Requires.

type UpgradeCharmParams

type UpgradeCharmParams struct {
	// Charm holds the placeholder or URL of the charm to be added.
	Charm string `json:"charm"`
	// Application refers to the application that is being upgraded.
	Application string `json:"application"`
	// Series holds the series of the charm to be added
	// if the charm default is not sufficient.
	Series string `json:"series"`
	// Resources identifies the revision to use for each resource
	// of the application's charm.
	Resources map[string]int `json:"resources,omitempty"`
	// LocalResources identifies the path to the local resource
	// of the application's charm.
	LocalResources map[string]string `json:"local-resources,omitempty"`
	// Channel holds the preferred channel for obtaining the charm.
	Channel string `json:"channel,omitempty"`
	// contains filtered or unexported fields
}

UpgradeCharmParams holds parameters for adding a charm to the environment.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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