github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/uaa/client.go (about)

     1  // Package uaa is a GoLang library that interacts with CloudFoundry User
     2  // Account and Authentication (UAA) Server.
     3  //
     4  // It is currently designed to support UAA API X.X.X. However, it may include
     5  // features and endpoints of later API versions.
     6  package uaa
     7  
     8  import (
     9  	"fmt"
    10  	"runtime"
    11  
    12  	"code.cloudfoundry.org/cli/api/uaa/internal"
    13  )
    14  
    15  // Client is the UAA client
    16  type Client struct {
    17  	config Config
    18  
    19  	connection Connection
    20  	router     *internal.Router
    21  	userAgent  string
    22  }
    23  
    24  // NewClient returns a new UAA Client with the provided configuration
    25  func NewClient(config Config) *Client {
    26  	userAgent := fmt.Sprintf("%s/%s (%s; %s %s)",
    27  		config.BinaryName(),
    28  		config.BinaryVersion(),
    29  		runtime.Version(),
    30  		runtime.GOARCH,
    31  		runtime.GOOS,
    32  	)
    33  
    34  	client := Client{
    35  		config: config,
    36  
    37  		connection: NewConnection(config.SkipSSLValidation(), config.DialTimeout()),
    38  		userAgent:  userAgent,
    39  	}
    40  	client.WrapConnection(NewErrorWrapper())
    41  
    42  	return &client
    43  }