// NewPluginEndorser endorses with using a plugin
18007
func NewPluginEndorser(ps *PluginSupport) *PluginEndorser {
	return &PluginEndorser{
		SigningIdentityFetcher:  ps.SigningIdentityFetcher,
		PluginMapper:            ps.PluginMapper,
		pluginChannelMapping:    make(map[PluginName]*pluginsByChannel),
		ChannelStateRetriever:   ps.ChannelStateRetriever,
		TransientStoreRetriever: ps.TransientStoreRetriever,
	}
}
684168
func NewMultiProvider(providers ...PersistentProvider) *multiProvider {
	return &multiProvider{
		logger:    log.NewNopLogger(),
		providers: providers,
	}
}
991982
func NewContainerManager(cfg container.ManagerConfig, svr *Server) (container.Manager, error) {
	modelUUID := cfg.PopValue(container.ConfigModelUUID)
	if modelUUID == "" {
		return nil, errors.Errorf("model UUID is required")
	}
	namespace, err := instance.NewNamespace(modelUUID)
	if err != nil {
		return nil, errors.Trace(err)
	}

	availabilityZone := cfg.PopValue(container.ConfigAvailabilityZone)
	if availabilityZone == "" {
		logger.Infof("Availability zone will be empty for this container manager")
	}

	imageMetaDataURL := cfg.PopValue(config.ContainerImageMetadataURLKey)
	imageStream := cfg.PopValue(config.ContainerImageStreamKey)

	cfg.WarnAboutUnused()
	return &containerManager{
		server:           svr,
		modelUUID:        modelUUID,
		namespace:        namespace,
		availabilityZone: availabilityZone,
		imageMetadataURL: imageMetaDataURL,
		imageStream:      imageStream,
	}, nil
}
456474
func NewDeployer(st *apideployer.State, ctx Context) (worker.Worker, error) {
	d := &Deployer{
		st:       st,
		ctx:      ctx,
		deployed: make(set.Strings),
	}
	w, err := watcher.NewStringsWorker(watcher.StringsConfig{
		Handler: d,
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return w, nil
}
114857
func NewURLProvider(ctx context.Context, config *configuration.Registry, osioclient OpenshiftIOClient) (kubernetes.BaseURLProvider, error) {

	userServices, err := osioclient.GetUserServices(ctx)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "error accessing Tenant API")
		return nil, err
	}

	token := goajwt.ContextJWT(ctx).Raw
	proxyURL := config.GetOpenshiftProxyURL()

	up, err := newTenantURLProviderFromTenant(userServices, token, proxyURL)
	if err != nil {
		return nil, err
	}

	// create Auth API client - required to get OSO tokens
	authClient, err := auth.CreateClient(ctx, config)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "error accessing Auth server")
		return nil, errs.Wrap(err, "error creating Auth client")
	}
	up.TokenRetriever = &tokenRetriever{
		authClient: authClient,
		context:    ctx,
	}

	// if we're not using a proxy then the API URL is actually the cluster of namespace 0,
	// so the apiToken should be the token for that cluster.
	// there should be no defaults, but that's deferred later
	if len(proxyURL) == 0 {
		tokenData, err := up.TokenForService(up.apiURL)
		if err != nil {
			return nil, err
		}
		up.apiToken = *tokenData
	}
	return up, nil
}
454696
func NewProvisioner(disembedFunc func(string) ([]byte, error)) astilectron.Provisioner {
	return astilectron.NewDisembedderProvisioner(disembedFunc, filepath.Join(vendorDirectoryName, zipNameAstilectron), filepath.Join(vendorDirectoryName, zipNameElectron))
}
1003695
func (p *pluginContainer) HandlersScanner() HandlersScannerPlugin {
	if v, ok := p.base.(HandlersScannerPlugin); ok {
		return v
	}

	return nil
}
1369471
func NewBadFilterErr(filter string, err error) error {
	return &types.ErrBadFilter{Goof: goof.WithFieldE(
		"filter", filter, "bad filter", err)}
}
1032207
func NewHandler(plugin Plugin) *Handler {
	h := &Handler{plugin, sdk.NewHandler(manifest)}
	h.initMux()
	return h
}
966154
func NewProvider(conf *Conf, indexConfig *blkstorage.IndexConfig) blkstorage.BlockStoreProvider {
	p := leveldbhelper.NewProvider(&leveldbhelper.Conf{DBPath: conf.getIndexDir()})
	return &FsBlockstoreProvider{conf, indexConfig, p}
}
968907
func NewWrapper(wrappedFilter Filter) *Wrapper {
	f, err := wrappedFilter.ConstructPBFilter()
	if err != nil {
		panic(err)
	}
	return &Wrapper{
		Filter: f,
	}
}
1173608
func (pe *PluginEndorser) getOrCreatePlugin(plugin PluginName, channel string) (endorsement.Plugin, error) {
	pluginFactory := pe.PluginFactoryByName(plugin)
	if pluginFactory == nil {
		return nil, errors.Errorf("plugin with name %s wasn't found", plugin)
	}

	pluginsByChannel := pe.getOrCreatePluginChannelMapping(PluginName(plugin), pluginFactory)
	return pluginsByChannel.createPluginIfAbsent(channel)
}
222653
func NewPluginDocument(plugin GollumPlugin) PluginDocument {
	pluginDocument := PluginDocument{
		PackageName: plugin.Pkg,
		PluginName:  plugin.Name,
	}

	// The "Enable" parameter is implemented in the coordinator / plugonconfig
	// and not inherited from simple*** types. Documentation for this option is
	// hardcoded here, becacuse inheriting from the simple*** types is voluntary,
	// and it would be counterproductive to contrive support in the RST generaotor
	// just for fishing this parameter from the core.
	switch plugin.Pkg {
	case "consumer", "producer", "router":
		pluginDocument.Parameters.add(&Definition{
			name: "Enable",
			desc: "Switches this plugin on or off.",
			dfl:  "true",
		})
	}

	// Parse the comment string
	pluginDocument.ParseString(plugin.Comment)

	// Set Param values from struct tags
	for _, stParamDef := range plugin.StructTagParams.slice {

		if docParamDef, found := pluginDocument.Parameters.findByName(stParamDef.name); found {
			// Parameter is already documented, add values from struct tags
			docParamDef.unit = stParamDef.unit
			docParamDef.dfl = stParamDef.dfl

		} else {
			// Undocumented parameter
			pluginDocument.Parameters.add(stParamDef)
		}
	}

	// - Recursively generate PluginDocuments for all embedded types (SimpleProducer etc.)
	//   with embedTag in this plugin's embed declaration
	// - Include their parameter lists in this doc
	// - Include their metadata lists in this doc
	for _, embed := range plugin.Embeds {
		importDir := getImportDir(embed.pkg)
		astPackage := parseSourcePath(importDir)
		for _, embedPugin := range findGollumPlugins(astPackage) {
			if embedPugin.Pkg == embed.pkg && embedPugin.Name == embed.name {
				// Recursion
				doc := NewPluginDocument(embedPugin)
				pluginDocument.InheritParameters(doc)
				pluginDocument.InheritMetadata(doc)
			}
		}
	}

	return pluginDocument
}
1003830
func NewPlugins(ps []Plugin, autoname bool, dedup bool) Plugins {
	sortPlugins(ps)
	return &plugins{
		plugins:  ps,
		autoname: autoname,
		dedup:    dedup,
	}
}
50948
func newPlugins(names []string) []Plugin {
	plugins := []Plugin{}
	pluginsMap := make(map[string]struct{})
	for _, name := range names {
		if _, ok := pluginsMap[name]; ok {
			continue
		}
		pluginsMap[name] = struct{}{}
		plugins = append(plugins, newAuthorizationPlugin(name))
	}
	return plugins
}
1359799
func NewPluginConfigReader(config *PluginConfig) PluginConfigReader {
	errors := tgo.NewErrorStack()
	errors.SetFormat(tgo.ErrorStackFormatCSV)
	return PluginConfigReader{
		WithError: NewPluginConfigReaderWithError(config),
		Errors:    &errors,
	}
}
1271558
func NewPluginInitializer(
	cloudConfig []byte,
	restMapper meta.RESTMapper,
	quotaConfiguration quota.Configuration,
) *PluginInitializer {
	return &PluginInitializer{
		cloudConfig:        cloudConfig,
		restMapper:         restMapper,
		quotaConfiguration: quotaConfiguration,
	}
}