// NewAdaptor populates a new NATS Adaptor.
439844
func NewAdaptor(host string, clientID int, options ...nats.Option) *Adaptor {
	hosts, err := processHostString(host)

	return &Adaptor{
		name:     gobot.DefaultName("NATS"),
		Host:     hosts,
		clientID: clientID,
		connect: func() (*nats.Conn, error) {
			if err != nil {
				return nil, err
			}
			return nats.Connect(hosts, options...)
		},
	}
}
564818
func NewAdaptorWithAuth(host string, clientID int, username string, password string, options ...nats.Option) *Adaptor {
	hosts, err := processHostString(host)

	return &Adaptor{
		Host:     hosts,
		clientID: clientID,
		username: username,
		password: password,
		connect: func() (*nats.Conn, error) {
			if err != nil {
				return nil, err
			}
			return nats.Connect(hosts, append(options, nats.UserInfo(username, password))...)
		},
	}
}
710528
func NewAdaptor(device string) *Adaptor {
	c := &serial.Mode{BaudRate: 115200}
	return &Adaptor{
		name:              "MegaPi",
		connection:        nil,
		port:              device,
		serialMode:        c,
		writeBytesChannel: make(chan []byte),
		finalizeChannel:   make(chan struct{}),
	}
}
1112165
func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil)
}
1314496
func NewWatcher(resource CustomResource, namespace string, handlers cache.ResourceEventHandlerFuncs, client rest.Interface) *ResourceWatcher {
	return &ResourceWatcher{
		resource:              resource,
		namespace:             namespace,
		resourceEventHandlers: handlers,
		client:                client,
	}
}
1052602
func NewAdaptor(port string) *Adaptor {
	return &Adaptor{
		name: gobot.DefaultName("LeapMotion"),
		port: port,
		connect: func(host string) (io.ReadWriteCloser, error) {
			return websocket.Dial("ws://"+host+"/v3.json", "", "http://"+host)
		},
	}
}
1283820
func NewAttr(name, val string) *Attribute {
	a := Attribute{Name: name, Value: val}
	return &a
}
964257
func (a *adapter) New(data ...interface{}) goa.LogAdapter {
	return &adapter{Entry: a.Entry.WithFields(data2rus(data))}
}
43312
func SetAdapterConfig(name string, config map[string]interface{}) {
	lock.Lock()
	a := adapters[name]
	a.Config = config
	adapters[name] = a
	lock.Unlock()
}
672594
func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil)
}
884566
func NewDriver(a *Adaptor, topic string) *Driver {
	m := &Driver{
		name:       gobot.DefaultName("NATS"),
		topic:      topic,
		connection: a,
		Eventer:    gobot.NewEventer(),
		Commander:  gobot.NewCommander(),
	}

	return m
}
310728
func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil)
}
1089842
func NewAdapter(storeageAdapterType string) (Adapter, error) {
	if storeageAdapterType == "" || storeageAdapterType == "file" {
		adapter, err := file.NewStorageAdapter(LogRoot)
		if err != nil {
			return nil, err
		}
		return adapter, nil
	}
	match := memoryAdapterRegex.FindStringSubmatch(storeageAdapterType)
	if match == nil {
		return nil, fmt.Errorf("Unrecognized storage adapter type: '%s'", storeageAdapterType)
	}
	sizeStr := match[1]
	if sizeStr == "" {
		sizeStr = "1000"
	}
	size, err := strconv.Atoi(sizeStr)
	if err != nil {
		return nil, err
	}
	adapter, err := ringbuffer.NewStorageAdapter(size)
	if err != nil {
		return nil, err
	}
	return adapter, nil
}
1187251
func (m *Manifest) NewUploadAdapter(name string) Adapter {
	return m.NewAdapterOrDefault(name, Upload)
}
950361
func NewAdaptor() *Adaptor {
	return &Adaptor{
		name: gobot.DefaultName("Joule"),
		connect: func(e *Adaptor) (err error) {
			return
		},
		mutex: &sync.Mutex{},
	}
}
1221702
func NewRawAdapter(route *router.Route) (router.LogAdapter, error) {
	transport, found := router.AdapterTransports.Lookup(route.AdapterTransport("udp"))
	if !found {
		return nil, errors.New("bad transport: " + route.Adapter)
	}
	conn, err := transport.Dial(route.Address, route.Options)
	if err != nil {
		return nil, err
	}
	tmplStr := "{{.Data}}\n"
	if os.Getenv("RAW_FORMAT") != "" {
		tmplStr = os.Getenv("RAW_FORMAT")
	}
	tmpl, err := template.New("raw").Funcs(funcs).Parse(tmplStr)
	if err != nil {
		return nil, err
	}
	return &Adapter{
		route: route,
		conn:  conn,
		tmpl:  tmpl,
	}, nil
}
524044
func NewFilteredAdapter(filePath string) *FilteredAdapter {
	a := FilteredAdapter{}
	a.filtered = true
	a.Adapter = NewAdapter(filePath)
	return &a
}