juju: github.com/juju/juju/apiserver/facades/client/client Index | Files

package client

import "github.com/juju/juju/apiserver/facades/client/client"


Package Files

backend.go bundles.go client.go filtering.go instanceconfig.go status.go


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

func InstanceConfig Uses

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 Uses

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 SkipReplicaCheck Uses

func SkipReplicaCheck(patcher Patcher)

SkipReplicaCheck is required for tests only as the test mongo isn't a replica.

func UnitChainPredicateFn Uses

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.

type API Uses

type API struct {
    // contains filtered or unexported fields

type Backend Uses

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)
    AddOneMachine(state.MachineTemplate) (*state.Machine, error)
    AddRelation(...state.Endpoint) (*state.Relation, error)
    AllApplications() ([]*state.Application, error)
    AllApplicationOffers() ([]*crossmodel.ApplicationOffer, error)
    AllRemoteApplications() ([]*state.RemoteApplication, error)
    AllMachines() ([]*state.Machine, error)
    AllModelUUIDs() ([]string, error)
    AllIPAddresses() ([]*state.Address, error)
    AllLinkLayerDevices() ([]*state.LinkLayerDevice, error)
    AllRelations() ([]*state.Relation, error)
    AllSubnets() ([]*state.Subnet, error)
    Annotations(state.GlobalEntity) (map[string]string, error)
    APIHostPortsForClients() ([]network.SpaceHostPorts, error)
    Application(string) (*state.Application, error)
    Charm(*charm.URL) (*state.Charm, error)
    ControllerConfig() (controller.Config, error)
    ControllerNodes() ([]state.ControllerNode, error)
    ControllerTag() names.ControllerTag
    ControllerTimestamp() (*time.Time, error)
    EndpointsRelation(...state.Endpoint) (*state.Relation, error)
    FindEntity(names.Tag) (state.Entity, error)
    InferEndpoints(...string) ([]state.Endpoint, error)
    IsController() bool
    HAPrimaryMachine() (names.MachineTag, error)
    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
    MongoSession() MongoSession
    RemoteApplication(string) (*state.RemoteApplication, error)
    RemoteConnectionStatus(string) (*state.RemoteConnectionStatus, error)
    RemoveUserAccess(names.UserTag, names.Tag) error
    SetAnnotations(state.GlobalEntity, map[string]string) error
    SetModelAgentVersion(version.Number, bool) error
    SetModelConstraints(constraints.Value) error
    Unit(string) (Unit, error)
    UpdateModelConfig(map[string]interface{}, []string, ...state.ValidateConfigFunc) error

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

type Client Uses

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

Client serves client-specific API methods.

func NewClient Uses

func NewClient(
    backend Backend,
    pool Pool,
    modelConfigAPI *modelconfig.ModelConfigAPIV1,
    resources facade.Resources,
    authorizer facade.Authorizer,
    presence facade.Presence,
    statusSetter *common.StatusSetter,
    toolsFinder *common.ToolsFinder,
    newEnviron common.NewEnvironFunc,
    blockChecker *common.BlockChecker,
    callCtx context.ProviderCallContext,
    leadershipReader leadership.Reader,
    modelCache *cache.Model,
    factory multiwatcher.Factory,
    openCSRepo application.OpenCSRepoFunc,
) (*Client, error)

NewClient creates a new instance of the Client Facade.

func NewFacade Uses

func NewFacade(ctx facade.Context) (*Client, error)

NewFacade creates a version 1 Client facade to handle API requests.

func (*Client) APIHostPorts Uses

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

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

func (*Client) AbortCurrentUpgrade Uses

func (c *Client) AbortCurrentUpgrade() error

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

func (*Client) AddCharm Uses

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

NOTE: AddCharm is deprecated as of juju 2.9 and charms facade version 3. Please discontinue use and move to the charms facade version.

TODO: remove in juju 3.0

func (*Client) AddCharmWithAuthorization Uses

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.

NOTE: AddCharmWithAuthorization is deprecated as of juju 2.9 and charms facade version 3. Please discontinue use and move to the charms facade version.

TODO: remove in juju 3.0

func (*Client) AddMachines Uses

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

AddMachines adds new machines with the supplied parameters.

func (*Client) AddMachinesV2 Uses

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

AddMachinesV2 adds new machines with the supplied parameters.

func (*Client) AgentVersion Uses

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

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

func (*Client) CACert Uses

func (c *Client) CACert() (params.BytesResult, error)

CACert returns the certificate used to validate the state connection.

func (*Client) CheckMongoStatusForUpgrade Uses

func (c *Client) CheckMongoStatusForUpgrade(session MongoSession) error

CheckMongoStatusForUpgrade returns an error if the replicaset is not in a good enough state for an upgrade to continue. Exported for testing.

func (*Client) DestroyMachines Uses

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

DestroyMachines removes a given set of machines.

func (*Client) FindTools Uses

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

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

func (*Client) FullStatus Uses

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

FullStatus gives the information needed for juju status over the api

func (*Client) GetBundleChanges Uses

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. Note: any new feature in the future like devices will never be supported here.

func (*Client) GetModelConstraints Uses

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

GetModelConstraints returns the constraints for the model.

func (*Client) InjectMachines Uses

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

InjectMachines injects a machine into state with provisioned status.

func (*Client) ModelInfo Uses

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

ModelInfo returns information about the current model.

func (*Client) ModelUserInfo Uses

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

ModelUserInfo returns information on all users in the model.

func (*Client) PrivateAddress Uses

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

PrivateAddress implements the server side of Client.PrivateAddress.

func (*Client) ProvisioningScript Uses

func (c *Client) ProvisioningScript(args params.ProvisioningScriptParams) (params.ProvisioningScriptResult, error)

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

func (*Client) PublicAddress Uses

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

PublicAddress implements the server side of Client.PublicAddress.

func (*Client) ResolveCharms Uses

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.

NOTE: ResolveCharms is deprecated as of juju 2.9 and charms facade version 3. Please discontinue use and move to the charms facade version.

TODO: remove in juju 3.0

func (*Client) Resolved Uses

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

Resolved implements the server side of Client.Resolved.

func (*Client) RetryProvisioning Uses

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

RetryProvisioning marks a provisioning error as transient on the machines.

func (*Client) SetModelAgentVersion Uses

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

SetModelAgentVersion sets the model agent version.

func (*Client) SetModelConstraints Uses

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

SetModelConstraints sets the constraints for the model.

func (*Client) StatusHistory Uses

func (c *Client) StatusHistory(request params.StatusHistoryRequests) params.StatusHistoryResults

StatusHistory returns a slice of past statuses for several entities.

func (*Client) WatchAll Uses

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

WatchAll initiates a watcher for entities in the connected model.

type ClientV1 Uses

type ClientV1 struct {

ClientV1 serves the (v1) client-specific API methods.

func NewFacadeV1 Uses

func NewFacadeV1(ctx facade.Context) (*ClientV1, error)

NewFacadeV1 creates a version 1 Client facade to handle API requests.

func (*ClientV1) FindTools Uses

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

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

type Model Uses

type Model interface {
    AddUser(state.UserAccessSpec) (permission.UserAccess, error)

Model contains the state.Model methods used in this package.

type MongoSession Uses

type MongoSession interface {
    CurrentStatus() (*replicaset.Status, error)

MongoSession provides a way to get the status for the mongo replicaset.

type MongoSessionShim Uses

type MongoSessionShim struct {

MongoSessionShim wraps a *mgo.Session to conform to the MongoSession interface.

func (MongoSessionShim) CurrentStatus Uses

func (s MongoSessionShim) CurrentStatus() (*replicaset.Status, error)

CurrentStatus returns the current status of the replicaset.

type Patcher Uses

type Patcher interface {
    PatchValue(dest, value interface{})

Patcher is provided by the test suites to temporarily change values.

type Pool Uses

type Pool interface {
    GetModel(string) (*state.Model, func(), error)

Pool contains the StatePool functionality used in this package.

type Predicate Uses

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 Uses

func BuildPredicateFor(patterns []string) Predicate

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

type Unit Uses

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

Unit represents a state.Unit.

Package client imports 50 packages (graph) and is imported by 4 packages. Updated 2020-09-30. Refresh now. Tools for package owners.