~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/api/agent/state.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import (
7
7
        "fmt"
8
8
 
 
9
        "github.com/juju/errors"
9
10
        "gopkg.in/juju/names.v2"
10
11
 
11
12
        "github.com/juju/juju/api/base"
12
13
        "github.com/juju/juju/api/common"
13
14
        "github.com/juju/juju/api/common/cloudspec"
 
15
        apiwatcher "github.com/juju/juju/api/watcher"
14
16
        "github.com/juju/juju/apiserver/params"
15
17
        "github.com/juju/juju/instance"
16
18
        "github.com/juju/juju/state/multiwatcher"
 
19
        "github.com/juju/juju/watcher"
17
20
)
18
21
 
19
22
// State provides access to an agent's view of the state.
72
75
        return results.Master, err
73
76
}
74
77
 
 
78
// WatchCredential returns a watcher which reports when the specified
 
79
// credential has changed.
 
80
func (c *State) WatchCredential(tag names.CloudCredentialTag) (watcher.NotifyWatcher, error) {
 
81
        var result params.NotifyWatchResult
 
82
        err := c.facade.FacadeCall("WatchCredential", nil, &result)
 
83
        if err != nil {
 
84
                return nil, errors.Trace(err)
 
85
        }
 
86
        if result.Error != nil {
 
87
                return nil, result.Error
 
88
        }
 
89
        return apiwatcher.NewNotifyWatcher(c.facade.RawAPICaller(), result), nil
 
90
}
 
91
 
75
92
type Entity struct {
76
93
        st  *State
77
94
        tag names.Tag