github.com/lukasheimann/cloudfoundrycli@v7.1.0+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  	Info
    18  
    19  	config Config
    20  
    21  	connection Connection
    22  	router     *internal.Router
    23  	userAgent  string
    24  }
    25  
    26  // NewClient returns a new UAA Client with the provided configuration
    27  func NewClient(config Config) *Client {
    28  	userAgent := fmt.Sprintf("%s/%s (%s; %s %s)",
    29  		config.BinaryName(),
    30  		config.BinaryVersion(),
    31  		runtime.Version(),
    32  		runtime.GOARCH,
    33  		runtime.GOOS,
    34  	)
    35  
    36  	client := Client{
    37  		config: config,
    38  
    39  		connection: NewConnection(config.SkipSSLValidation(), config.UAADisableKeepAlives(), config.DialTimeout()),
    40  		userAgent:  userAgent,
    41  	}
    42  	client.WrapConnection(NewErrorWrapper())
    43  
    44  	return &client
    45  }