service

package
v0.0.0-...-2608902 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package service contains api calls for functionality related to deploying and managing services and their related charms.

Index

Constants

This section is empty.

Variables

View Source
var NewCharmStoreRepo = newCharmStoreFromClient

TODO - we really want to avoid this, which we can do by refactoring code requiring this to use interfaces. NewCharmStoreRepo instantiates a new charm store repository. It is exported for testing purposes.

Functions

func AddCharmWithAuthorization

func AddCharmWithAuthorization(st *state.State, args params.AddCharmWithAuthorization) error

AddCharmWithAuthorization adds the given charm URL (which must include revision) to the environment, if it does not exist yet. Local charms are not supported, only charm store URLs. See also AddLocalCharm().

The authorization macaroon, args.CharmStoreMacaroon, may be omitted, in which case this call is equivalent to AddCharm.

func ResolveCharms

func ResolveCharms(st *state.State, args params.ResolveCharms) (params.ResolveCharmResults, error)

ResolveCharm resolves the best available charm URLs with series, for charm locations without a series specified.

func ServiceSetSettingsStrings

func ServiceSetSettingsStrings(service *state.Service, settings map[string]string) error

ServiceSetSettingsStrings updates the settings for the given service, taking the configuration from a map of strings.

func StoreCharmArchive

func StoreCharmArchive(st *state.State, archive CharmArchive) error

StoreCharmArchive stores a charm archive in environment storage.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API implements the service interface and is the concrete implementation of the api end point.

func NewAPI

func NewAPI(
	st *state.State,
	resources *common.Resources,
	authorizer common.Authorizer,
) (*API, error)

NewAPI returns a new service API facade.

func (*API) AddRelation

func (api *API) AddRelation(args params.AddRelation) (params.AddRelationResults, error)

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

func (*API) AddUnits

AddUnits adds a given number of units to a service.

func (*API) CharmRelations

CharmRelations implements the server side of Service.CharmRelations.

func (*API) Deploy

func (api *API) Deploy(args params.ServicesDeploy) (params.ErrorResults, error)

Deploy fetches the charms from the charm store and deploys them using the specified placement directives.

func (*API) Destroy

func (api *API) Destroy(args params.ServiceDestroy) error

Destroy destroys a given service.

func (*API) DestroyRelation

func (api *API) DestroyRelation(args params.DestroyRelation) error

DestroyRelation removes the relation between the specified endpoints.

func (*API) DestroyUnits

func (api *API) DestroyUnits(args params.DestroyServiceUnits) error

DestroyUnits removes a given set of service units.

func (*API) Expose

func (api *API) Expose(args params.ServiceExpose) error

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

func (*API) Get

func (api *API) Get(args params.ServiceGet) (params.ServiceGetResults, error)

Get returns the configuration for a service.

func (*API) GetCharmURL

func (api *API) GetCharmURL(args params.ServiceGet) (params.StringResult, error)

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

func (*API) GetConstraints

func (api *API) GetConstraints(args params.GetServiceConstraints) (params.GetConstraintsResults, error)

GetConstraints returns the constraints for a given service.

func (*API) Set

func (api *API) Set(p params.ServiceSet) error

Set implements the server side of Service.Set. It does not unset values that are set to an empty string. Unset should be used for that.

func (*API) SetCharm

func (api *API) SetCharm(args params.ServiceSetCharm) error

SetCharm sets the charm for a given service.

func (*API) SetConstraints

func (api *API) SetConstraints(args params.SetConstraints) error

SetConstraints sets the constraints for a given service.

func (*API) SetMetricCredentials

func (api *API) SetMetricCredentials(args params.ServiceMetricCredentials) (params.ErrorResults, error)

SetMetricCredentials sets credentials on the service.

func (*API) Unexpose

func (api *API) Unexpose(args params.ServiceUnexpose) error

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

func (*API) Unset

func (api *API) Unset(p params.ServiceUnset) error

Unset implements the server side of Client.Unset.

func (*API) Update

func (api *API) Update(args params.ServiceUpdate) error

Update updates the service attributes, including charm URL, minimum number of units, settings and constraints. All parameters in params.ServiceUpdate except the service name are optional.

type CharmArchive

type CharmArchive struct {
	// ID is the charm URL for which we're storing the archive.
	ID *charm.URL

	// Charm is the metadata about the charm for the archive.
	Charm charm.Charm

	// Data contains the bytes of the archive.
	Data io.Reader

	// Size is the number of bytes in Data.
	Size int64

	// SHA256 is the hash of the bytes in Data.
	SHA256 string

	// Macaroon is the authorization macaroon for accessing the charmstore.
	Macaroon macaroon.Slice
}

CharmArchive is the data that needs to be stored for a charm archive in state.

type Service

type Service interface {
	SetMetricCredentials(args params.ServiceMetricCredentials) (params.ErrorResults, error)
}

Service defines the methods on the service API end point.

Jump to

Keyboard shortcuts

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