// New creates a new Client given a specification. Note that it is the media types
// configured for the site that is used to match files to the correct minifier.
547883
func New(rs *resources.Spec) *Client {
	return &Client{rs: rs, m: minifiers.New(rs.MediaTypes, rs.OutputFormats)}
}
532274
func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error) {
	gopts := []grpc.DialOption{}
	needDialer := true
	needWithInsecure := true
	for _, o := range opts {
		if _, ok := o.(*withFailFast); ok {
			gopts = append(gopts, grpc.FailOnNonTempDialError(true))
		}
		if credInfo, ok := o.(*withCredentials); ok {
			opt, err := loadCredentials(credInfo)
			if err != nil {
				return nil, err
			}
			gopts = append(gopts, opt)
			needWithInsecure = false
		}
		if wt, ok := o.(*withTracer); ok {
			gopts = append(gopts,
				grpc.WithUnaryInterceptor(otgrpc.OpenTracingClientInterceptor(wt.tracer, otgrpc.LogPayloads())),
				grpc.WithStreamInterceptor(otgrpc.OpenTracingStreamClientInterceptor(wt.tracer)))
		}
		if wd, ok := o.(*withDialer); ok {
			gopts = append(gopts, grpc.WithDialer(wd.dialer))
			needDialer = false
		}
	}
	if needDialer {
		dialFn, err := resolveDialer(address)
		if err != nil {
			return nil, err
		}
		// TODO(AkihiroSuda): use WithContextDialer (requires grpc 1.19)
		// https://github.com/grpc/grpc-go/commit/40cb5618f475e7b9d61aa7920ae4b04ef9bbaf89
		gopts = append(gopts, grpc.WithDialer(dialFn))
	}
	if needWithInsecure {
		gopts = append(gopts, grpc.WithInsecure())
	}
	if address == "" {
		address = appdefaults.Address
	}
	conn, err := grpc.DialContext(ctx, address, gopts...)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address)
	}
	c := &Client{
		conn: conn,
	}
	return c, nil
}
385980
func New() *http.Client {
	cli := cleanhttp.DefaultPooledClient()
	cli.Transport = &userAgentRoundTripper{
		userAgent: UserAgentString(),
		inner:     cli.Transport,
	}
	return cli
}
1241264
func New(cfgs ...ConfigFunc) *Client {
	c := &Client{
		http.Client{Transport: http.DefaultTransport},
		*NewAPI(),
	}

	c.APIClient.common.backend.(*defaultBackend).client = &c.client

	for _, cfg := range cfgs {
		cfg(c)
	}

	ForURLPattern(manifold.DefaultURLPattern)(c)

	// We need to do this after we've set the configuration. In case someone
	// provided a UserAgent, it will get loaded and overwrite our defaults since
	// we re-assign the previous transport after this.
	WithUserAgent("")(c)
	WithAPIToken(os.Getenv("MANIFOLD_API_TOKEN"))(c)

	return c
}
1224226
func New(config fab.EndpointConfig, opts ...options.Opt) (*ChannelProvider, error) {
	return &ChannelProvider{
		ctxtCaches: lazycache.New(
			"Client_Context_Cache",
			func(key lazycache.Key) (interface{}, error) {
				ck := key.(*ctxtCacheKey)
				return newContextCache(ck.context, opts), nil
			},
		),
	}, nil
}
1090731
func New(options *AuthOptions, httpClient *http.Client) *Client {
	if httpClient == nil {
		httpClient = http.DefaultClient
	}

	return &Client{
		Options: options,
		Client:  httpClient,
	}
}
113572
func New(cfg *spotinst.Config) *Client {
	if cfg == nil {
		cfg = spotinst.DefaultConfig()
	}
	return &Client{cfg}
}
997715
func New(credentials *auth.Credentials, apiVersion string, logger *log.Logger) *Client {
	return &Client{*http.DefaultClient, MaxSendAttempts, credentials, apiVersion, logger, false}
}
708393
func New(endpoint *url.URL, client *http.Client) *Client {
	if client == nil {
		client = http.DefaultClient
	}

	if len(endpoint.Path) > 0 && !strings.HasSuffix(endpoint.Path, "/") {
		endpoint.Path = endpoint.Path + "/"
	}

	return &Client{client, endpoint, make(http.Header), endpoint.Query(), noOpCacher}
}
155242
func New(rs *resources.Spec, textTemplate tpl.TemplateParseFinder) *Client {
	if rs == nil {
		panic("must provice a resource Spec")
	}
	if textTemplate == nil {
		panic("must provide a textTemplate")
	}
	return &Client{rs: rs, textTemplate: textTemplate}
}
905386
func New(httpClient *http.Client, config Config) (*Client, error) {
	c := NewClient(httpClient)
	c.Config = config

	baseURL, err := url.Parse("https://" + config.Host)

	if err != nil {
		return nil, err
	}

	c.BaseURL = baseURL
	return c, nil
}
1151933
func New(opts ...Opt) *Client {
	c := &Client{
		endpoint:   DefaultEndpoint,
		protocol:   DefaultProtocol,
		httpClient: DefaultHTTPClient,
	}

	for _, opt := range opts {
		opt(c)
	}
	return c
}
460796
func (c *Config) New(proxyTransport *http.Transport, serviceResolver webhook.ServiceResolver) ([]admission.PluginInitializer, server.PostStartHookFunc, error) {
	webhookAuthResolverWrapper := webhook.NewDefaultAuthenticationInfoResolverWrapper(proxyTransport, c.LoopbackClientConfig)
	webhookPluginInitializer := webhookinit.NewPluginInitializer(webhookAuthResolverWrapper, serviceResolver)

	var cloudConfig []byte
	if c.CloudConfigFile != "" {
		var err error
		cloudConfig, err = ioutil.ReadFile(c.CloudConfigFile)
		if err != nil {
			klog.Fatalf("Error reading from cloud configuration file %s: %#v", c.CloudConfigFile, err)
		}
	}
	clientset, err := kubernetes.NewForConfig(c.LoopbackClientConfig)
	if err != nil {
		return nil, nil, err
	}

	discoveryClient := cacheddiscovery.NewMemCacheClient(clientset.Discovery())
	discoveryRESTMapper := restmapper.NewDeferredDiscoveryRESTMapper(discoveryClient)
	kubePluginInitializer := NewPluginInitializer(
		cloudConfig,
		discoveryRESTMapper,
		quotainstall.NewQuotaConfigurationForAdmission(),
	)

	admissionPostStartHook := func(context genericapiserver.PostStartHookContext) error {
		discoveryRESTMapper.Reset()
		go utilwait.Until(discoveryRESTMapper.Reset, 30*time.Second, context.StopCh)
		return nil
	}

	return []admission.PluginInitializer{webhookPluginInitializer, kubePluginInitializer}, admissionPostStartHook, nil
}
1167589
func New(server ...string) *Client {
	ss := new(ServerList)
	ss.SetServers(server...)
	return NewFromSelector(ss)
}
55482
func New(token string) *Client {
	c := &Client{}
	c.Token = token

	c.Keys = &KeyResource{c}
	c.Repos = &RepoResource{c}
	c.Users = &UserResource{c}
	c.Orgs = &OrgResource{c}
	c.Emails = &EmailResource{c}
	c.Hooks = &HookResource{c}
	c.Contents = &ContentResource{c}
	c.RepoKeys = &RepoKeyResource{c}
	c.ApiUrl = "https://api.github.com"
	return c
}
179259
func New(iface netlink.Link, opts ...ClientOpt) (*Client, error) {
	c := &Client{
		iface:   iface,
		timeout: 10 * time.Second,
		retry:   3,
	}

	for _, opt := range opts {
		if err := opt(c); err != nil {
			return nil, err
		}
	}

	if c.conn == nil {
		var err error
		c.conn, err = NewPacketUDPConn(iface.Attrs().Name, ClientPort)
		if err != nil {
			return nil, err
		}
	}
	return c, nil
}
348550
func New(url string) *Client {
	return &Client{
		url:    url,
		logger: log.New(os.Stderr, "[discovery] ", log.LstdFlags),
	}
}