// NewClient returns an HTTP Client adding Zipkin instrumentation around an
// embedded standard Go http.Client.
15274
func NewClient(tracer *zipkin.Tracer, options ...ClientOption) (*Client, error) {
	if tracer == nil {
		return nil, ErrValidTracerRequired
	}

	c := &Client{tracer: tracer, Client: &http.Client{}}
	for _, option := range options {
		option(c)
	}

	c.transportOptions = append(
		c.transportOptions,
		// the following Client settings override provided transport settings.
		RoundTripper(c.Client.Transport),
		TransportTrace(c.httpTrace),
	)
	transport, err := NewTransport(tracer, c.transportOptions...)
	if err != nil {
		return nil, err
	}
	c.Client.Transport = transport

	return c, nil
}
542870
func NewClient(pkey, skey string) (*Client, error) {
	switch {
	case pkey == "" && skey == "":
		return nil, ErrInvalidKey
	case pkey != "" && !strings.HasPrefix(pkey, "pkey_"):
		return nil, ErrInvalidKey
	case skey != "" && !strings.HasPrefix(skey, "skey_"):
		return nil, ErrInvalidKey
	}

	client := &Client{
		Client: &http.Client{Transport: transport},
		debug:  false,
		pkey:   pkey,
		skey:   skey,

		Endpoints: map[internal.Endpoint]string{},
	}

	if len(build.Default.ReleaseTags) > 0 {
		client.GoVersion = build.Default.ReleaseTags[len(build.Default.ReleaseTags)-1]
	}

	return client, nil
}
1242094
func NewClient(key string, secret string, region *Region) *Client {
	return &Client{
		keys:          &aws4.Keys{AccessKey: key, SecretKey: secret},
		httpClient:    http.DefaultClient,
		pollingClient: http.DefaultClient,
		Region:        region,
	}
}
1184659
func NewClient(accessKeyId, accessKeySecret string) *Client {
	client := &Client{}
	client.Init(END_POINT, VERSION, accessKeyId, accessKeySecret)
	return client
}
1169076
func NewClient(httpClient *http.Client, endpoint, apiVersion string, tlsConfig *tls.Config) (*Client, error) {
	if endpoint == "" {
		return nil, errors.New("endpoint missing for httpClient configuration")
	}
	if apiVersion == "" {
		apiVersion = DefaultAPIVersion
	}

	if tlsConfig != nil {
		tlsConfig.Renegotiation = tls.RenegotiateFreelyAsClient
		tlsConfig.BuildNameToCertificate()
		httpClient.Transport = &http.Transport{TLSClientConfig: tlsConfig}
	}

	return &Client{
		endpoint:   endpoint,
		apiVersion: apiVersion,
		httpClient: httpClient,
	}, nil
}
1126099
func NewClient() (*Client, error) {
	cc := ClientConfig{
		ChunkSize:   1420,
		Compression: COMP_GZIP,
	}
	return NewClientWithConfig(cc)
}
438332
func NewClient(host string) (*Client, error) {
	if host == "" {
		host = DefaultSockPath()
	}
	tmp := strings.SplitN(host, "://", 2)
	if len(tmp) != 2 {
		return nil, fmt.Errorf("invalid host format '%s'", host)
	}

	switch tmp[0] {
	case "tcp":
		if _, err := url.Parse("tcp://" + tmp[1]); err != nil {
			return nil, err
		}
		host = "http://" + tmp[1]
	case "unix":
		host = tmp[1]
	}

	transport := configureTransport(nil, tmp[0], host)
	httpClient := &http.Client{Transport: transport}
	clientTrans := runtime_client.NewWithClient(tmp[1], clientapi.DefaultBasePath,
		clientapi.DefaultSchemes, httpClient)
	return &Client{*clientapi.New(clientTrans, strfmt.Default)}, nil
}
1245933
func NewClient(config *Config) (*APIClient, error) {
	if err := config.Verify(); err != nil {
		return nil, err
	}

	// Get http client based on the selected authentication scheme
	client, resp := newHTTPClient(config)
	if resp.Error != nil {
		return nil, resp.Error
	}

	return &APIClient{
		Config:     *config,
		HTTPClient: client,
	}, nil

}
86752
func NewClient(accessKeyId, accessKeySecret string) *Client {
	return &Client{
		AccessKeyId:     accessKeyId,
		AccessKeySecret: accessKeySecret,
		endpoint:        CSDefaultEndpoint,
		Version:         CSAPIVersion,
		httpClient:      &http.Client{},
	}
}
1156203
func newClient() *http.Client {
	jar, _ := cookiejar.New(nil)
	transport := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
	return &http.Client{
		Jar:       jar,
		Transport: transport,
		Timeout:   2 * time.Minute,
	}
}
155514
func NewClient(
	tgt *url.URL,
	method string,
	options ...ClientOption,
) *Client {
	c := &Client{
		client:         http.DefaultClient,
		method:         method,
		tgt:            tgt,
		enc:            DefaultRequestEncoder,
		dec:            DefaultResponseDecoder,
		before:         []httptransport.RequestFunc{},
		after:          []httptransport.ClientResponseFunc{},
		requestID:      NewAutoIncrementID(0),
		bufferedStream: false,
	}
	for _, option := range options {
		option(c)
	}
	return c
}
1321697
func NewClient(c *http.Client) *Client {
	return &Client{Transport: &Transport{Client: c}}
}
895541
func NewClient(clientConfig ClientConfig) *Client {
	client := &Client{
		ClientConfig: clientConfig,
	}

	// If reader is nil use default rand.Reader
	if clientConfig.Reader == nil {
		client.Reader = rand.Reader
	}

	// If hash is nil use default sha256
	if clientConfig.Hash == nil {
		client.Hash = sha256.New()
	}

	return client
}
563700
func NewClient(
	method string,
	tgt *url.URL,
	enc EncodeRequestFunc,
	dec DecodeResponseFunc,
	options ...ClientOption,
) *Client {
	c := &Client{
		client:         http.DefaultClient,
		method:         method,
		tgt:            tgt,
		enc:            enc,
		dec:            dec,
		before:         []RequestFunc{},
		after:          []ClientResponseFunc{},
		bufferedStream: false,
	}
	for _, option := range options {
		option(c)
	}
	return c
}
512902
func NewClient(authToken string) Client {
	return Client{
		AuthToken: authToken,
		BaseURL:   defaultBaseURL,
		Transport: http.DefaultTransport,
	}
}
410358
func NewClient() *Client {
	c := new(Client)
	c.SetSoftwareName(DefaultSoftwareName)
	c.logger = NewLogger()
	return c
}
580173
func NewClient(endpoint string) (*Client, error) {
	u, err := parseEndpoint(endpoint)
	if err != nil {
		return nil, err
	}

	return &Client{
		HTTPClient:  &http.Client{Timeout: time.Duration(5 * time.Second)},
		endpoint:    endpoint,
		endpointURL: u,
	}, nil
}