github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/oneandone/config.go (about)

     1  package oneandone
     2  
     3  import (
     4  	"github.com/1and1/oneandone-cloudserver-sdk-go"
     5  )
     6  
     7  type Config struct {
     8  	Token    string
     9  	Retries  int
    10  	Endpoint string
    11  	API      *oneandone.API
    12  }
    13  
    14  func (c *Config) Client() (*Config, error) {
    15  	token := oneandone.SetToken(c.Token)
    16  
    17  	if len(c.Endpoint) > 0 {
    18  		c.API = oneandone.New(token, c.Endpoint)
    19  	} else {
    20  		c.API = oneandone.New(token, oneandone.BaseUrl)
    21  	}
    22  
    23  	return c, nil
    24  }