client

package
v0.0.0-...-f19ae85 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2015 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CharmStore charm.Repository = charm.Store
View Source
var InvalidFormatErr = errors.Errorf("the given filter did not match any known patterns.")

Functions

func MachineConfig

func MachineConfig(st *state.State, machineId, nonce, dataDir string) (*cloudinit.MachineConfig, error)

MachineConfig returns information from the environment config that is needed for machine cloud-init (for non-state servers only). It is exposed for testing purposes. TODO(rog) fix environs/manual tests so they do not need to call this, or move this elsewhere.

func NewUnitMatcher

func NewUnitMatcher(patterns []string) (unitMatcher, error)

NewUnitMatcher returns a unitMatcher that matches units with one of the specified patterns, or all units if no patterns are specified.

An error will be returned if any of the specified patterns is invalid. Patterns are valid if they contain only alpha-numeric characters, hyphens, or asterisks (and one optional '/' to separate service/unit).

func ParallelExecute

func ParallelExecute(dataDir string, runParams []*RemoteExec) params.RunResults

ParallelExecute executes all of the requests defined in the params, using the system identity stored in the dataDir.

func StoreCharmArchive

func StoreCharmArchive(st *state.State, curl *charm.URL, ch charm.Charm, r io.Reader, size int64, sha256 string) error

StoreCharmArchive stores a charm archive in environment storage.

func UnitChainPredicateFn

func UnitChainPredicateFn(
	predicate Predicate,
	getUnit func(string) *state.Unit,
) func(*state.Unit) (bool, error)

UnitChainPredicateFn builds a function which runs the given predicate over a unit and all of its subordinates. If one unit in the chain matches, the entire chain matches.

Types

type API

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

type Client

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

Client serves client-specific API methods.

func NewClient

func NewClient(st *state.State, resources *common.Resources, authorizer common.Authorizer) (*Client, error)

NewClient creates a new instance of the Client Facade.

func (*Client) APIHostPorts

func (c *Client) APIHostPorts() (result params.APIHostPortsResult, err error)

APIHostPorts returns the API host/port addresses stored in state.

func (*Client) AbortCurrentUpgrade

func (c *Client) AbortCurrentUpgrade() error

AbortCurrentUpgrade aborts and archives the current upgrade synchronisation record, if any.

func (*Client) AddCharm

func (c *Client) AddCharm(args params.CharmURL) error

AddCharm 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().

func (*Client) AddMachines

func (c *Client) AddMachines(args params.AddMachines) (params.AddMachinesResults, error)

AddMachines adds new machines with the supplied parameters.

func (*Client) AddMachinesV2

func (c *Client) AddMachinesV2(args params.AddMachines) (params.AddMachinesResults, error)

AddMachinesV2 adds new machines with the supplied parameters.

func (*Client) AddRelation

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

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

func (*Client) AddServiceUnits

func (c *Client) AddServiceUnits(args params.AddServiceUnits) (params.AddServiceUnitsResults, error)

AddServiceUnits adds a given number of units to a service.

func (*Client) AgentVersion

func (c *Client) AgentVersion() (params.AgentVersionResult, error)

AgentVersion returns the current version that the API server is running.

func (*Client) CharmInfo

func (c *Client) CharmInfo(args params.CharmInfo) (api.CharmInfo, error)

CharmInfo returns information about the requested charm.

func (*Client) DestroyEnvironment

func (c *Client) DestroyEnvironment() error

DestroyEnvironment destroys all services and non-manager machine instances in the environment.

func (*Client) DestroyMachines

func (c *Client) DestroyMachines(args params.DestroyMachines) error

DestroyMachines removes a given set of machines.

func (*Client) DestroyRelation

func (c *Client) DestroyRelation(args params.DestroyRelation) error

DestroyRelation removes the relation between the specified endpoints.

func (*Client) DestroyServiceUnits

func (c *Client) DestroyServiceUnits(args params.DestroyServiceUnits) error

DestroyServiceUnits removes a given set of service units.

func (*Client) EnsureAvailability

func (c *Client) EnsureAvailability(args params.StateServersSpecs) (params.StateServersChangeResults, error)

EnsureAvailability ensures the availability of Juju state servers. DEPRECATED: remove when we stop supporting 1.20 and earlier clients. This API is now on the HighAvailability facade.

func (*Client) EnvironmentGet

func (c *Client) EnvironmentGet() (params.EnvironmentConfigResults, error)

EnvironmentGet implements the server-side part of the get-environment CLI command.

func (*Client) EnvironmentInfo

func (c *Client) EnvironmentInfo() (api.EnvironmentInfo, error)

EnvironmentInfo returns information about the current environment (default series and type).

func (*Client) EnvironmentSet

func (c *Client) EnvironmentSet(args params.EnvironmentSet) error

EnvironmentSet implements the server-side part of the set-environment CLI command.

func (*Client) EnvironmentUnset

func (c *Client) EnvironmentUnset(args params.EnvironmentUnset) error

EnvironmentUnset implements the server-side part of the set-environment CLI command.

func (*Client) FindTools

func (c *Client) FindTools(args params.FindToolsParams) (params.FindToolsResult, error)

FindTools returns a List containing all tools matching the given parameters.

func (*Client) FullStatus

func (c *Client) FullStatus(args params.StatusParams) (api.Status, error)

FullStatus gives the information needed for juju status over the api

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(args params.GetAnnotations) (params.GetAnnotationsResults, error)

GetAnnotations returns annotations about a given entity. This API is now deprecated - "Annotations" client should be used instead. TODO(anastasiamac) remove for Juju 2.x

func (*Client) GetEnvironmentConstraints

func (c *Client) GetEnvironmentConstraints() (params.GetConstraintsResults, error)

GetEnvironmentConstraints returns the constraints for the environment.

func (*Client) GetServiceConstraints

func (c *Client) GetServiceConstraints(args params.GetServiceConstraints) (params.GetConstraintsResults, error)

GetServiceConstraints returns the constraints for a given service. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) InjectMachines

func (c *Client) InjectMachines(args params.AddMachines) (params.AddMachinesResults, error)

InjectMachines injects a machine into state with provisioned status.

func (*Client) NewServiceSetForClientAPI

func (c *Client) NewServiceSetForClientAPI(p params.ServiceSet) error

NewServiceSetForClientAPI implements the server side of Client.NewServiceSetForClientAPI. This is exactly like ServiceSet except that it does not unset values that are set to an empty string. ServiceUnset should be used for that.

TODO(Nate): rename this to ServiceSet (and remove the deprecated ServiceSet) when the GUI handles the new behavior. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) PrivateAddress

func (c *Client) PrivateAddress(p params.PrivateAddress) (results params.PrivateAddressResults, err error)

PrivateAddress implements the server side of Client.PrivateAddress.

func (*Client) ProvisioningScript

ProvisioningScript returns a shell script that, when run, provisions a machine agent on the machine executing the script.

func (*Client) PublicAddress

func (c *Client) PublicAddress(p params.PublicAddress) (results params.PublicAddressResults, err error)

PublicAddress implements the server side of Client.PublicAddress.

func (*Client) ResolveCharms

func (c *Client) ResolveCharms(args params.ResolveCharms) (params.ResolveCharmResults, error)

func (*Client) Resolved

func (c *Client) Resolved(p params.Resolved) error

Resolved implements the server side of Client.Resolved.

func (*Client) RetryProvisioning

func (c *Client) RetryProvisioning(p params.Entities) (params.ErrorResults, error)

RetryProvisioning marks a provisioning error as transient on the machines.

func (*Client) Run

func (c *Client) Run(run params.RunParams) (results params.RunResults, err error)

Run the commands specified on the machines identified through the list of machines, units and services.

func (*Client) RunOnAllMachines

func (c *Client) RunOnAllMachines(run params.RunParams) (params.RunResults, error)

RunOnAllMachines attempts to run the specified command on all the machines.

func (*Client) ServiceCharmRelations

ServiceCharmRelations implements the server side of Client.ServiceCharmRelations. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceDeploy

func (c *Client) ServiceDeploy(args params.ServiceDeploy) error

ServiceDeploy fetches the charm from the charm store and deploys it. AddCharm or AddLocalCharm should be called to add the charm before calling ServiceDeploy, although for backward compatibility this is not necessary until 1.16 support is removed.

func (*Client) ServiceDeployWithNetworks

func (c *Client) ServiceDeployWithNetworks(args params.ServiceDeploy) error

ServiceDeployWithNetworks works exactly like ServiceDeploy, but allows specifying networks to include or exclude on the machine where the charm gets deployed (either with args.Network or with constraints).

func (*Client) ServiceDestroy

func (c *Client) ServiceDestroy(args params.ServiceDestroy) error

ServiceDestroy destroys a given service. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceExpose

func (c *Client) ServiceExpose(args params.ServiceExpose) error

ServiceExpose changes the juju-managed firewall to expose any ports that were also explicitly marked by units as open. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceGet

func (c *Client) ServiceGet(args params.ServiceGet) (params.ServiceGetResults, error)

ServiceGet returns the configuration for a service.

func (*Client) ServiceGetCharmURL

func (c *Client) ServiceGetCharmURL(args params.ServiceGet) (params.StringResult, error)

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

func (*Client) ServiceSet

func (c *Client) ServiceSet(p params.ServiceSet) error

ServiceSet implements the server side of Client.ServiceSet. Values set to an empty string will be unset.

(Deprecated) Use NewServiceSetForClientAPI instead, to preserve values set to an empty string, and use ServiceUnset to unset values.

func (*Client) ServiceSetCharm

func (c *Client) ServiceSetCharm(args params.ServiceSetCharm) error

ServiceSetCharm sets the charm for a given service. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceSetYAML

func (c *Client) ServiceSetYAML(p params.ServiceSetYAML) error

ServiceSetYAML implements the server side of Client.ServerSetYAML. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceUnexpose

func (c *Client) ServiceUnexpose(args params.ServiceUnexpose) error

ServiceUnexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceUnset

func (c *Client) ServiceUnset(p params.ServiceUnset) error

ServiceUnset implements the server side of Client.ServiceUnset. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ServiceUpdate

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

ServiceUpdate 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.

func (*Client) SetAnnotations

func (c *Client) SetAnnotations(args params.SetAnnotations) error

SetAnnotations stores annotations about a given entity. This API is now deprecated - "Annotations" client should be used instead. TODO(anastasiamac) remove for Juju 2.x

func (*Client) SetEnvironAgentVersion

func (c *Client) SetEnvironAgentVersion(args params.SetEnvironAgentVersion) error

SetEnvironAgentVersion sets the environment agent version.

func (*Client) SetEnvironmentConstraints

func (c *Client) SetEnvironmentConstraints(args params.SetConstraints) error

SetEnvironmentConstraints sets the constraints for the environment.

func (*Client) SetServiceConstraints

func (c *Client) SetServiceConstraints(args params.SetConstraints) error

SetServiceConstraints sets the constraints for a given service. TODO(mattyw, all): This api call should be move to the new service facade. The client api version will then need bumping.

func (*Client) ShareEnvironment

func (c *Client) ShareEnvironment(args params.ModifyEnvironUsers) (result params.ErrorResults, err error)

ShareEnvironment allows the given user(s) access to the environment.

func (*Client) Status

func (c *Client) Status() (api.LegacyStatus, error)

Status is a stub version of FullStatus that was introduced in 1.16

func (*Client) WatchAll

func (c *Client) WatchAll() (params.AllWatcherId, error)

type MachineOrder

type MachineOrder []params.RunResult

MachineOrder is used to provide the api to sort the results by the machine id.

func (MachineOrder) Len

func (a MachineOrder) Len() int

func (MachineOrder) Less

func (a MachineOrder) Less(i, j int) bool

func (MachineOrder) Swap

func (a MachineOrder) Swap(i, j int)

type Predicate

type Predicate func(interface{}) (matches bool, _ error)

Predicate is a function that when given a unit, machine, or service, will determine whether the unit meets some criteria.

func BuildPredicateFor

func BuildPredicateFor(patterns []string) Predicate

BuildPredicate returns a Predicate which will evaluate a machine, service, or unit against the given patterns.

type RemoteExec

type RemoteExec struct {
	ssh.ExecParams
	MachineId string
	UnitId    string
}

RemoteExec extends the standard ssh.ExecParams by providing the machine and perhaps the unit ids. These are then returned in the params.RunResult return values.

Jump to

Keyboard shortcuts

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