Documentation
¶
Index ¶
- Variables
- type AllWatcher
- type CharmInfo
- type Client
- func (c *Client) AddCharm(curl *charm.URL) error
- func (c *Client) AddLocalCharm(curl *charm.URL, ch charm.Charm) (*charm.URL, error)
- func (c *Client) AddMachines(machineParams []params.AddMachineParams) ([]params.AddMachinesResult, error)
- func (c *Client) AddRelation(endpoints ...string) (*params.AddRelationResults, error)
- func (c *Client) AddServiceUnits(service string, numUnits int, machineSpec string) ([]string, error)
- func (c *Client) CharmInfo(charmURL string) (*CharmInfo, error)
- func (c *Client) Close() error
- func (c *Client) DestroyEnvironment() error
- func (c *Client) DestroyMachines(machines ...string) error
- func (c *Client) DestroyRelation(endpoints ...string) error
- func (c *Client) DestroyServiceUnits(unitNames ...string) error
- func (c *Client) EnvironmentGet() (map[string]interface{}, error)
- func (c *Client) EnvironmentInfo() (*EnvironmentInfo, error)
- func (c *Client) EnvironmentSet(config map[string]interface{}) error
- func (c *Client) FindTools(majorVersion, minorVersion int, series, arch string) (result params.FindToolsResults, err error)
- func (c *Client) ForceDestroyMachines(machines ...string) error
- func (c *Client) GetAnnotations(tag string) (map[string]string, error)
- func (c *Client) GetEnvironmentConstraints() (constraints.Value, error)
- func (c *Client) GetServiceConstraints(service string) (constraints.Value, error)
- func (c *Client) LegacyStatus() (*LegacyStatus, error)
- func (c *Client) ProvisioningScript(args params.ProvisioningScriptParams) (script string, err error)
- func (c *Client) PublicAddress(target string) (string, error)
- func (c *Client) Resolved(unit string, retry bool) error
- func (c *Client) Run(run params.RunParams) ([]params.RunResult, error)
- func (c *Client) RunOnAllMachines(commands string, timeout time.Duration) ([]params.RunResult, error)
- func (c *Client) ServiceCharmRelations(service string) ([]string, error)
- func (c *Client) ServiceDeploy(charmUrl string, serviceName string, numUnits int, configYAML string, ...) error
- func (c *Client) ServiceDestroy(service string) error
- func (c *Client) ServiceExpose(service string) error
- func (c *Client) ServiceGet(service string) (*params.ServiceGetResults, error)
- func (c *Client) ServiceGetCharmURL(serviceName string) (*charm.URL, error)
- func (c *Client) ServiceSet(service string, options map[string]string) error
- func (c *Client) ServiceSetCharm(serviceName string, charmUrl string, force bool) error
- func (c *Client) ServiceSetYAML(service string, yaml string) error
- func (c *Client) ServiceUnexpose(service string) error
- func (c *Client) ServiceUnset(service string, options []string) error
- func (c *Client) ServiceUpdate(args params.ServiceUpdate) error
- func (c *Client) SetAnnotations(tag string, pairs map[string]string) error
- func (c *Client) SetEnvironAgentVersion(version version.Number) error
- func (c *Client) SetEnvironmentConstraints(constraints constraints.Value) error
- func (c *Client) SetServiceConstraints(service string, constraints constraints.Value) error
- func (c *Client) Status(patterns []string) (*Status, error)
- func (c *Client) WatchAll() (*AllWatcher, error)
- type DialOpts
- type EnvironmentInfo
- type Info
- type LegacyMachineStatus
- type LegacyStatus
- type MachineStatus
- type ServiceStatus
- type State
- func (st *State) Agent() *agent.State
- func (s *State) Broken() <-chan struct{}
- func (s *State) Call(objType, id, request string, args, response interface{}) error
- func (st *State) CharmRevisionUpdater() *charmrevisionupdater.State
- func (st *State) Client() *Client
- func (s *State) Close() error
- func (st *State) Deployer() *deployer.State
- func (st *State) Environment() *environment.Facade
- func (st *State) Firewaller() *firewaller.State
- func (st *State) KeyUpdater() *keyupdater.State
- func (st *State) Logger() *logger.State
- func (st *State) Login(tag, password, nonce string) error
- func (st *State) Machiner() *machiner.State
- func (s *State) Ping() error
- func (st *State) Provisioner() *provisioner.State
- func (s *State) RPCClient() *rpc.Conn
- func (st *State) Rsyslog() *rsyslog.State
- func (st *State) Uniter() *uniter.State
- func (st *State) Upgrader() *upgrader.State
- type Status
- type UnitStatus
- type WatchAll
- Bugs
Constants ¶
This section is empty.
Variables ¶
var PingPeriod = 1 * time.Minute
PingPeriod defines how often the internal connection health check will run. It's a variable so it can be changed in tests.
Functions ¶
This section is empty.
Types ¶
type AllWatcher ¶
type AllWatcher struct {
// contains filtered or unexported fields
}
AllWatcher holds information allowing us to get Deltas describing changes to the entire environment.
func (*AllWatcher) Stop ¶
func (watcher *AllWatcher) Stop() error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the client-accessible part of the state.
func (*Client) AddCharm ¶
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() in the client-side API.
func (*Client) AddLocalCharm ¶
AddLocalCharm prepares the given charm with a local: schema in its URL, and uploads it via the API server, returning the assigned charm URL. If the API server does not support charm uploads, an error satisfying params.IsCodeNotImplemented() is returned.
func (*Client) AddMachines ¶
func (c *Client) AddMachines(machineParams []params.AddMachineParams) ([]params.AddMachinesResult, error)
AddMachines adds new machines with the supplied parameters.
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) AddServiceUnits ¶
func (c *Client) AddServiceUnits(service string, numUnits int, machineSpec string) ([]string, error)
AddServiceUnits adds a given number of units to a service.
func (*Client) Close ¶
Close closes the Client's underlying State connection Client is unique among the api.State facades in closing its own State connection, but it is conventional to use a Client object without any access to its underlying state connection.
func (*Client) DestroyEnvironment ¶
DestroyEnvironment puts the environment into a "dying" state, and removes all non-manager machine instances. DestroyEnvironment will fail if there are any manually-provisioned non-manager machines in state.
func (*Client) DestroyMachines ¶
DestroyMachines removes a given set of machines.
func (*Client) DestroyRelation ¶
DestroyRelation removes the relation between the specified endpoints.
func (*Client) DestroyServiceUnits ¶
DestroyServiceUnits decreases the number of units dedicated to a service.
func (*Client) EnvironmentGet ¶
EnvironmentGet returns all environment settings.
func (*Client) EnvironmentInfo ¶
func (c *Client) EnvironmentInfo() (*EnvironmentInfo, error)
EnvironmentInfo returns details about the Juju environment.
func (*Client) EnvironmentSet ¶
EnvironmentSet sets the given key-value pairs in the environment.
func (*Client) FindTools ¶
func (c *Client) FindTools(majorVersion, minorVersion int, series, arch string) (result params.FindToolsResults, err error)
FindTools returns a List containing all tools matching the specified parameters.
func (*Client) ForceDestroyMachines ¶
ForceDestroyMachines removes a given set of machines and all associated units.
func (*Client) GetAnnotations ¶
GetAnnotations returns annotations that have been set on the given entity.
func (*Client) GetEnvironmentConstraints ¶
func (c *Client) GetEnvironmentConstraints() (constraints.Value, error)
GetEnvironmentConstraints returns the constraints for the environment.
func (*Client) GetServiceConstraints ¶
func (c *Client) GetServiceConstraints(service string) (constraints.Value, error)
GetServiceConstraints returns the constraints for the given service.
func (*Client) LegacyStatus ¶
func (c *Client) LegacyStatus() (*LegacyStatus, error)
LegacyStatus is a stub version of Status that 1.16 introduced. Should be removed along with structs when api versioning makes it safe to do so.
func (*Client) ProvisioningScript ¶
func (c *Client) ProvisioningScript(args params.ProvisioningScriptParams) (script string, err error)
ProvisioningScript returns a shell script that, when run, provisions a machine agent on the machine executing the script.
func (*Client) PublicAddress ¶
PublicAddress returns the public address of the specified machine or unit.
func (*Client) Run ¶
Run the Commands specified on the machines identified through the ids provided in the machines, services and units slices.
func (*Client) RunOnAllMachines ¶
func (c *Client) RunOnAllMachines(commands string, timeout time.Duration) ([]params.RunResult, error)
RunOnAllMachines runs the command on all the machines with the specified timeout.
func (*Client) ServiceCharmRelations ¶
ServiceCharmRelations returns the service's charms relation names.
func (*Client) ServiceDeploy ¶
func (c *Client) ServiceDeploy(charmUrl string, serviceName string, numUnits int, configYAML string, cons constraints.Value, toMachineSpec string) error
ServiceDeploy obtains the charm, either locally or from the charm store, and deploys it.
func (*Client) ServiceDestroy ¶
ServiceDestroy destroys a given service.
func (*Client) ServiceExpose ¶
ServiceExpose changes the juju-managed firewall to expose any ports that were also explicitly marked by units as open.
func (*Client) ServiceGet ¶
func (c *Client) ServiceGet(service string) (*params.ServiceGetResults, error)
ServiceGet returns the configuration for the named service.
func (*Client) ServiceGetCharmURL ¶
ServiceGetCharmURL returns the charm URL the given service is running at present.
func (*Client) ServiceSet ¶
ServiceSet sets configuration options on a service.
func (*Client) ServiceSetCharm ¶
ServiceSetCharm sets the charm for a given service.
func (*Client) ServiceSetYAML ¶
ServiceSetYAML sets configuration options on a service given options in YAML format.
func (*Client) ServiceUnexpose ¶
ServiceUnexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open.
func (*Client) ServiceUnset ¶
ServiceUnset resets configuration options on a service.
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. TODO(frankban) deprecate redundant API calls that this supercedes.
func (*Client) SetAnnotations ¶
SetAnnotations sets the annotation pairs on the given entity. Currently annotations are supported on machines, services, units and the environment itself.
func (*Client) SetEnvironAgentVersion ¶
SetEnvironAgentVersion sets the environment agent-version setting to the given value.
func (*Client) SetEnvironmentConstraints ¶
func (c *Client) SetEnvironmentConstraints(constraints constraints.Value) error
SetEnvironmentConstraints specifies the constraints for the environment.
func (*Client) SetServiceConstraints ¶
func (c *Client) SetServiceConstraints(service string, constraints constraints.Value) error
SetServiceConstraints specifies the constraints for the given service.
func (*Client) WatchAll ¶
func (c *Client) WatchAll() (*AllWatcher, error)
WatchAll returns an AllWatcher, from which you can request the Next collection of Deltas.
type DialOpts ¶
type DialOpts struct { // Timeout is the amount of time to wait contacting // a state server. Timeout time.Duration // RetryDelay is the amount of time to wait between // unsucssful connection attempts. RetryDelay time.Duration }
DialOpts holds configuration parameters that control the Dialing behavior when connecting to a state server.
func DefaultDialOpts ¶
func DefaultDialOpts() DialOpts
DefaultDialOpts returns a DialOpts representing the default parameters for contacting a state server.
type EnvironmentInfo ¶
EnvironmentInfo holds information about the Juju environment.
type Info ¶
type Info struct { // Addrs holds the addresses of the state servers. Addrs []string // CACert holds the CA certificate that will be used // to validate the state server's certificate, in PEM format. CACert []byte // Tag holds the name of the entity that is connecting. // If this and the password are empty, no login attempt will be made // (this is to allow tests to access the API to check that operations // fail when not logged in). Tag string // Password holds the password for the administrator or connecting entity. Password string // Nonce holds the nonce used when provisioning the machine. Used // only by the machine agent. Nonce string `yaml:",omitempty"` }
Info encapsulates information about a server holding juju state and can be used to make a connection to it.
type LegacyMachineStatus ¶
type LegacyMachineStatus struct {
InstanceId string // Not type instance.Id just to match original api.
}
LegacyMachineStatus holds just the instance-id of a machine.
type LegacyStatus ¶
type LegacyStatus struct {
Machines map[string]LegacyMachineStatus
}
LegacyStatus holds minimal information on the status of a juju environment.
type MachineStatus ¶
type MachineStatus struct { Err error AgentState params.Status AgentStateInfo string AgentVersion string DNSName string InstanceId instance.Id InstanceState string Life string Series string Id string Containers map[string]MachineStatus Hardware string }
MachineStatus holds status info about a machine.
type ServiceStatus ¶
type ServiceStatus struct { Err error Charm string Exposed bool Life string Relations map[string][]string CanUpgradeTo string SubordinateTo []string Units map[string]UnitStatus }
ServiceStatus holds status info about a service.
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) Agent ¶
Agent returns a version of the state that provides functionality required by the agent code.
func (*State) Broken ¶
func (s *State) Broken() <-chan struct{}
Broken returns a channel that's closed when the connection is broken.
func (*State) Call ¶
Call invokes a low-level RPC method of the given objType, id, and request, passing the given parameters and filling in the response results. This should not be used directly by clients. TODO (dimitern) Add tests for all client-facing objects to verify we return the correct error when invoking Call("Object", "non-empty-id",...)
func (*State) CharmRevisionUpdater ¶
func (st *State) CharmRevisionUpdater() *charmrevisionupdater.State
CharmRevisionUpdater returns access to the CharmRevisionUpdater API
func (*State) Client ¶
Client returns an object that can be used to access client-specific functionality.
func (*State) Environment ¶
func (st *State) Environment() *environment.Facade
Environment returns access to the Environment API
func (*State) Firewaller ¶
func (st *State) Firewaller() *firewaller.State
Firewaller returns a version of the state that provides functionality required by the firewaller worker.
func (*State) KeyUpdater ¶
func (st *State) KeyUpdater() *keyupdater.State
KeyUpdater returns access to the KeyUpdater API
func (*State) Login ¶
Login authenticates as the entity with the given name and password. Subsequent requests on the state will act as that entity. This method is usually called automatically by Open. The machine nonce should be empty unless logging in as a machine agent.
func (*State) Machiner ¶
Machiner returns a version of the state that provides functionality required by the machiner worker.
func (*State) Provisioner ¶
func (st *State) Provisioner() *provisioner.State
Provisioner returns a version of the state that provides functionality required by the provisioner worker.
func (*State) RPCClient ¶
RPCClient returns the RPC client for the state, so that testing functions can tickle parts of the API that the conventional entry points don't reach. This is exported for testing purposes only.
type Status ¶
type Status struct { EnvironmentName string Machines map[string]MachineStatus Services map[string]ServiceStatus }
Status holds information about the status of a juju environment.
Notes ¶
Bugs ¶
2013-12-17 bug #1261780 Due to issues with go 1.1.2, fixed later, we cannot use a regular TLS client with the CACert here, because we get "x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs". Once we use a later go version, this should be changed to connect to the API server with a regular HTTP+TLS enabled client, using the CACert (possily cached, like the tag and password) passed in api.Open()'s info argument.