OLD | NEW |
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 "crypto/tls" | 7 "crypto/tls" |
8 "encoding/json" | 8 "encoding/json" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
11 "io/ioutil" | 11 "io/ioutil" |
12 "net/http" | 12 "net/http" |
13 "net/url" | 13 "net/url" |
14 "os" | 14 "os" |
15 "strings" | 15 "strings" |
16 "time" | 16 "time" |
17 | 17 |
18 "code.google.com/p/go.net/websocket" | 18 "code.google.com/p/go.net/websocket" |
| 19 "github.com/juju/errors" |
19 "github.com/juju/loggo" | 20 "github.com/juju/loggo" |
20 | 21 |
21 "launchpad.net/juju-core/charm" | 22 "launchpad.net/juju-core/charm" |
22 "launchpad.net/juju-core/constraints" | 23 "launchpad.net/juju-core/constraints" |
23 "launchpad.net/juju-core/environs/network" | 24 "launchpad.net/juju-core/environs/network" |
24 "launchpad.net/juju-core/errors" | |
25 "launchpad.net/juju-core/instance" | 25 "launchpad.net/juju-core/instance" |
26 "launchpad.net/juju-core/state/api/params" | 26 "launchpad.net/juju-core/state/api/params" |
27 "launchpad.net/juju-core/tools" | 27 "launchpad.net/juju-core/tools" |
28 "launchpad.net/juju-core/utils" | 28 "launchpad.net/juju-core/utils" |
29 "launchpad.net/juju-core/version" | 29 "launchpad.net/juju-core/version" |
30 ) | 30 ) |
31 | 31 |
32 // Client represents the client-accessible part of the state. | 32 // Client represents the client-accessible part of the state. |
33 type Client struct { | 33 type Client struct { |
34 st *State | 34 st *State |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 var errResult params.ErrorResult | 849 var errResult params.ErrorResult |
850 err = json.Unmarshal(line, &errResult) | 850 err = json.Unmarshal(line, &errResult) |
851 if err != nil { | 851 if err != nil { |
852 return nil, fmt.Errorf("unable to unmarshal initial response: %v
", err) | 852 return nil, fmt.Errorf("unable to unmarshal initial response: %v
", err) |
853 } | 853 } |
854 if errResult.Error != nil { | 854 if errResult.Error != nil { |
855 return nil, errResult.Error | 855 return nil, errResult.Error |
856 } | 856 } |
857 return connection, nil | 857 return connection, nil |
858 } | 858 } |
OLD | NEW |