Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(358)

Side by Side Diff: state/api/state.go

Issue 13559043: api: Implement RelationUnitsWatcher in client API (Closed)
Patch Set: api: Implement RelationUnitsWatcher in client API Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « state/api/apiclient.go ('k') | state/api/uniter/relation.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package api 4 package api
5 5
6 import ( 6 import (
7 "launchpad.net/juju-core/state/api/agent" 7 "launchpad.net/juju-core/state/api/agent"
8 "launchpad.net/juju-core/state/api/deployer" 8 "launchpad.net/juju-core/state/api/deployer"
9 "launchpad.net/juju-core/state/api/machiner" 9 "launchpad.net/juju-core/state/api/machiner"
10 "launchpad.net/juju-core/state/api/params" 10 "launchpad.net/juju-core/state/api/params"
11 "launchpad.net/juju-core/state/api/uniter" 11 "launchpad.net/juju-core/state/api/uniter"
12 "launchpad.net/juju-core/state/api/upgrader" 12 "launchpad.net/juju-core/state/api/upgrader"
13 ) 13 )
14 14
15 // Login authenticates as the entity with the given name and password. 15 // Login authenticates as the entity with the given name and password.
16 // Subsequent requests on the state will act as that entity. This 16 // Subsequent requests on the state will act as that entity. This
17 // method is usually called automatically by Open. The machine nonce 17 // method is usually called automatically by Open. The machine nonce
18 // should be empty unless logging in as a machine agent. 18 // should be empty unless logging in as a machine agent.
19 func (st *State) Login(tag, password, nonce string) error { 19 func (st *State) Login(tag, password, nonce string) error {
20 » return st.Call("Admin", "", "Login", &params.Creds{ 20 » err := st.Call("Admin", "", "Login", &params.Creds{
21 AuthTag: tag, 21 AuthTag: tag,
22 Password: password, 22 Password: password,
23 Nonce: nonce, 23 Nonce: nonce,
24 }, nil) 24 }, nil)
25 if err == nil {
26 st.authTag = tag
27 }
28 return err
25 } 29 }
26 30
27 // Client returns an object that can be used 31 // Client returns an object that can be used
28 // to access client-specific functionality. 32 // to access client-specific functionality.
29 func (st *State) Client() *Client { 33 func (st *State) Client() *Client {
30 return &Client{st} 34 return &Client{st}
31 } 35 }
32 36
33 // Machiner returns a version of the state that provides functionality 37 // Machiner returns a version of the state that provides functionality
34 // required by the machiner worker. 38 // required by the machiner worker.
35 func (st *State) Machiner() *machiner.State { 39 func (st *State) Machiner() *machiner.State {
36 return machiner.NewState(st) 40 return machiner.NewState(st)
37 } 41 }
38 42
39 // Uniter returns a version of the state that provides functionality 43 // Uniter returns a version of the state that provides functionality
40 // required by the uniter worker. 44 // required by the uniter worker.
41 func (st *State) Uniter() *uniter.State { 45 func (st *State) Uniter() *uniter.State {
42 » return uniter.NewState(st) 46 » return uniter.NewState(st, st.authTag)
43 } 47 }
44 48
45 // Agent returns a version of the state that provides 49 // Agent returns a version of the state that provides
46 // functionality required by the agent code. 50 // functionality required by the agent code.
47 func (st *State) Agent() *agent.State { 51 func (st *State) Agent() *agent.State {
48 return agent.NewState(st) 52 return agent.NewState(st)
49 } 53 }
50 54
51 // Upgrader returns access to the Upgrader API 55 // Upgrader returns access to the Upgrader API
52 func (st *State) Upgrader() *upgrader.State { 56 func (st *State) Upgrader() *upgrader.State {
53 return upgrader.NewState(st) 57 return upgrader.NewState(st)
54 } 58 }
55 59
56 // Deployer returns access to the Deployer API 60 // Deployer returns access to the Deployer API
57 func (st *State) Deployer() *deployer.State { 61 func (st *State) Deployer() *deployer.State {
58 return deployer.NewState(st) 62 return deployer.NewState(st)
59 } 63 }
OLDNEW
« no previous file with comments | « state/api/apiclient.go ('k') | state/api/uniter/relation.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b