OLD | NEW |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "errors" | 4 "errors" |
5 | 5 |
6 "launchpad.net/gnuflag" | 6 "launchpad.net/gnuflag" |
7 "launchpad.net/juju-core/cmd" | 7 "launchpad.net/juju-core/cmd" |
8 "launchpad.net/juju-core/juju" | 8 "launchpad.net/juju-core/juju" |
| 9 "launchpad.net/juju-core/state/api/params" |
9 "launchpad.net/juju-core/state/statecmd" | 10 "launchpad.net/juju-core/state/statecmd" |
10 ) | 11 ) |
11 | 12 |
12 // GetCommand retrieves the configuration of a service. | 13 // GetCommand retrieves the configuration of a service. |
13 type GetCommand struct { | 14 type GetCommand struct { |
14 EnvName string | 15 EnvName string |
15 ServiceName string | 16 ServiceName string |
16 out cmd.Output | 17 out cmd.Output |
17 } | 18 } |
18 | 19 |
(...skipping 24 matching lines...) Expand all Loading... |
43 | 44 |
44 // Run fetches the configuration of the service and formats | 45 // Run fetches the configuration of the service and formats |
45 // the result as a YAML string. | 46 // the result as a YAML string. |
46 func (c *GetCommand) Run(ctx *cmd.Context) error { | 47 func (c *GetCommand) Run(ctx *cmd.Context) error { |
47 conn, err := juju.NewConnFromName(c.EnvName) | 48 conn, err := juju.NewConnFromName(c.EnvName) |
48 if err != nil { | 49 if err != nil { |
49 return err | 50 return err |
50 } | 51 } |
51 defer conn.Close() | 52 defer conn.Close() |
52 | 53 |
53 » params := statecmd.ServiceGetParams{ | 54 » params := params.ServiceGet{ |
54 ServiceName: c.ServiceName, | 55 ServiceName: c.ServiceName, |
55 } | 56 } |
56 | 57 |
57 results, err := statecmd.ServiceGet(conn.State, params) | 58 results, err := statecmd.ServiceGet(conn.State, params) |
58 if err != nil { | 59 if err != nil { |
59 return err | 60 return err |
60 } | 61 } |
61 | 62 |
62 resultsMap := map[string]interface{}{ | 63 resultsMap := map[string]interface{}{ |
63 "service": results.Service, | 64 "service": results.Service, |
64 "charm": results.Charm, | 65 "charm": results.Charm, |
65 "settings": results.Settings, | 66 "settings": results.Settings, |
66 } | 67 } |
67 return c.out.Write(ctx, resultsMap) | 68 return c.out.Write(ctx, resultsMap) |
68 } | 69 } |
OLD | NEW |