juju: github.com/juju/juju/api/application Index | Files

package application

import "github.com/juju/juju/api/application"

Package application provides access to the application api facade. This facade contains api calls that are specific to applications. As a rule of thumb, if the argument for an api requires an application name and affects only that application then the call belongs here.

Index

Package Files

client.go

type AddUnitsParams Uses

type AddUnitsParams struct {
    // ApplicationName is the name of the application to which units
    // will be added.
    ApplicationName string

    // NumUnits is the number of units to deploy.
    NumUnits int

    // Placement directives on where the machines for the unit must be
    // created.
    Placement []*instance.Placement

    // Policy represents how a machine for the unit is determined.
    // This value is ignored on any Juju server before 2.4.
    Policy string

    // AttachStorage contains IDs of existing storage that should be
    // attached to the application unit that will be deployed. This
    // may be non-empty only if NumUnits is 1.
    AttachStorage []string
}

AddUnitsParams contains parameters for the AddUnits API method.

type Client Uses

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

Client allows access to the application API end point.

func NewClient Uses

func NewClient(st base.APICallCloser) *Client

NewClient creates a new client for accessing the application api.

func (*Client) AddRelation Uses

func (c *Client) AddRelation(endpoints, viaCIDRs []string) (*params.AddRelationResults, error)

AddRelation adds a relation between the specified endpoints and returns the relation info.

func (*Client) AddUnits Uses

func (c *Client) AddUnits(args AddUnitsParams) ([]string, error)

AddUnits adds a given number of units to an application using the specified placement directives to assign units to machines.

func (*Client) ApplicationsInfo Uses

func (c *Client) ApplicationsInfo(applications []names.ApplicationTag) ([]params.ApplicationInfoResult, error)

ApplicationsInfo retrieves applications information.

func (*Client) CharmRelations Uses

func (c *Client) CharmRelations(application string) ([]string, error)

CharmRelations returns the application's charms relation names.

func (*Client) Consume Uses

func (c *Client) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error)

Consume adds a remote application to the model.

func (*Client) Deploy Uses

func (c *Client) Deploy(args DeployArgs) error

Deploy obtains the charm, either locally or from the charm store, and deploys it. Placement directives, if provided, specify the machine on which the charm is deployed.

func (*Client) DestroyApplications Uses

func (c *Client) DestroyApplications(in DestroyApplicationsParams) ([]params.DestroyApplicationResult, error)

DestroyApplications destroys the given applications.

func (*Client) DestroyConsumedApplication Uses

func (c *Client) DestroyConsumedApplication(in DestroyConsumedApplicationParams) ([]params.ErrorResult, error)

DestroyConsumedApplication destroys the given consumed (remote) applications.

func (*Client) DestroyDeprecated Uses

func (c *Client) DestroyDeprecated(application string) error

DestroyDeprecated destroys a given application.

NOTE(axw) this exists only for backwards compatibility, for API facade versions 1-3; clients should prefer its successor, DestroyApplications, below.

TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.

func (*Client) DestroyRelation Uses

func (c *Client) DestroyRelation(force *bool, maxWait *time.Duration, endpoints ...string) error

DestroyRelation removes the relation between the specified endpoints.

func (*Client) DestroyRelationId Uses

func (c *Client) DestroyRelationId(relationId int, force *bool, maxWait *time.Duration) error

DestroyRelationId removes the relation with the specified id.

func (*Client) DestroyUnits Uses

func (c *Client) DestroyUnits(in DestroyUnitsParams) ([]params.DestroyUnitResult, error)

DestroyUnits decreases the number of units dedicated to one or more applications.

func (*Client) DestroyUnitsDeprecated Uses

func (c *Client) DestroyUnitsDeprecated(unitNames ...string) error

DestroyUnitsDeprecated decreases the number of units dedicated to an application.

NOTE(axw) this exists only for backwards compatibility, for API facade versions 1-3; clients should prefer its successor, DestroyUnits, below.

TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.

func (*Client) Expose Uses

func (c *Client) Expose(application string) error

Expose changes the juju-managed firewall to expose any ports that were also explicitly marked by units as open.

func (*Client) Get Uses

func (c *Client) Get(branchName, application string) (*params.ApplicationGetResults, error)

Get returns the configuration for the named application.

func (*Client) GetCharmURL Uses

func (c *Client) GetCharmURL(branchName, applicationName string) (*charm.URL, error)

GetCharmURL returns the charm URL the given application is running at present.

func (*Client) GetConfig Uses

func (c *Client) GetConfig(branchName string, appNames ...string) ([]map[string]interface{}, error)

GetConfig returns the charm configuration settings for each of the applications. If any of the applications are not found, an error is returned.

func (*Client) GetConstraints Uses

func (c *Client) GetConstraints(applications ...string) ([]constraints.Value, error)

GetConstraints returns the constraints for the given applications.

func (*Client) ModelUUID Uses

func (c *Client) ModelUUID() string

ModelUUID returns the model UUID from the client connection.

func (*Client) ResolveUnitErrors Uses

func (c *Client) ResolveUnitErrors(units []string, all, retry bool) error

ResolveUnitErrors clears errors on one or more units. Either specify one or more units, or all.

func (*Client) ScaleApplication Uses

func (c *Client) ScaleApplication(in ScaleApplicationParams) (params.ScaleApplicationResult, error)

ScaleApplication sets the desired unit count for one or more applications.

func (*Client) Set Uses

func (c *Client) Set(application string, options map[string]string) error

Set sets configuration options on an application.

func (*Client) SetApplicationConfig Uses

func (c *Client) SetApplicationConfig(branchName, application string, config map[string]string) error

SetApplicationConfig sets configuration options on an application.

func (*Client) SetCharm Uses

func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error

SetCharm sets the charm for a given application.

func (*Client) SetConstraints Uses

func (c *Client) SetConstraints(application string, constraints constraints.Value) error

SetConstraints specifies the constraints for the given application.

func (*Client) SetMetricCredentials Uses

func (c *Client) SetMetricCredentials(application string, credentials []byte) error

SetMetricCredentials sets the metric credentials for the application specified.

func (*Client) SetRelationSuspended Uses

func (c *Client) SetRelationSuspended(relationIds []int, suspended bool, message string) error

SetRelationSuspended updates the suspended status of the relation with the specified id.

func (*Client) Unexpose Uses

func (c *Client) Unexpose(application string) error

Unexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open.

func (*Client) Unset Uses

func (c *Client) Unset(application string, options []string) error

Unset resets configuration options on an application.

func (*Client) UnsetApplicationConfig Uses

func (c *Client) UnsetApplicationConfig(branchName, application string, options []string) error

UnsetApplicationConfig resets configuration options on an application.

func (*Client) Update Uses

func (c *Client) Update(args params.ApplicationUpdate) error

Update updates the application attributes, including charm URL, minimum number of units, settings and constraints.

func (*Client) UpdateApplicationSeries Uses

func (c *Client) UpdateApplicationSeries(appName, series string, force bool) error

UpdateApplicationSeries updates the application series in the db.

type DeployArgs Uses

type DeployArgs struct {
    // CharmID identifies the charm to deploy.
    CharmID charmstore.CharmID

    // ApplicationName is the name to give the application.
    ApplicationName string

    // Series to be used for the machine.
    Series string

    // NumUnits is the number of units to deploy.
    NumUnits int

    // ConfigYAML is a string that overrides the default config.yml.
    ConfigYAML string

    // Config are values that override those in the default config.yaml
    // or configure the application itself.
    Config map[string]string

    // Cons contains constraints on where units of this application
    // may be placed.
    Cons constraints.Value

    // Placement directives on where the machines for the unit must be
    // created.
    Placement []*instance.Placement

    // Storage contains Constraints specifying how storage should be
    // handled.
    Storage map[string]storage.Constraints

    // Devices contains Constraints specifying how devices should be
    // handled.
    Devices map[string]devices.Constraints

    // AttachStorage contains IDs of existing storage that should be
    // attached to the application unit that will be deployed. This
    // may be non-empty only if NumUnits is 1.
    AttachStorage []string

    // EndpointBindings
    EndpointBindings map[string]string

    // Collection of resource names for the application, with the
    // value being the unique ID of a pre-uploaded resources in
    // storage.
    Resources map[string]string
}

DeployArgs holds the arguments to be sent to Client.ApplicationDeploy.

type DestroyApplicationsParams Uses

type DestroyApplicationsParams struct {
    // Applications holds the names of applications to destroy.
    Applications []string

    // DestroyStorage controls whether or not storage attached
    // to units of the applications will be destroyed.
    DestroyStorage bool

    // Force controls whether or not the removal of applications
    // will be forced, i.e. ignore removal errors.
    Force bool

    // MaxWait specifies the amount of time that each step in application removal
    // will wait before forcing the next step to kick-off. This parameter
    // only makes sense in combination with 'force' set to 'true'.
    MaxWait *time.Duration
}

DestroyApplicationsParams contains parameters for the DestroyApplications API method.

type DestroyConsumedApplicationParams Uses

type DestroyConsumedApplicationParams struct {
    // SaasNames holds the names of the consumed applications
    // that are being destroyed
    SaasNames []string

    // Force controls whether or not the removal of applications
    // will be forced, i.e. ignore removal errors.
    Force bool

    // MaxWait specifies the amount of time that each step in application removal
    // will wait before forcing the next step to kick-off. This parameter
    // only makes sense in combination with 'force' set to 'true'.
    MaxWait *time.Duration
}

type DestroyUnitsParams Uses

type DestroyUnitsParams struct {
    // Units holds the IDs of units to destroy.
    Units []string

    // DestroyStorage controls whether or not storage attached
    // to the units will be destroyed.
    DestroyStorage bool

    // Force controls whether or not the removal of applications
    // will be forced, i.e. ignore removal errors.
    Force bool

    // MaxWait specifies the amount of time that each step in unit removal
    // will wait before forcing the next step to kick-off. This parameter
    // only makes sense in combination with 'force' set to 'true'.
    MaxWait *time.Duration
}

DestroyUnitsParams contains parameters for the DestroyUnits API method.

type ScaleApplicationParams Uses

type ScaleApplicationParams struct {
    // ApplicationName is the application to scale.
    ApplicationName string

    // Scale is the target number of units which should should be running.
    Scale int

    // ScaleChange is the amount of change to the target number of existing units.
    ScaleChange int

    // Force controls whether or not the removal of applications
    // will be forced, i.e. ignore removal errors.
    Force bool
}

ScaleApplicationParams contains parameters for the ScaleApplication API method.

type SetCharmConfig Uses

type SetCharmConfig struct {
    // ApplicationName is the name of the application to set the charm on.
    ApplicationName string

    // CharmID identifies the charm.
    CharmID charmstore.CharmID

    // ConfigSettings is the charm settings to set during the upgrade.
    // This field is only understood by Application facade version 2
    // and greater.
    ConfigSettings map[string]string `json:"config-settings,omitempty"`

    // ConfigSettingsYAML is the charm settings in YAML format to set
    // during the upgrade. If this is non-empty, it will take precedence
    // over ConfigSettings. This field is only understood by Application
    // facade version 2
    ConfigSettingsYAML string `json:"config-settings-yaml,omitempty"`

    // Force forces the use of the charm in the following scenarios:
    // overriding a lxd profile upgrade.
    // In the future, we should deprecate ForceSeries and ForceUnits and just
    // use Force for all instances.
    // TODO (stickupkid): deprecate ForceSeries and ForceUnits in favour of
    // just using Force.
    Force bool

    // ForceSeries forces the use of the charm even if it doesn't match the
    // series of the unit.
    ForceSeries bool

    // ForceUnits forces the upgrade on units in an error state.
    ForceUnits bool

    // ResourceIDs is a map of resource names to resource IDs to activate during
    // the upgrade.
    ResourceIDs map[string]string

    // StorageConstraints is a map of storage names to storage constraints to
    // update during the upgrade. This field is only understood by Application
    // facade version 2 and greater.
    StorageConstraints map[string]storage.Constraints `json:"storage-constraints,omitempty"`

    // EndpointBindings is a map of operator-defined endpoint names to
    // space names to be merged with any existing endpoint bindings.
    EndpointBindings map[string]string
}

SetCharmConfig holds the configuration for setting a new revision of a charm on a application.

Package application imports 14 packages (graph) and is imported by 65 packages. Updated 2019-10-09. Refresh now. Tools for package owners.