1+ // Package deis offers a SDK for interacting with the Deis controller API.
2+ //
3+ // This package works by creating a client, which contains session information,
4+ // such as the controller url and user token. The client is then passed to api methods,
5+ // which use it to make requests.
6+ //
7+ // Basic Example
8+ //
9+ // This example creates a client and then lists the apps that the user has access to:
10+ //
11+ // import (
12+ // deis "github.com/deis/controller-sdk-go"
13+ // "github.com/deis/controller-sdk-go/apps"
14+ // )
15+ //
16+ // // Verify SSL, Controller URL, API Token
17+ // client, err := deis.New(true, "deis.test.io", "abc123")
18+ // if err != nil {
19+ // log.Fatal(err)
20+ // }
21+ // apps, _, err := apps.List(client, 100)
22+ // if err != nil {
23+ // log.Fatal(err)
24+ // }
25+ //
26+ // Authentication
27+ //
28+ // If you don't already have a token for a user, you can retrieve one with a
29+ // username and password.
30+ //
31+ // import (
32+ // deis "github.com/deis/controller-sdk-go"
33+ // "github.com/deis/controller-sdk-go/apps"
34+ // )
35+ //
36+ // // Create a client with a blank token to pass to login.
37+ // client, err := deis.New(true, "deis.test.io", "")
38+ // if err != nil {
39+ // log.Fatal(err)
40+ // }
41+ // token, err := auth.Login(client, "user", "password")
42+ // if err != nil {
43+ // log.Fatal(err)
44+ // }
45+ // // Set the client to use the retrieved token
46+ // client.Token = token
47+ //
48+ // Learning More
49+ //
50+ // See the godoc for the SDK's subpackages to learn more about specific SDK actions.
151package deis
252
353import (
@@ -11,26 +61,34 @@ import (
1161
1262// Client oversees the interaction between the deis and controller
1363type Client struct {
14- // HTTP deis used to communicate with the API.
64+ // HTTPClient is the transport that is used to communicate with the API.
1565 HTTPClient * http.Client
1666
1767 // VerifySSL determines whether or not to verify SSL connections.
68+ // This should be true unless you know the controller is using untrusted SSL keys.
1869 VerifySSL bool
1970
20- // URL used to communicate with the controller.
71+ // ControllerURL is the URL used to communicate with the controller.
2172 ControllerURL * url.URL
2273
23- //UserAgent is the user agent used when making requests
74+ // UserAgent is the user agent used when making requests.
2475 UserAgent string
2576
26- //API Version used by the controller, set after a http request.
77+ // API Version used by the controller, set after a http request.
2778 ControllerAPIVersion string
2879
2980 // Token is used to authenticate the request against the API.
3081 Token string
3182}
3283
33- // APIVersion is the api version the sdk is compatible with.
84+ // APIVersion is the api version compatible with the SDK.
85+ //
86+ // In general, using an SDK that is a minor version out of date with the target controller
87+ // is probably safe, as the deis controller api follows semantic versioning and is backward
88+ // compatible. However, using a SDK that is newer or a major version different than the
89+ // controller is unsafe.
90+ //
91+ // If the SDK detects an API version mismatch, it will return ErrAPIMismatch.
3492const APIVersion = "2.1"
3593
3694var (
4199 DefaultUserAgent = fmt .Sprintf ("Deis Go SDK V%s" , APIVersion )
42100)
43101
44- // New creates a new deis to communicate with the api.
102+ // New creates a new client to communicate with the api.
103+ // The controllerURL is the url of the controller component, by default deis.<cluster url>.com
104+ // verifySSL determines whether or not to verify SSL connections.
105+ // This should be true unless you know the controller is using untrusted SSL keys.
45106func New (verifySSL bool , controllerURL string , token string ) (* Client , error ) {
46107 // urlx, unlike the native url library, uses sane defaults when URL parsing,
47108 // preventing issues like missing schemes.
0 commit comments