client

package
v0.0.0-...-a0d7459 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func InstanceConfig

func InstanceConfig(st *state.State, machineId, nonce, dataDir string) (*instancecfg.InstanceConfig, error)

InstanceConfig returns information from the environment config that is needed for machine cloud-init (for non-controllers 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 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 Backend

type Backend interface {
	AbortCurrentUpgrade() error
	AddControllerUser(state.UserAccessSpec) (permission.UserAccess, error)
	AddMachineInsideMachine(state.MachineTemplate, string, instance.ContainerType) (*state.Machine, error)
	AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error)
	AddModelUser(string, state.UserAccessSpec) (permission.UserAccess, error)
	AddOneMachine(state.MachineTemplate) (*state.Machine, error)
	AddRelation(...state.Endpoint) (*state.Relation, error)
	AllApplications() ([]*state.Application, error)
	AllRemoteApplications() ([]*state.RemoteApplication, error)
	AllMachines() ([]*state.Machine, error)
	AllIPAddresses() ([]*state.Address, error)
	AllLinkLayerDevices() ([]*state.LinkLayerDevice, error)
	AllModels() ([]*state.Model, error)
	AllRelations() ([]*state.Relation, error)
	Annotations(state.GlobalEntity) (map[string]string, error)
	APIHostPorts() ([][]network.HostPort, error)
	Application(string) (*state.Application, error)
	ApplicationLeaders() (map[string]string, error)
	Charm(*charm.URL) (*state.Charm, error)
	ControllerTag() names.ControllerTag
	EndpointsRelation(...state.Endpoint) (*state.Relation, error)
	FindEntity(names.Tag) (state.Entity, error)
	ForModel(tag names.ModelTag) (*state.State, error)
	InferEndpoints(...string) ([]state.Endpoint, error)
	IsController() bool
	LatestMigration() (state.ModelMigration, error)
	LatestPlaceholderCharm(*charm.URL) (*state.Charm, error)
	Machine(string) (*state.Machine, error)
	Model() (*state.Model, error)
	ModelConfig() (*config.Config, error)
	ModelConfigValues() (config.ConfigValues, error)
	ModelConstraints() (constraints.Value, error)
	ModelTag() names.ModelTag
	ModelUUID() string
	RemoveUserAccess(names.UserTag, names.Tag) error
	SetAnnotations(state.GlobalEntity, map[string]string) error
	SetModelAgentVersion(version.Number) error
	SetModelConstraints(constraints.Value) error
	Subnet(string) (*state.Subnet, error)
	Unit(string) (Unit, error)
	UpdateModelConfig(map[string]interface{}, []string, state.ValidateConfigFunc) error
	Watch() *state.Multiwatcher
}

Backend contains the state.State methods used in this package, allowing stubs to be created for testing.

func NewStateBackend

func NewStateBackend(st *state.State) Backend

type Client

type Client struct {
	// TODO(wallyworld) - we'll retain model config facade methods
	// on the client facade until GUI and Python client library are updated.
	*modelconfig.ModelConfigAPI
	// contains filtered or unexported fields
}

Client serves client-specific API methods.

func NewClient

func NewClient(
	st Backend,
	modelConfigAPI *modelconfig.ModelConfigAPI,
	resources facade.Resources,
	authorizer facade.Authorizer,
	statusSetter *common.StatusSetter,
	toolsFinder *common.ToolsFinder,
	newEnviron func() (environs.Environ, error),
	blockChecker *common.BlockChecker,
) (*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.AddCharm) error

func (*Client) AddCharmWithAuthorization

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

AddCharmWithAuthorization adds the given charm URL (which must include revision) to the model, 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 (*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) AgentVersion

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

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

func (*Client) DestroyMachines

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

DestroyMachines removes a given set of machines.

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) (params.FullStatus, error)

FullStatus gives the information needed for juju status over the api

func (*Client) GetBundleChanges

func (c *Client) GetBundleChanges(args params.BundleChangesParams) (params.BundleChangesResults, error)

GetBundleChanges returns the list of changes required to deploy the given bundle data. The changes are sorted by requirements, so that they can be applied in order. This call is deprecated, clients should use the GetChanges endpoint on the Bundle facade.

func (*Client) GetModelConstraints

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

GetModelConstraints returns the constraints for the model.

func (*Client) InjectMachines

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

InjectMachines injects a machine into state with provisioned status.

func (*Client) ModelInfo

func (c *Client) ModelInfo() (params.ModelInfo, error)

ModelInfo returns information about the current model.

func (*Client) ModelUserInfo

func (c *Client) ModelUserInfo() (params.ModelUserInfoResults, error)

ModelUserInfo returns information on all users in the model.

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)

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

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

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

SetModelAgentVersion sets the model agent version.

func (*Client) SetModelConstraints

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

SetModelConstraints sets the constraints for the model.

func (*Client) StatusHistory

StatusHistory returns a slice of past statuses for several entities.

func (*Client) WatchAll

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

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 Unit

type Unit interface {
	status.StatusHistoryGetter
	Life() state.Life
	Destroy() (err error)
	IsPrincipal() bool
	PublicAddress() (network.Address, error)
	PrivateAddress() (network.Address, error)
	Resolve(retryHooks bool) error
	AgentHistory() status.StatusHistoryGetter
}

Unit represents a state.Unit.

Jump to

Keyboard shortcuts

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