-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 206b766
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
ligo | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module github.com/kzap/ligo | ||
|
||
require ( | ||
github.com/linode/linodego v0.5.2-0.20180916222121-15d4ab6c221b | ||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be | ||
gopkg.in/resty.v1 v1.9.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
github.com/linode/linodego v0.5.2-0.20180916222121-15d4ab6c221b h1:1oeOtCnxd4Fi9qWnUr0v/k1XURvWdEPGDyJLbHg4b6o= | ||
github.com/linode/linodego v0.5.2-0.20180916222121-15d4ab6c221b/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= | ||
golang.org/x/net v0.0.0-20180611182652-db08ff08e862 h1:JZi6BqOZ+iSgmLWe6llhGrNnEnK+YB/MRkStwnEfbqM= | ||
golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= | ||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | ||
gopkg.in/resty.v1 v1.9.1 h1:Lq4EIBZ5e2J4ZWp22W2hVOYc0X1qwDDki/nNVchRbdw= | ||
gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/linode/linodego" | ||
"golang.org/x/oauth2" | ||
|
||
"log" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func main() { | ||
apiKey, ok := os.LookupEnv("LINODE_TOKEN") | ||
if !ok { | ||
log.Fatal("Could not find LINODE_TOKEN, please assert it is set.") | ||
} | ||
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey}) | ||
|
||
oauth2Client := &http.Client{ | ||
Transport: &oauth2.Transport{ | ||
Source: tokenSource, | ||
}, | ||
} | ||
|
||
linodeClient := linodego.NewClient(oauth2Client) | ||
linodeClient.SetDebug(true) | ||
|
||
res, err := linodeClient.GetInstance(context.Background(), 4090913) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Printf("%v", res) | ||
} |