// Creates a new client for communicating with Cloudstack
356550
func (cloudstack CloudstackClient) New(apiurl string, apikey string, secretkey string, insecureskipverify bool) *CloudstackClient {
	c := &CloudstackClient{
		client: &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: &tls.Config{InsecureSkipVerify: insecureskipverify},
				Proxy:           http.ProxyFromEnvironment,
			},
		},
		BaseURL:   apiurl,
		APIKey:    apikey,
		SecretKey: secretkey,
	}
	return c
}
214554
func NewClient(conn io.ReadWriteCloser) *Client {
	encBuf := bufio.NewWriter(conn)
	client := &gobClientCodec{conn, gob.NewDecoder(conn), gob.NewEncoder(encBuf), encBuf}
	return NewClientWithCodec(client)
}
1179008
func NewClient(appID, apiKey string) *Client {
	return NewClientWithConfig(
		Configuration{
			AppID:  appID,
			APIKey: apiKey,
		},
	)
}
1212336
func NewClient(
	ctx context.Context,
	gcKeyFile string,
	projectID string,
	options ...interface{},
) (*Client, error) {
	queueSize := OptionUploaderQueueSizeDefault
	errorHandler := OptionUploaderErrorHandlerDefault
	ensureDataset := OptionEnsureDatasetWhenFirstUploadDefault
	ensureTable := OptionEnsureTableWhenFirstUploadDefault
	for _, option := range options {
		switch opt := option.(type) {
		case OptionUploaderQueueSize:
			queueSize = opt
		case OptionUploaderErrorHandler:
			errorHandler = opt
		case OptionEnsureDatasetWhenFirstUpload:
			ensureDataset = opt
		case OptionEnsureTableWhenFirstUpload:
			ensureTable = opt
		default:
			return nil, ErrUnknownOption2.New(nil, option, opt)
		}
	}

	client, err := bigquery.NewClient(
		ctx,
		projectID,
		option.WithServiceAccountFile(gcKeyFile),
	)
	if err != nil {
		return nil, err
	}

	msgQueue := make(chan uploadMessage, queueSize)
	go startUploaderLoop(ctx, msgQueue, errorHandler)

	return &Client{
		ctx:           ctx,
		client:        client,
		msgQueue:      msgQueue,
		ensureDataset: ensureDataset,
		ensureTable:   ensureTable,
	}, nil
}
854638
func NewClient(baseAddr string) *Client {
	return &Client{
		baseAddr: baseAddr,
		client:   &http.Client{},
	}
}
104984
func NewClient(config Config) *Client {
	userAgent := fmt.Sprintf("%s/%s (%s; %s %s)",
		config.AppName,
		config.AppVersion,
		runtime.Version(),
		runtime.GOARCH,
		runtime.GOOS,
	)
	client := Client{
		userAgent:  userAgent,
		connection: NewConnection(config.SkipSSLValidation, config.DialTimeout),
	}

	return &client
}
967847
func NewClient(opts ClientOptions) (*Client, error) {
	err := opts.ensure()
	if err != nil {
		return nil, err
	}

	return &Client{
		logger: log.Get(PkgName),
		opts:   opts,
	}, nil
}
1126099
func NewClient() (*Client, error) {
	cc := ClientConfig{
		ChunkSize:   1420,
		Compression: COMP_GZIP,
	}
	return NewClientWithConfig(cc)
}
1358646
func (k *Kite) NewClient(remoteURL string) *Client {
	c := &Client{
		LocalKite:          k,
		URL:                remoteURL,
		disconnect:         make(chan struct{}),
		closeChan:          make(chan struct{}),
		redialBackOff:      forever,
		scrubber:           dnode.NewScrubber(),
		testHookSetSession: nopSetSession,
		Concurrent:         true,
		send:               make(chan *message),
		interrupt:          make(chan error, 1),
		ctx:                context.Background(),
		cancel:             func() {},
	}

	c.OnConnect(c.setContext)
	c.OnDisconnect(c.closeContext)

	k.OnRegister(c.updateAuth)

	return c
}
151461
func NewClient(caller base.APICaller) *Client {
	facadeCaller := base.NewFacadeCaller(caller, "CAASOperator")
	return &Client{
		facade:       facadeCaller,
		APIAddresser: common.NewAPIAddresser(facadeCaller),
	}
}
1340280
func NewClient(conn net.Conn, host string) (*Client, error) {
	text := textproto.NewConn(conn)
	line, err := text.ReadLine()
	if err != nil {
		text.Close()
		return nil, err
	}
	if !strings.Contains(line, "ustack") {
		text.Close()
		return nil, fmt.Errorf("Not a ustackd server")
	}
	return &Client{Text: text, conn: conn, host: host}, nil
}
863965
func NewClient(conf ClientConfig) (*Client, error) {
	if conf.SampleRate == 0 {
		conf.SampleRate = defaultSampleRate
	}
	if conf.APIHost == "" {
		conf.APIHost = defaultAPIHost
	}
	if conf.Dataset == "" {
		conf.Dataset = defaultDataset
	}

	c := &Client{
		logger: conf.Logger,
	}
	c.ensureLogger()

	if conf.Transmission == nil {
		c.transmission = &transmission.Honeycomb{
			MaxBatchSize:         DefaultMaxBatchSize,
			BatchTimeout:         DefaultBatchTimeout,
			MaxConcurrentBatches: DefaultMaxConcurrentBatches,
			PendingWorkCapacity:  DefaultPendingWorkCapacity,
			UserAgentAddition:    UserAgentAddition,
			Logger:               c.logger,
			Metrics:              sd,
		}
	} else {
		c.transmission = conf.Transmission
	}
	if err := c.transmission.Start(); err != nil {
		c.logger.Printf("transmission client failed to start: %s", err.Error())
		return nil, err
	}

	c.builder = &Builder{
		WriteKey:   conf.APIKey,
		Dataset:    conf.Dataset,
		SampleRate: conf.SampleRate,
		APIHost:    conf.APIHost,
		dynFields:  make([]dynamicField, 0, 0),
		fieldHolder: fieldHolder{
			data: make(map[string]interface{}),
		},
		client: c,
	}

	return c, nil
}
409550
func NewClient(region common.Region, internal bool, accessKeyId, accessKeySecret string) *Client {
	endpoint := os.Getenv("SLS_ENDPOINT")
	if endpoint == "" {
		endpoint = SLSDefaultEndpoint
	}
	return NewClientWithEndpoint(endpoint, region, internal, accessKeyId, accessKeySecret)
}
164123
func (d *Dispatcher) NewFuncClient(c *Client) *DispatcherClient {
	if len(d.serviceMap) == 0 || d.serviceMap[""] == nil {
		logPanic("gorpc.Dispatcher: register at least one function with AddFunc() before calling NewFuncClient()")
	}

	return &DispatcherClient{
		c: c,
	}
}
559543
func NewClient(host string, port int) (client *Client, err error) {
	client = new(Client)
	client.Host = host
	client.Port = port
	client.Connection, err = net.Dial("tcp", fmt.Sprintf("%v:%v", client.Host, client.Port))
	return
}
1111977
func NewClient(opts ...ClientOpt) *Client {
	c := &Client{
		run:          run,
		declarations: make([]Declaration, 0),
		consumers:    make(map[*Consumer]struct{}),
		publishers:   make(map[*Publisher]struct{}),
		errs:         make(chan error, 100),
		blocking:     make(chan amqp.Blocking, 10),
	}

	for _, o := range opts {
		o(c)
	}
	return c
}
1345598
func NewClient(clientID string, secret string, APIBase string) (*Client, error) {
	if clientID == "" || secret == "" || APIBase == "" {
		return nil, errors.New("ClientID, Secret and APIBase are required to create a Client")
	}

	return &Client{
		Client:   &http.Client{},
		ClientID: clientID,
		Secret:   secret,
		APIBase:  APIBase,
	}, nil
}