api

package
v0.0.0-...-a002913 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: AGPL-3.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func Connect

func Connect(info *Info, pathTail string, header http.Header, opts DialOpts) (*websocket.Conn, error)

Connect establishes a websocket connection to the API server using the Info, API path tail and (optional) request headers provided. If multiple API addresses are provided in Info they will be tried concurrently - the first successful connection wins.

The path tail may be blank, in which case the default value will be used. Otherwise, it must start with a "/".

func CreateCertPool

func CreateCertPool(caCert string) (*x509.CertPool, error)

CreateCertPool creates a new x509.CertPool and adds in the caCert passed in. All certs from the cert directory (/etc/juju/cert.d on ubuntu) are also added.

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 or all environments (depending on the watcher type).

func NewAllEnvWatcher

func NewAllEnvWatcher(caller base.APICaller, id *string) *AllWatcher

NewAllEnvWatcher returns an AllWatcher instance which interacts with a watcher created by the WatchAllEnvs API call.

There should be no need to call this from outside of the api package. It is only used by Client.WatchAllEnvs in api/systemmanager.

func NewAllWatcher

func NewAllWatcher(caller base.APICaller, id *string) *AllWatcher

NewAllWatcher returns an AllWatcher instance which interacts with a watcher created by the WatchAll API call.

There should be no need to call this from outside of the api package. It is only used by Client.WatchAll in this package.

func (*AllWatcher) Next

func (watcher *AllWatcher) Next() ([]multiwatcher.Delta, error)

Next returns a new set of deltas from a watcher previously created by the WatchAll or WatchAllEnvs API calls. It will block until there are deltas to return.

func (*AllWatcher) Stop

func (watcher *AllWatcher) Stop() error

Stop shutdowns down a watcher previously created by the WatchAll or WatchAllEnvs API calls

type CharmInfo

type CharmInfo struct {
	Revision int
	URL      string
	Config   *charm.Config
	Meta     *charm.Meta
	Actions  *charm.Actions
}

CharmInfo holds information about a charm.

type Client

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

Client represents the client-accessible part of the state.

func (*Client) APIHostPorts

func (c *Client) APIHostPorts() ([][]network.HostPort, error)

APIHostPorts returns a slice of network.HostPort for each API server.

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(curl *charm.URL) 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() in the client-side API.

If the AddCharm API call fails because of an authorization error when retrieving the charm from the charm store, an error satisfying params.IsCodeUnauthorized will be returned.

func (*Client) AddCharmWithAuthorization

func (c *Client) AddCharmWithAuthorization(curl *charm.URL, csMac *macaroon.Macaroon) error

AddCharmWithAuthorization is like AddCharm except it also provides the given charmstore macaroon for the juju server to use when obtaining the charm from the charm store. The macaroon is conventionally obtained from the /delegatable-macaroon endpoint in the charm store.

If the AddCharmWithAuthorization API call fails because of an authorization error when retrieving the charm from the charm store, an error satisfying params.IsCodeUnauthorized will be returned.

func (*Client) AddLocalCharm

func (c *Client) AddLocalCharm(curl *charm.URL, ch charm.Charm) (*charm.URL, error)

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

func (c *Client) AddMachines1dot18(machineParams []params.AddMachineParams) ([]params.AddMachinesResult, error)

AddMachines1dot18 adds new machines with the supplied parameters.

TODO(axw) 2014-04-11 #XXX This exists for backwards compatibility; We cannot remove this code while clients > 1.20 need to talk to 1.18 servers (which is something we need for an undetermined amount of time).

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

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

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

func (*Client) AgentVersion

func (c *Client) AgentVersion() (version.Number, error)

AgentVersion reports the version number of the api server.

func (*Client) CharmInfo

func (c *Client) CharmInfo(charmURL string) (*CharmInfo, error)

CharmInfo returns information about the requested charm.

func (*Client) Close

func (c *Client) Close() error

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

func (c *Client) DestroyEnvironment() error

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

func (c *Client) DestroyMachines(machines ...string) error

DestroyMachines removes a given set of machines.

func (*Client) DestroyRelation

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

DestroyRelation removes the relation between the specified endpoints.

func (*Client) DestroyServiceUnits

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

DestroyServiceUnits decreases the number of units dedicated to a service.

func (*Client) EnsureAvailability

func (c *Client) EnsureAvailability(numStateServers int, cons constraints.Value, series string) (params.StateServersChanges, error)

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

func (*Client) EnvironmentGet

func (c *Client) EnvironmentGet() (map[string]interface{}, error)

EnvironmentGet returns all environment settings.

func (*Client) EnvironmentInfo

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

EnvironmentInfo returns details about the Juju environment.

func (*Client) EnvironmentSet

func (c *Client) EnvironmentSet(config map[string]interface{}) error

EnvironmentSet sets the given key-value pairs in the environment.

func (*Client) EnvironmentUUID

func (c *Client) EnvironmentUUID() string

EnvironmentUUID returns the environment UUID from the client connection.

func (*Client) EnvironmentUnset

func (c *Client) EnvironmentUnset(keys ...string) error

EnvironmentUnset sets the given key-value pairs in the environment.

func (*Client) EnvironmentUserInfo

func (c *Client) EnvironmentUserInfo() ([]params.EnvUserInfo, error)

EnvironmentUserInfo returns information on all users in the environment.

func (*Client) FindTools

func (c *Client) FindTools(majorVersion, minorVersion int, series, arch string) (result params.FindToolsResult, err error)

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

func (*Client) ForceDestroyMachines

func (c *Client) ForceDestroyMachines(machines ...string) error

ForceDestroyMachines removes a given set of machines and all associated units.

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(tag string) (map[string]string, error)

GetAnnotations returns annotations that have been set on the 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() (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() (*params.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) PrivateAddress

func (c *Client) PrivateAddress(target string) (string, error)

PrivateAddress returns the private address of the specified machine or unit.

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

func (c *Client) PublicAddress(target string) (string, error)

PublicAddress returns the public address of the specified machine or unit. For a machine, target is an id not a tag.

func (*Client) ResolveCharm

func (c *Client) ResolveCharm(ref *charm.Reference) (*charm.URL, error)

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

func (*Client) Resolved

func (c *Client) Resolved(unit string, retry bool) error

Resolved clears errors on a unit.

func (*Client) RetryProvisioning

func (c *Client) RetryProvisioning(machines ...names.MachineTag) ([]params.ErrorResult, error)

RetryProvisioning updates the provisioning status of a machine allowing the provisioner to retry.

func (*Client) Run

func (c *Client) Run(run params.RunParams) ([]params.RunResult, error)

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

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

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

func (c *Client) ServiceDeployWithNetworks(
	charmURL string,
	serviceName string,
	numUnits int,
	configYAML string,
	cons constraints.Value,
	toMachineSpec string,
	networks []string,
) error

ServiceDeployWithNetworks works exactly like ServiceDeploy, but allows the specification of requested networks that must be present on the machines where the service is deployed. Another way to specify networks to include/exclude is using constraints.

func (*Client) ServiceDestroy

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

ServiceDestroy destroys a given service.

func (*Client) ServiceExpose

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

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

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

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

func (*Client) ServiceSet

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

ServiceSet sets configuration options on a service.

func (*Client) ServiceSetCharm

func (c *Client) ServiceSetCharm(serviceName string, charmUrl string, force bool) error

ServiceSetCharm sets the charm for a given service.

func (*Client) ServiceSetYAML

func (c *Client) ServiceSetYAML(service string, yaml string) error

ServiceSetYAML sets configuration options on a service given options in YAML format.

func (*Client) ServiceUnexpose

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

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

func (*Client) ServiceUnset

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

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

func (c *Client) SetAnnotations(tag string, pairs map[string]string) error

SetAnnotations sets the annotation pairs on the given entity. Currently annotations are supported on machines, services, units and the environment itself. 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(version version.Number) error

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

func (c *Client) ShareEnvironment(users ...names.UserTag) error

ShareEnvironment allows the given users access to the environment.

func (*Client) Status

func (c *Client) Status(patterns []string) (*params.FullStatus, error)

Status returns the status of the juju environment.

func (*Client) UnitStatusHistory

func (c *Client) UnitStatusHistory(kind params.HistoryKind, unitName string, size int) (*params.UnitStatusHistory, error)

UnitStatusHistory retrieves the last <size> results of <kind:combined|agent|workload> status for <unitName> unit

func (*Client) UnshareEnvironment

func (c *Client) UnshareEnvironment(users ...names.UserTag) error

UnshareEnvironment removes access to the environment for the given users.

func (*Client) UploadTools

func (c *Client) UploadTools(r io.Reader, vers version.Binary, additionalSeries ...string) (*tools.Tools, error)

UploadTools uploads tools at the specified location to the API server over HTTPS.

func (*Client) WatchAll

func (c *Client) WatchAll() (*AllWatcher, error)

WatchAll returns an AllWatcher, from which you can request the Next collection of Deltas.

func (*Client) WatchDebugLog

func (c *Client) WatchDebugLog(args DebugLogParams) (io.ReadCloser, error)

WatchDebugLog returns a ReadCloser that the caller can read the log lines from. Only log lines that match the filtering specified in the DebugLogParams are returned. It returns an error that satisfies errors.IsNotImplemented when the API server does not support the end-point.

TODO(dimitern) We already have errors.IsNotImplemented - why do we need to define a different error for this purpose here?

type Connection

type Connection interface {

	// This first block of methods is pretty close to a sane Connection interface.
	Close() error
	Broken() <-chan struct{}
	Addr() string
	APIHostPorts() [][]network.HostPort

	// These are a bit off -- ServerVersion is apparently not known until after
	// Login()? Maybe evidence of need for a separate AuthenticatedConnection..?
	Login(name, password, nonce string) error
	ServerVersion() (version.Number, bool)

	// These are either part of base.APICaller or look like they probably should
	// be (ServerTag in particular). It's fine and good for Connection to be an
	// APICaller.
	APICall(facade string, version int, id, method string, args, response interface{}) error
	BestFacadeVersion(string) int
	EnvironTag() (names.EnvironTag, error)
	ServerTag() (names.EnvironTag, error)

	// These HTTP methods should probably be separated out somehow.
	NewHTTPClient() *http.Client
	NewHTTPRequest(method, path string) (*http.Request, error)
	SendHTTPRequest(path string, args interface{}) (*http.Request, *http.Response, error)
	SendHTTPRequestReader(path string, attached io.Reader, meta interface{}, name string) (*http.Request, *http.Response, error)

	// Something-or-other expects Ping to exist, and *maybe* the heartbeat
	// *should* be handled outside the State type, but it's also handled
	// inside it as well. We should figure this out sometime -- we should
	// either expose Ping() or Broken() but not both.
	Ping() error

	// RPCClient is apparently exported for testing purposes only, but this
	// seems to indicate *some* sort of layering confusion.
	RPCClient() *rpc.Conn

	// I think this is actually dead code. It's tested, at least, so I'm
	// keeping it for now, but it's not apparently used anywhere else.
	AllFacadeVersions() map[string][]int

	// These methods expose a bunch of worker-specific facades, and basically
	// just should not exist; but removing them is too noisy for a single CL.
	// Client in particular is intimately coupled with State -- and the others
	// will be easy to remove, but until we're using them via manifolds it's
	// prohibitively ugly to do so.
	Client() *Client
	Machiner() *machiner.State
	Resumer() *resumer.API
	Networker() networker.State
	Provisioner() *provisioner.State
	Uniter() (*uniter.State, error)
	DiskManager() (*diskmanager.State, error)
	StorageProvisioner(scope names.Tag) *storageprovisioner.State
	Firewaller() *firewaller.State
	Agent() *agent.State
	Upgrader() *upgrader.State
	Reboot() (*reboot.State, error)
	Deployer() *deployer.State
	Environment() *environment.Facade
	Logger() *apilogger.State
	KeyUpdater() *keyupdater.State
	Addresser() *addresser.API
	InstancePoller() *instancepoller.API
	CharmRevisionUpdater() *charmrevisionupdater.State
	Cleaner() *cleaner.API
	Rsyslog() *rsyslog.State
	MetadataUpdater() *imagemetadata.Client
}

Connection exists purely to make api-opening funcs mockable. It's just a dumb copy of all the methods on api.Connection; we can and should be extracting smaller and more relevant interfaces (and dropping some of them too).

func Open

func Open(info *Info, opts DialOpts) (Connection, error)

Open establishes a connection to the API server using the Info given, returning a State instance which can be used to make API requests.

See Connect for details of the connection mechanics.

func OpenWithVersion

func OpenWithVersion(info *Info, opts DialOpts, loginVersion int) (Connection, error)

OpenWithVersion uses an explicit version of the Admin facade to call Login on. This allows the caller to pretend to be an older client, and is used only in testing.

type DebugLogParams

type DebugLogParams struct {
	// IncludeEntity lists entity tags to include in the response. Tags may
	// finish with a '*' to match a prefix e.g.: unit-mysql-*, machine-2. If
	// none are set, then all lines are considered included.
	IncludeEntity []string
	// IncludeModule lists logging modules to include in the response. If none
	// are set all modules are considered included.  If a module is specified,
	// all the submodules also match.
	IncludeModule []string
	// ExcludeEntity lists entity tags to exclude from the response. As with
	// IncludeEntity the values may finish with a '*'.
	ExcludeEntity []string
	// ExcludeModule lists logging modules to exclude from the resposne. If a
	// module is specified, all the submodules are also excluded.
	ExcludeModule []string
	// Limit defines the maximum number of lines to return. Once this many
	// have been sent, the socket is closed.  If zero, all filtered lines are
	// sent down the connection until the client closes the connection.
	Limit uint
	// Backlog tells the server to try to go back this many lines before
	// starting filtering. If backlog is zero and replay is false, then there
	// may be an initial delay until the next matching log message is written.
	Backlog uint
	// Level specifies the minimum logging level to be sent back in the response.
	Level loggo.Level
	// Replay tells the server to start at the start of the log file rather
	// than the end. If replay is true, backlog is ignored.
	Replay bool
}

DebugLogParams holds parameters for WatchDebugLog that control the filtering of the log messages. If the structure is zero initialized, the entire log file is sent back starting from the end, and until the user closes the connection.

type DialOpts

type DialOpts struct {
	// DialAddressInterval is the amount of time to wait
	// before starting to dial another address.
	DialAddressInterval time.Duration

	// 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

type EnvironmentInfo struct {
	DefaultSeries string
	ProviderType  string
	Name          string
	UUID          string
	ServerUUID    string
}

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 string

	// EnvironTag holds the environ tag for the environment we are
	// trying to connect to.
	EnvironTag names.EnvironTag

	// Tag holds the name of the entity that is connecting.
	// If this is nil, and the password is 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 names.Tag

	// 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 OpenFunc

type OpenFunc func(*Info, DialOpts) (Connection, error)

OpenFunc is the usual form of a function that opens an API connection.

type State

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

func (*State) APICall

func (s *State) APICall(facade string, version int, id, method string, args, response interface{}) error

APICall places a call to the remote machine.

This fills out the rpc.Request on the given facade, version for a given object id, and the specific RPC method. It marshalls the Arguments, and will unmarshall the result into the response object that is supplied.

func (*State) APIHostPorts

func (s *State) APIHostPorts() [][]network.HostPort

APIHostPorts returns addresses that may be used to connect to the API server, including the address used to connect.

The addresses are scoped (public, cloud-internal, etc.), so the client may choose which addresses to attempt. For the Juju CLI, all addresses must be attempted, as the CLI may be invoked both within and outside the environment (think private clouds).

func (*State) Addr

func (s *State) Addr() string

Addr returns the address used to connect to the API server.

func (*State) Addresser

func (st *State) Addresser() *addresser.API

Addresser returns access to the Addresser API.

func (*State) Agent

func (st *State) Agent() *agent.State

Agent returns a version of the state that provides functionality required by the agent code.

func (*State) AllFacadeVersions

func (s *State) AllFacadeVersions() map[string][]int

AllFacadeVersions returns what versions we know about for all facades

func (*State) BestFacadeVersion

func (s *State) BestFacadeVersion(facade string) int

BestFacadeVersion compares the versions of facades that we know about, and the versions available from the server, and reports back what version is the 'best available' to use. TODO(jam) this is the eventual implementation of what version of a given Facade we will want to use. It needs to line up the versions that the server reports to us, with the versions that our client knows how to use.

func (*State) Broken

func (s *State) Broken() <-chan struct{}

Broken returns a channel that's closed when the connection is broken.

func (*State) CharmRevisionUpdater

func (st *State) CharmRevisionUpdater() *charmrevisionupdater.State

CharmRevisionUpdater returns access to the CharmRevisionUpdater API

func (*State) Cleaner

func (st *State) Cleaner() *cleaner.API

Cleaner returns a version of the state that provides access to the cleaner API

func (*State) Client

func (st *State) Client() *Client

Client returns an object that can be used to access client-specific functionality.

func (*State) Close

func (s *State) Close() error

func (*State) Deployer

func (st *State) Deployer() *deployer.State

Deployer returns access to the Deployer API

func (*State) DiskManager

func (st *State) DiskManager() (*diskmanager.State, error)

DiskManager returns a version of the state that provides functionality required by the diskmanager worker.

func (*State) EnvironTag

func (s *State) EnvironTag() (names.EnvironTag, error)

EnvironTag returns the tag of the environment we are connected to.

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

func (st *State) InstancePoller() *instancepoller.API

InstancePoller returns access to the InstancePoller API

func (*State) KeyUpdater

func (st *State) KeyUpdater() *keyupdater.State

KeyUpdater returns access to the KeyUpdater API

func (*State) Logger

func (st *State) Logger() *apilogger.State

Logger returns access to the Logger API

func (*State) Login

func (st *State) Login(tag, password, nonce string) error

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

func (st *State) Machiner() *machiner.State

Machiner returns a version of the state that provides functionality required by the machiner worker.

func (*State) MetadataUpdater

func (st *State) MetadataUpdater() *imagemetadata.Client

MetadataUpdater returns access to the imageMetadata API

func (*State) Networker

func (st *State) Networker() networker.State

Networker returns a version of the state that provides functionality required by the networker worker.

func (*State) NewHTTPClient

func (s *State) NewHTTPClient() *http.Client

NewHTTPClient returns an HTTP client initialized based on State.

func (*State) NewHTTPRequest

func (s *State) NewHTTPRequest(method, path string) (*http.Request, error)

NewHTTPRequest returns a new API-supporting HTTP request based on State.

func (*State) Ping

func (s *State) Ping() error

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

func (s *State) RPCClient() *rpc.Conn

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.

func (*State) Reboot

func (st *State) Reboot() (*reboot.State, error)

Reboot returns access to the Reboot API

func (*State) Resumer

func (st *State) Resumer() *resumer.API

Resumer returns a version of the state that provides functionality required by the resumer worker.

func (*State) Rsyslog

func (st *State) Rsyslog() *rsyslog.State

Rsyslog returns access to the Rsyslog API

func (*State) SendHTTPRequest

func (s *State) SendHTTPRequest(path string, args interface{}) (*http.Request, *http.Response, error)

SendHTTPRequest sends a GET request using the HTTP client derived from State.

func (*State) SendHTTPRequestReader

func (s *State) SendHTTPRequestReader(path string, attached io.Reader, meta interface{}, name string) (*http.Request, *http.Response, error)

SendHTTPRequestReader sends a PUT request using the HTTP client derived from State. The provided io.Reader and associated JSON metadata are attached to the request body as multi-part data. The name parameter identifies the attached data's part in the multi-part data. That name doesn't have any semantic significance in juju, so the provided value is strictly informational.

func (*State) ServerTag

func (s *State) ServerTag() (names.EnvironTag, error)

ServerTag returns the tag of the server we are connected to.

func (*State) ServerVersion

func (st *State) ServerVersion() (version.Number, bool)

ServerVersion holds the version of the API server that we are connected to. It is possible that this version is Zero if the server does not report this during login. The second result argument indicates if the version number is set.

func (*State) StorageProvisioner

func (st *State) StorageProvisioner(scope names.Tag) *storageprovisioner.State

StorageProvisioner returns a version of the state that provides functionality required by the storageprovisioner worker. The scope tag defines the type of storage that is provisioned, either either attached directly to a specified machine (machine scoped), or provisioned on the underlying cloud for use by any machine in a specified environment (environ scoped).

func (*State) Uniter

func (st *State) Uniter() (*uniter.State, error)

Uniter returns a version of the state that provides functionality required by the uniter worker.

func (*State) Upgrader

func (st *State) Upgrader() *upgrader.State

Upgrader returns access to the Upgrader API

type WatchAll

type WatchAll struct {
	AllWatcherId string
}

WatchAll holds the id of the newly-created AllWatcher/AllEnvWatcher.

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.

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

Directories

Path Synopsis
Package leadership implements the client to the analog leadership service.
Package leadership implements the client to the analog leadership service.
Package meterstatus contains an implementation of the api facade to watch the meter status of a unit for changes and return the current meter status.
Package meterstatus contains an implementation of the api facade to watch the meter status of a unit for changes and return the current meter status.
Package metricsadder contains an implementation of the api facade to add metrics to the state.
Package metricsadder contains an implementation of the api facade to add metrics to the state.
The metricsmanager package contains implementation for an api facade to access metrics functions within state
The metricsmanager package contains implementation for an api facade to access metrics functions within state
Package service provides access to the service api facade.
Package service provides access to the service api facade.

Jump to

Keyboard shortcuts

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