// NewStaticVar node constructor
174322
func NewStaticVar(Variable node.Node, Expr node.Node) *StaticVar {
	return &StaticVar{
		FreeFloating: nil,
		Variable:     Variable,
		Expr:         Expr,
	}
}
1156067
func newStaticAssetsHandler(dir string, baseHRef string) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		acceptHTML := false
		for _, acceptType := range strings.Split(r.Header.Get("Accept"), ",") {
			if acceptType == "text/html" || acceptType == "html" {
				acceptHTML = true
				break
			}
		}
		fileRequest := r.URL.Path != "/index.html" && strings.Contains(r.URL.Path, ".")

		// serve index.html for non file requests to support HTML5 History API
		if acceptHTML && !fileRequest && (r.Method == "GET" || r.Method == "HEAD") {
			for k, v := range noCacheHeaders {
				w.Header().Set(k, v)
			}
			indexHtmlPath, err := indexFilePath(path.Join(dir, "index.html"), baseHRef)
			if err != nil {
				http.Error(w, fmt.Sprintf("Unable to access index.html: %v", err), http.StatusInternalServerError)
				return
			}
			http.ServeFile(w, r, indexHtmlPath)
		} else {
			http.ServeFile(w, r, path.Join(dir, r.URL.Path))
		}
	}
}
24475
func NewStatsClient(host string) (*statsClient, error) {
	c, err := statsd.NewBuffered(host, bufferLen)
	if err != nil {
		return nil, err
	}

	return &statsClient{
		client: c,
		logger: logger.NopLogger,
	}, nil
}
1126566
func GetStatusVars() (map[string]*StatusVal, error) {
	statusVars := make(map[string]*StatusVal)

	for _, statistics := range statisticsList {
		vals, err := statistics.Stats()
		if err != nil {
			return nil, errors.Trace(err)
		}

		for name, val := range vals {
			scope := statistics.GetScope(name)
			statusVars[name] = &StatusVal{Value: val, Scope: scope}
		}
	}

	return statusVars, nil
}
169211
func NewStaticAWSService(id string, secret string) AWSService {
	s := session.New(&aws.Config{Credentials: credentials.NewStaticCredentials(id, secret, ""), Region: &awsRegion})

	return &RealAWSService{
		elbc: elb.New(s),
		r53c: route53.New(s),
		ec2:  ec2.New(s),
	}
}
1022762
func NewStatsd(addr, prefix string) (*Statsd, error) {
	c, err := statsd.NewClient(addr, prefix)
	if err != nil {
		return nil, err
	}
	return &Statsd{
		client: c,
	}, nil
}
756451
func NewStaticRetryableError(err error, maxAttempts, waitSeconds int) RetryableError {
	return &staticRetryableError{err, maxAttempts, time.Duration(waitSeconds)}
}
308419
func NewSetVariableValueArgs(scopeNumber int, variableName string, newValue runtime.CallArgument, callFrameID CallFrameID) *SetVariableValueArgs {
	args := new(SetVariableValueArgs)
	args.ScopeNumber = scopeNumber
	args.VariableName = variableName
	args.NewValue = newValue
	args.CallFrameID = callFrameID
	return args
}
769708
func newStatusInfo(node *core.Node) *statusInfo {
	out := statusInfo{
		node:    node,
		watches: make(map[int64]ResponseWatch),
	}
	return &out
}
307132
func newStatsProvider(
	cadvisor cadvisor.Interface,
	podManager kubepod.Manager,
	runtimeCache kubecontainer.RuntimeCache,
	containerStatsProvider containerStatsProvider,
) *StatsProvider {
	return &StatsProvider{
		cadvisor:               cadvisor,
		podManager:             podManager,
		runtimeCache:           runtimeCache,
		containerStatsProvider: containerStatsProvider,
	}
}
438084
func (fs *FlagSet) StringVar(p *string, names []string, value string, usage string) {
	fs.Var(newStringValue(value, p), names, usage)
}
1290192
func NewStatsdProvider(s *statsd.Statsd, stop func()) Provider {
	return &statsdProvider{
		s:    s,
		stop: stop,
	}
}
556138
func NewStatusFormatter(status *params.FullStatus, isoTime bool) *statusFormatter {
	return newStatusFormatter(
		newStatusFormatterParams{
			status:        status,
			isoTime:       isoTime,
			showRelations: true,
		})
}
9235
func NewStatusCheck(Name string, Tags []string) *StatusCheck {
	return &StatusCheck{InterMetric{Name: Name, Tags: Tags}}
}
795607
func NewStaticCredentials(projectID, privateKeyID, privateKey, clientEmail, clientID string) *Credentials {
	_, err := url.ParseQuery(clientEmail)
	if err != nil {
		return nil
	}
	return NewCredentials(&StaticProvider{Value: Value{
		Type:                    "service_account",
		ProjectID:               projectID,
		PrivateKeyID:            privateKeyID,
		PrivateKey:              privateKey,
		ClientEmail:             clientEmail,
		ClientID:                clientID,
		AuthURI:                 "https://accounts.google.com/o/oauth2/auth",
		TokenURI:                "https://accounts.google.com/o/oauth2/token",
		AuthProviderX509CertURL: "https://www.googleapis.com/oauth2/v1/certs",
		ClientX509CertURL:       fmt.Sprintf("https://www.googleapis.com/robot/v1/metadata/x509/%s", url.QueryEscape(clientEmail)),
	}})

}
715221
func NewStatter(statsdURL, statsPrefix string) (*LoggingStatter, error) {
	stats, err := statsd.NewClient(statsdURL, statsPrefix)
	if err != nil {
		return nil, err
	}
	return &LoggingStatter{Statter: stats}, nil
}
1283
func NewStatsClient(cr statscollector.Collector) (StatsClient, error) {

	sc := &statsClient{
		collector:     cr,
		rpchdl:        rpcwrapper.NewRPCWrapper(),
		secret:        os.Getenv(constants.EnvStatsSecret),
		statsChannel:  os.Getenv(constants.EnvStatsChannel),
		statsInterval: defaultStatsIntervalMiliseconds * time.Millisecond,
		userRetention: defaultUserRetention * time.Minute,
		stop:          make(chan bool),
	}

	if sc.statsChannel == "" {
		return nil, errors.New("no path to stats socket provided")
	}

	if sc.secret == "" {
		return nil, errors.New("no secret provided for stats channel")
	}

	return sc, nil
}