Skip to content

Commit 44e4040

Browse files
docs(README): Add a proper README (#17)
1 parent eb17597 commit 44e4040

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1-
# controller-sdk-go
2-
The Go SDK for the Deis Controller API
1+
# Controller Go SDK
2+
[![Build Status](https://travis-ci.org/deis/controller-sdk-go.svg?branch=master)](https://travis-ci.org/deis/controller-sdk-go)
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/deis/controller-sdk-go)](https://goreportcard.com/report/github.com/deis/controller-sdk-go)
4+
[![codebeat badge](https://codebeat.co/badges/2fdee091-714d-4860-ab19-dba7587a3158)](https://codebeat.co/projects/github-com-deis-controller-sdk-go)
5+
[![GoDoc](https://godoc.org/github.com/deis/controller-sdk-go?status.svg)](https://godoc.org/github.com/deis/controller-sdk-go)
6+
7+
This is the Go SDK for interacting with the [Deis Controller](https://github.com/deis/controller).
8+
9+
### Usage
10+
11+
```go
12+
import deis "github.com/deis/controller-sdk-go"
13+
import "github.com/deis/controller-sdk-go/apps"
14+
```
15+
16+
Construct a deis client to interact with the controller API. Then, get the first 100 apps the user has access to.
17+
18+
```go
19+
// Verify SSL, Controller URL, API Token
20+
client, err := deis.New(true, "deis.test.io", "abc123")
21+
if err != nil {
22+
log.Fatal(err)
23+
}
24+
apps, _, err := apps.List(client, 100)
25+
if err != nil {
26+
log.Fatal(err)
27+
}
28+
```
29+
30+
### Authentication
31+
32+
```go
33+
import deis "github.com/deis/controller-sdk-go"
34+
import "github.com/deis/controller-sdk-go/auth"
35+
```
36+
37+
If you don't already have a token for a user, you can retrieve one with a username and password.
38+
39+
```go
40+
// Create a client with a blank token to pass to login.
41+
client, err := deis.New(true, "deis.test.io", "")
42+
if err != nil {
43+
log.Fatal(err)
44+
}
45+
token, err := auth.Login(client, "user", "password")
46+
if err != nil {
47+
log.Fatal(err)
48+
}
49+
// Set the client to use the retrieved token
50+
client.Token = token
51+
```
52+
53+
For a complete usage guide to the SDK, see [full package documentation](https://godoc.org/github.com/deis/controller-sdk-go).

0 commit comments

Comments
 (0)