// New creates a build for an app.
427175
func New(c *client.Client, appID string, image string,
	procfile map[string]string) (api.Build, error) {

	u := fmt.Sprintf("/v1/apps/%s/builds/", appID)

	req := api.CreateBuildRequest{Image: image, Procfile: procfile}

	body, err := json.Marshal(req)

	if err != nil {
		return api.Build{}, err
	}

	resBody, err := c.BasicRequest("POST", u, body)

	if err != nil {
		return api.Build{}, err
	}

	build := api.Build{}
	if err = json.Unmarshal([]byte(resBody), &build); err != nil {
		return api.Build{}, err
	}

	return build, nil
}
586251
func New(b *bootstrap.Bootstrapper) iris.Handler {
	return func(ctx iris.Context) {
		// response headers
		ctx.Header("App-Name", b.AppName)
		ctx.Header("App-Owner", b.AppOwner)
		ctx.Header("App-Since", time.Since(b.AppSpawnDate).String())

		ctx.Header("Server", "Iris: https://iris-go.com")

		// view data if ctx.View or c.Tmpl = "$page.html" will be called next.
		ctx.ViewData("AppName", b.AppName)
		ctx.ViewData("AppOwner", b.AppOwner)
		ctx.Next()
	}
}
754650
func New(appName string) (*Checkpoint, error) {
	addr := os.Getenv("REDIS_URL")
	if addr == "" {
		addr = localhost
	}

	client := redis.NewClient(&redis.Options{Addr: addr})

	// verify we can ping server
	_, err := client.Ping().Result()
	if err != nil {
		return nil, err
	}

	return &Checkpoint{
		appName: appName,
		client:  client,
	}, nil
}
137708
func New() (cs *Caddyshack) {
	// Fixme May need to extend later
	cs = &Caddyshack{
		Config:  NewConfig(),
		Caddies: make(map[string]*Caddies),
	}
	return cs
}
1146797
func New(cfg *Config) *Application {
	if cfg == nil {
		cfg = &Config{}
	}

	if cfg.Router == nil {
		cfg.Router = chi.NewRouter()
	}

	if cfg.AssetFS == nil {
		cfg.AssetFS = assetfs.AssetFS()
	}

	return &Application{
		Config: cfg,
	}
}
126827
func New(backend Backend, _ facade.Resources, authorizer facade.Authorizer) (*Facade, error) {
	return &Facade{
		backend: backend,
		getCanModify: func() (common.AuthFunc, error) {
			return authorizer.AuthOwner, nil
		},
	}, nil
}
691513
func New(ctx context.Context, next http.Handler, config config.Chain, builder chainBuilder, name string) (http.Handler, error) {
	middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware")

	middlewareChain := builder.BuildChain(ctx, config.Middlewares)
	return middlewareChain.Then(next)
}
1022506
func New(appuser string, apppass string, baseurl string) (Crowd, error) {
	cr := Crowd{
		Client: http.DefaultClient,
		user:   appuser,
		passwd: apppass,
		url:    baseurl,
	}

	// TODO make sure URL ends with '/'

	cj, err := cookiejar.New(nil)
	if err != nil {
		return cr, err
	}

	cr.cookies = cj

	return cr, nil
}
1175191
func New() (*Conn, error) {
	c := new(Conn)

	if err := c.initConnection(); err != nil {
		return nil, err
	}

	return c, nil
}
72070
func New(conf *config.AppConfig) *server {

	if conf.Insecure {
		acl.SetSkipAuth()
	}

	// create new storage handler
	if err := storage.New(conf.Storage); err != nil {
		log.Fatalf("Could not create storage handler => %s", err.Error())
	}

	// create new locker handler
	if err := locker.New(conf.Locker); err != nil {
		log.Fatalf("Could not create locker handler => %s", err.Error())
	}

	// load ca clients
	client.New(conf.Clients)
	providers.New(conf.Payment)

	lis, err := net.Listen("tcp", conf.Address)
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	log.Infof("Listening on %s", conf.Address)
	return &server{
		listener:   lis,
		grpcServer: newGRPCServer(conf),
	}
}
894655
func New(c *deis.Client, appID string) (api.App, error) {
	body := []byte{}

	if appID != "" {
		req := api.AppCreateRequest{ID: appID}
		b, err := json.Marshal(req)

		if err != nil {
			return api.App{}, err
		}
		body = b
	}

	res, reqErr := c.Request("POST", "/v2/apps/", body)
	if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) {
		return api.App{}, reqErr
	}
	defer res.Body.Close()

	app := api.App{}
	if err := json.NewDecoder(res.Body).Decode(&app); err != nil {
		return api.App{}, err
	}

	return app, reqErr
}
853100
func New(client *docker.Client, conf *config.Config, logger *log.Logger) *API {
	return &API{client, conf, logger, nil}
}
411294
func New() *Application {
	app := new(Application)
	app.router = newRouter()
	app.staticRouter = make(map[string][]string)
	app.View = NewView()
	app.Config = NewConfig()
	app.errorHandler = make(map[int]ErrorHandlerFunc)
	app.middlewareChain = NewChain()
	app.DefaultErrorHandler = defaultErrorHandler
	app.pool.New = func() interface{} {
		return new(Context)
	}
	app.handlerChain = app.middlewareChain.Final(app.handler)
	return app
}
302718
func New(c *client.Client, appID string, domain string) (api.Domain, error) {
	u := fmt.Sprintf("/v1/apps/%s/domains/", appID)

	req := api.DomainCreateRequest{Domain: domain}

	body, err := json.Marshal(req)

	if err != nil {
		return api.Domain{}, err
	}

	resBody, err := c.BasicRequest("POST", u, body)

	if err != nil {
		return api.Domain{}, err
	}

	res := api.Domain{}
	if err = json.Unmarshal([]byte(resBody), &res); err != nil {
		return api.Domain{}, err
	}

	return res, nil
}
468153
func (t *TimeSeries) New(chronograf.Source, chronograf.Logger) (chronograf.TimeSeries, error) {
	return t, nil
}
572669
func New(cfg ...Config) *Typescript {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}

	return &Typescript{Config: &c}
}
874495
func (h *Handle) New() datastore.KVObject {
	h.Lock()
	defer h.Unlock()

	return &Handle{
		app:   h.app,
		store: h.store,
	}
}