// New creates a new Discovery from the provided options.
517978
func New(opts *Options) (Driver, error) {
	switch opts.Type {
	case "consul":
		return newConsulDriver(opts.Args)
	default:
		return &noopDriver{}, nil
	}
}
1147550
func New(w io.Writer, opts *BuilderOpts) (*Builder, error) {
	return newBuilder(w, opts)
}
1185317
func New(uri string, options map[string]string) (Source, error) {
	u, err := url.Parse(uri)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "github":
		return NewGitSource(uri, options)
	}
	return nil, ErrUnsupported
}
987906
func New(options ...Option) (*INI, error) {
	ini := &INI{}
	for _, option := range options {
		if err := option(ini); err != nil {
			return nil, err
		}
	}

	if len(ini.comment) == 0 {
		ini.comment = []byte(DefaultComment)
	}
	if ini.sliceSep == 0 {
		ini.sliceSep = DefaultSliceSeparator
	}
	if ini.mapkeySep == 0 {
		ini.mapkeySep = DefaultMapKeySeparator
	}

	return ini, nil
}
449448
func (factory *HTTPBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := HTTPBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
817921
func New(name string, options []string) *List {
	list := &List{}

	list.name = name
	list.options = options
	list.Index = 0

	list.Cursor = &curse.Cursor{}

	list.SetColors(DefaultColors)
	list.SetPrint(fmt.Print)
	list.SetChooser(" ❯ ")
	list.SetIndent(3)

	return list
}
225011
func New(db *gorm.DB, keyPairs ...[]byte) *Store {
	return NewOptions(db, Options{}, keyPairs...)
}
978803
func New(format string, args ...interface{}) error {
	return annotate(errors.New(fmt.Sprintf(format, args...)), "")
}
1159080
func New(cfgOptions ...config.Option) (NetworkController, error) {
	c := &controller{
		id:               stringid.GenerateRandomID(),
		cfg:              config.ParseConfigOptions(cfgOptions...),
		sandboxes:        sandboxTable{},
		svcRecords:       make(map[string]svcInfo),
		serviceBindings:  make(map[serviceKey]*service),
		agentInitDone:    make(chan struct{}),
		networkLocker:    locker.New(),
		DiagnosticServer: diagnostic.New(),
	}
	c.DiagnosticServer.Init()

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

	drvRegistry, err := drvregistry.New(c.getStore(datastore.LocalScope), c.getStore(datastore.GlobalScope), c.RegisterDriver, nil, c.cfg.PluginGetter)
	if err != nil {
		return nil, err
	}

	for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
		var dcfg map[string]interface{}

		// External plugins don't need config passed through daemon. They can
		// bootstrap themselves
		if i.ntype != "remote" {
			dcfg = c.makeDriverConfig(i.ntype)
		}

		if err := drvRegistry.AddDriver(i.ntype, i.fn, dcfg); err != nil {
			return nil, err
		}
	}

	if err = initIPAMDrivers(drvRegistry, nil, c.getStore(datastore.GlobalScope), c.cfg.Daemon.DefaultAddressPool); err != nil {
		return nil, err
	}

	c.drvRegistry = drvRegistry

	if c.cfg != nil && c.cfg.Cluster.Watcher != nil {
		if err := c.initDiscovery(c.cfg.Cluster.Watcher); err != nil {
			// Failing to initialize discovery is a bad situation to be in.
			// But it cannot fail creating the Controller
			logrus.Errorf("Failed to Initialize Discovery : %v", err)
		}
	}

	c.WalkNetworks(populateSpecial)

	// Reserve pools first before doing cleanup. Otherwise the
	// cleanups of endpoint/network and sandbox below will
	// generate many unnecessary warnings
	c.reservePools()

	// Cleanup resources
	c.sandboxCleanup(c.cfg.ActiveSandboxes)
	c.cleanupLocalEndpoints()
	c.networkCleanup()

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

	return c, nil
}
710330
func (factory *mastodonBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := mastodonBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
1017410
func (factory *GitHubBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := GitHubBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
887541
func (factory *CronBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := CronBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
1219969
func (factory *TwitterBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := TwitterBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
571086
func (c Configuration) New(
	serviceName string,
	options ...Option,
) (opentracing.Tracer, io.Closer, error) {
	if serviceName != "" {
		c.ServiceName = serviceName
	}

	return c.NewTracer(options...)
}
673411
func New(context fabcontext.Client, chConfig fab.ChannelCfg, discoveryService fab.DiscoveryService, connectionProvider api.ConnectionProvider, opts ...options.Opt) *Dispatcher {
	return &Dispatcher{
		Dispatcher: clientdisp.New(context, chConfig, discoveryService, connectionProvider, opts...),
	}
}
1319966
func New(o *rules.Options) *Parser {
	if o == nil {
		return &Parser{options: defaultOptions}
	}
	return &Parser{options: o}
}
843475
func (factory *JenkinsBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := JenkinsBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}