// New returns a session for the given name without adding it to the registry.
502638
func (m *mongoStore) New(r *http.Request, name string) (*gSessions.Session, error) {
	session := gSessions.NewSession(m, name)
	session.Options = &gSessions.Options{
		Path:   m.options.Path,
		MaxAge: m.options.MaxAge,
	}
	session.IsNew = true
	var err error
	if cook, errToken := m.Token.GetToken(r, name); errToken == nil {
		err = securecookie.DecodeMulti(name, cook, &session.ID, m.Codecs...)
		if err == nil {
			ok, err := m.load(session)
			session.IsNew = !(err == nil && ok) // not new if no error and data available
		}
	}
	return session, err
}
611919
func (z *zones) New(name string) (dnsprovider.Zone, error) {
	a := &zone{
		dnsView: z.dnsView,
		zoneInfo: dns.DNSZoneInfo{
			Name: name,
		},
	}

	return a, nil
}
1057033
func New(host, port, username string, sams ...ssh.AuthMethod) (*Client, error) {
	config := &ssh.ClientConfig{
		User: username,
		Auth: sams,
	}
	client, err := ssh.Dial("tcp", BuildSSHURL(host, port), config)
	if err != nil {
		return nil, err
	}
	tmpSftpClient, err := sftp.NewClient(client)
	if err != nil {
		return nil, err
	}
	return (*Client)(unsafe.Pointer(tmpSftpClient)), err
}
1331786
func New(opts Options) (*Server, error) {
	metadataURL := opts.URL
	metadataURL.Path = metadataURL.Path + "/metadata"
	ssoURL := opts.URL
	ssoURL.Path = ssoURL.Path + "/sso"
	logr := opts.Logger
	if logr == nil {
		logr = logger.DefaultLogger
	}

	s := &Server{
		serviceProviders: map[string]*saml.EntityDescriptor{},
		IDP: saml.IdentityProvider{
			Key:         opts.Key,
			Logger:      logr,
			Certificate: opts.Certificate,
			MetadataURL: metadataURL,
			SSOURL:      ssoURL,
		},
		logger: logr,
		Store:  opts.Store,
	}

	s.IDP.SessionProvider = s
	s.IDP.ServiceProviderProvider = s

	if err := s.initializeServices(); err != nil {
		return nil, err
	}
	s.InitializeHTTP()
	return s, nil
}
548477
func New(client RedisClient, key string, opts *Options) *Locker {
	var o Options
	if opts != nil {
		o = *opts
	}
	o.normalize()

	return &Locker{client: client, key: key, opts: o}
}
252515
func New(c *Config) (Vocabulary, error) {
  v := Vocabulary{c: c}
  return v, nil
}
1185365
func New(settings SettingsManager, registry storage.ProviderRegistry) PoolManager {
	return &poolManager{settings, registry}
}
896884
func New(ctx context.Context, auth types.AuthConfig, opt Opt) (*Registry, error) {
	transport := http.DefaultTransport

	if opt.Insecure {
		transport = &http.Transport{
			TLSClientConfig: &tls.Config{
				InsecureSkipVerify: true,
			},
		}
	}

	return newFromTransport(ctx, auth, transport, opt)
}
210899
func New(n Name, data []byte) Body {
	switch n {
	case
		AddrNPI,
		AddrTON,
		DataCoding,
		DestAddrNPI,
		DestAddrTON,
		ESMClass,
		ErrorCode,
		InterfaceVersion,
		MessageState,
		NumberDests,
		NoUnsuccess,
		PriorityFlag,
		ProtocolID,
		RegisteredDelivery,
		ReplaceIfPresentFlag,
		SMDefaultMsgID,
		SMLength,
		SourceAddrNPI,
		SourceAddrTON,
		UDHLength:
		if data == nil {
			data = []byte{0}
		}
		return &Fixed{Data: data[0]}
	case
		AddressRange,
		DestinationAddr,
		DestinationList,
		FinalDate,
		MessageID,
		Password,
		ScheduleDeliveryTime,
		ServiceType,
		SourceAddr,
		SystemID,
		SystemType,
		UnsuccessSme,
		ValidityPeriod:
		if data == nil {
			data = []byte{}
		}
		return &Variable{Data: data}
	case ShortMessage:
		if data == nil {
			data = []byte{}
		}
		return &SM{Data: data}
	case GSMUserData:
		udhData := []UDH{}
		if data != nil && len(data) > 2 {
			for i := 0; i < len(data); {
				udh := UDH{}
				udh.IEI = Fixed{Data: data[i]}
				udh.IELength = Fixed{Data: data[i+1]}
				udh.IEData = Variable{}
				l := int(data[i+1])
				for j := 2; j < l+2; j++ {
					udh.IEData.Data = append(udh.IEData.Data, data[i+j])
				}
				udhData = append(udhData, udh)
				i += l + 3 // Ignore one byte after IEData (which is 0x00)
			}
		}
		return &UDHList{Data: udhData}
	default:
		return nil
	}
}
924292
func New(deps *deps.Deps) *Namespace {
	return &Namespace{
		cache: map[string]image.Config{},
		deps:  deps,
	}
}
491202
func (db *DB) New(name []byte) (*Bucket, error) {
	err := db.Update(func(tx *bolt.Tx) error {
		_, err := tx.CreateBucketIfNotExists(name)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return &Bucket{db, name}, nil
}
735744
func (s Session) AddSessionName(name string) Session {
	return s.appendString(TypeSessionName, name)
}
711989
func (g *Generator) New(varName string, varType interface{}) (string, error) {
	switch t := varType.(type) {
	case *Param:
		return g.New(varName, t.OriginalType)
	case types.Type:
		return g.varInitString(varName, t)
	}

	return "", fmt.Errorf("New: unsupported argument type: %T", varType)
}
571086
func (c Configuration) New(
	serviceName string,
	options ...Option,
) (opentracing.Tracer, io.Closer, error) {
	if serviceName != "" {
		c.ServiceName = serviceName
	}

	return c.NewTracer(options...)
}
196493
func (s *MyOAuth2) New(appEnv *cfenv.App) *MyOAuth2 {
	oauth2ServiceName := os.Getenv("OAUTH2_SERVICE_NAME")
	clientIdName := os.Getenv("OAUTH2_CLIENT_ID")
	clientSecretName := os.Getenv("OAUTH2_CLIENT_SECRET")
	oauth2Service, err := appEnv.Services.WithName(oauth2ServiceName)

	if err != nil {
		panic(fmt.Sprintf("oauth2 client service name error: %s", err.Error()))
	}
	s.ID = oauth2Service.Credentials[clientIdName].(string)
	s.Secret = oauth2Service.Credentials[clientSecretName].(string)
	return s
}
75571
func New(name string) (*Config, error) {
	configsGuard.Lock()
	defer configsGuard.Unlock()
	if _, found := configs[name]; found {
		return nil, fmt.Errorf("register config %q twice", name)
	}
	newConfig := Config{}
	configs[name] = &newConfig
	return &newConfig, nil
}
1035162
func New(ctx context.Context, next http.Handler, config config.AddPrefix, name string) (http.Handler, error) {
	middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware")
	var result *addPrefix

	if len(config.Prefix) > 0 {
		result = &addPrefix{
			prefix: config.Prefix,
			next:   next,
			name:   name,
		}
	} else {
		return nil, fmt.Errorf("prefix cannot be empty")
	}

	return result, nil
}