1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/version"
8
"gopkg.in/juju/charm.v6-unstable"
9
"gopkg.in/juju/names.v2"
11
"github.com/juju/juju/constraints"
12
"github.com/juju/juju/core/description"
13
"github.com/juju/juju/environs/config"
14
"github.com/juju/juju/instance"
15
"github.com/juju/juju/network"
16
"github.com/juju/juju/state"
17
"github.com/juju/juju/status"
20
// Unit represents a state.Unit.
22
status.StatusHistoryGetter
26
PublicAddress() (network.Address, error)
27
PrivateAddress() (network.Address, error)
28
Resolve(retryHooks bool) error
29
AgentHistory() status.StatusHistoryGetter
32
// Backend contains the state.State methods used in this package,
33
// allowing stubs to be created for testing.
34
type Backend interface {
35
FindEntity(names.Tag) (state.Entity, error)
36
Unit(string) (Unit, error)
37
Application(string) (*state.Application, error)
38
Machine(string) (*state.Machine, error)
39
AllMachines() ([]*state.Machine, error)
40
AllApplications() ([]*state.Application, error)
41
AllRelations() ([]*state.Relation, error)
42
AddOneMachine(state.MachineTemplate) (*state.Machine, error)
43
AddMachineInsideMachine(state.MachineTemplate, string, instance.ContainerType) (*state.Machine, error)
44
AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error)
45
ModelConstraints() (constraints.Value, error)
46
ModelConfig() (*config.Config, error)
47
ModelConfigValues() (config.ConfigValues, error)
48
UpdateModelConfig(map[string]interface{}, []string, state.ValidateConfigFunc) error
49
SetModelConstraints(constraints.Value) error
51
ModelTag() names.ModelTag
52
Model() (*state.Model, error)
53
ForModel(tag names.ModelTag) (*state.State, error)
54
SetModelAgentVersion(version.Number) error
55
SetAnnotations(state.GlobalEntity, map[string]string) error
56
Annotations(state.GlobalEntity) (map[string]string, error)
57
InferEndpoints(...string) ([]state.Endpoint, error)
58
EndpointsRelation(...state.Endpoint) (*state.Relation, error)
59
Charm(*charm.URL) (*state.Charm, error)
60
LatestPlaceholderCharm(*charm.URL) (*state.Charm, error)
61
AddRelation(...state.Endpoint) (*state.Relation, error)
62
AddModelUser(state.UserAccessSpec) (description.UserAccess, error)
63
AddControllerUser(state.UserAccessSpec) (description.UserAccess, error)
64
RemoveUserAccess(names.UserTag, names.Tag) error
65
Watch() *state.Multiwatcher
66
AbortCurrentUpgrade() error
67
APIHostPorts() ([][]network.HostPort, error)
68
LatestModelMigration() (state.ModelMigration, error)
71
func NewStateBackend(st *state.State) Backend {
75
type stateShim struct {
79
func (s stateShim) Unit(name string) (Unit, error) {
80
u, err := s.State.Unit(name)