This repository has been archived by the owner on Jun 15, 2019. It is now read-only.
/
state.go
59 lines (50 loc) · 1.72 KB
/
state.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package api
import (
"launchpad.net/juju-core/state/api/agent"
"launchpad.net/juju-core/state/api/deployer"
"launchpad.net/juju-core/state/api/machiner"
"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/state/api/uniter"
"launchpad.net/juju-core/state/api/upgrader"
)
// 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 (st *State) Login(tag, password, nonce string) error {
return st.Call("Admin", "", "Login", ¶ms.Creds{
AuthTag: tag,
Password: password,
Nonce: nonce,
}, nil)
}
// Client returns an object that can be used
// to access client-specific functionality.
func (st *State) Client() *Client {
return &Client{st}
}
// Machiner returns a version of the state that provides functionality
// required by the machiner worker.
func (st *State) Machiner() *machiner.State {
return machiner.NewState(st)
}
// Uniter returns a version of the state that provides functionality
// required by the uniter worker.
func (st *State) Uniter() *uniter.State {
return uniter.NewState(st)
}
// Agent returns a version of the state that provides
// functionality required by the agent code.
func (st *State) Agent() *agent.State {
return agent.NewState(st)
}
// Upgrader returns access to the Upgrader API
func (st *State) Upgrader() *upgrader.State {
return upgrader.NewState(st)
}
// Deployer returns access to the Deployer API
func (st *State) Deployer() *deployer.State {
return deployer.NewState(st)
}