Documentation

Overview

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

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Client

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

      Client allows access to the service API end point.

      func NewClient

      func NewClient(st api.Connection) *Client

        NewClient creates a new client for accessing the service api.

        func (*Client) AddRelation

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

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

          func (*Client) AddUnits

          func (c *Client) AddUnits(service string, numUnits int, placement []*instance.Placement) ([]string, error)

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

            func (*Client) CharmRelations

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

              CharmRelations returns the service's charms relation names.

              func (*Client) Deploy

              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) Destroy

                func (c *Client) Destroy(service string) error

                  Destroy destroys a given service.

                  func (*Client) DestroyRelation

                  func (c *Client) DestroyRelation(endpoints ...string) error

                    DestroyRelation removes the relation between the specified endpoints.

                    func (*Client) DestroyUnits

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

                      DestroyUnits decreases the number of units dedicated to a service.

                      func (*Client) Expose

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

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

                        func (*Client) Get

                        func (c *Client) Get(service string) (*params.ServiceGetResults, error)

                          Get returns the configuration for the named service.

                          func (*Client) GetCharmURL

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

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

                            func (*Client) GetConstraints

                            func (c *Client) GetConstraints(service string) (constraints.Value, error)

                              GetConstraints returns the constraints for the given service.

                              func (*Client) ModelUUID

                              func (c *Client) ModelUUID() string

                                ModelUUID returns the model UUID from the client connection.

                                func (*Client) Set

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

                                  Set sets configuration options on a service.

                                  func (*Client) SetCharm

                                  func (c *Client) SetCharm(cfg SetCharmConfig) error

                                    SetCharm sets the charm for a given service.

                                    func (*Client) SetConstraints

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

                                      SetConstraints specifies the constraints for the given service.

                                      func (*Client) SetMetricCredentials

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

                                        SetMetricCredentials sets the metric credentials for the service specified.

                                        func (*Client) Unexpose

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

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

                                          func (*Client) Unset

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

                                            Unset resets configuration options on a service.

                                            func (*Client) Update

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

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

                                              type DeployArgs

                                              type DeployArgs struct {
                                              	// CharmID identifies the charm to deploy.
                                              	CharmID charmstore.CharmID
                                              	// ServiceName is the name to give the service.
                                              	ServiceName 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
                                              	// Cons contains constraints on where units of this service 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
                                              	// EndpointBindings
                                              	EndpointBindings map[string]string
                                              	// Collection of resource names for the service, 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.ServiceDeploy.

                                                type SetCharmConfig

                                                type SetCharmConfig struct {
                                                	// ServiceName is the name of the service to set the charm on.
                                                	ServiceName string
                                                	// CharmID identifies the charm.
                                                	CharmID charmstore.CharmID
                                                	// 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
                                                }

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

                                                  Source Files