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

Unified Diff: juju/api.go

Issue 12943045: juju: juju.NewAPIClientFromName
Patch Set: juju: juju.NewAPIClientFromName Created 11 years, 7 months ago
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cmd/juju/addunit.go ('k') | juju/apiconn_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: juju/api.go
=== modified file 'juju/api.go'
--- juju/api.go 2013-08-25 10:52:51 +0000
+++ juju/api.go 2013-08-28 07:14:38 +0000
@@ -50,12 +50,17 @@
return c.State.Close()
}
-// NewAPIConnFromName returns an APIConn pointing at the environName
-// environment, or the default environment if not specified.
-func NewAPIConnFromName(environName string) (*APIConn, error) {
+// NewAPIClientFromName returns an api.Client connected to the API Server for
+// the environName environment. If environName is "" the default environment
+// will be used.
+func NewAPIClientFromName(environName string) (*api.Client, error) {
environ, err := environs.NewFromName(environName)
if err != nil {
return nil, err
}
- return NewAPIConn(environ, api.DefaultDialOpts())
+ apiconn, err := NewAPIConn(environ, api.DefaultDialOpts())
+ if err != nil {
+ return nil, err
+ }
+ return apiconn.State.Client(), nil
}
« no previous file with comments | « cmd/juju/addunit.go ('k') | juju/apiconn_test.go » ('j') | no next file with comments »

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