github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/builtin/providers/github/config.go (about) 1 package github 2 3 import ( 4 "github.com/google/go-github/github" 5 "golang.org/x/oauth2" 6 ) 7 8 type Config struct { 9 Token string 10 Organization string 11 } 12 13 type Organization struct { 14 name string 15 client *github.Client 16 } 17 18 // Client configures and returns a fully initialized GithubClient 19 func (c *Config) Client() (interface{}, error) { 20 var org Organization 21 org.name = c.Organization 22 ts := oauth2.StaticTokenSource( 23 &oauth2.Token{AccessToken: c.Token}, 24 ) 25 tc := oauth2.NewClient(oauth2.NoContext, ts) 26 27 org.client = github.NewClient(tc) 28 return &org, nil 29 }