// NewTelegrafConfigService constructs an instance of an authorizing telegraf serivce.
7877
func NewTelegrafConfigService(s influxdb.TelegrafConfigStore, urm influxdb.UserResourceMappingService) *TelegrafConfigService {
	return &TelegrafConfigService{
		s:                          s,
		UserResourceMappingService: urm,
	}
}
706592
func NewTeamService(context servicecontext.ServiceContext) service.TeamService {
	return &teamServiceImpl{base.NewBaseService(context)}
}
1169334
func (s *Service) AddOnConfigList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnConfigListResult, error) {
	var addOnConfig AddOnConfigListResult
	return addOnConfig, s.Get(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), nil, lr)
}
1197768
func newTPUService(client *http.Client) (*tpuService, error) {
	s, err := tpuapi.New(client)
	if err != nil {
		return nil, err
	}
	return &tpuService{
		projects: tpuapi.NewProjectsService(s),
	}, nil
}
106896
func (_m *FacadeInterface) GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error) {
	ret := _m.Called(ctx, fileID)

	var r0 *servicedefinition.ConfigFile
	if rf, ok := ret.Get(0).(func(datastore.Context, string) *servicedefinition.ConfigFile); ok {
		r0 = rf(ctx, fileID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*servicedefinition.ConfigFile)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, string) error); ok {
		r1 = rf(ctx, fileID)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1309678
func (s *Service) AddOnConfigUpdate(ctx context.Context, addOnIdentity string, o AddOnConfigUpdateOpts) (AddOnConfigUpdateResult, error) {
	var addOnConfig AddOnConfigUpdateResult
	return addOnConfig, s.Patch(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), o)
}
425796
func (c *Subcommand) ConfigService(ctx context.Context, host string) (*config.Service, error) {
	authOpts, err := c.authFlags.Options()
	if err != nil {
		return nil, err
	}
	client, err := auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client()
	if err != nil {
		return nil, err
	}

	svc, err := config.New(client)
	if err != nil {
		return nil, err
	}
	svc.BasePath = fmt.Sprintf("https://%s/_ah/api/config/v1/", host)
	svc.UserAgent = lucicfg.UserAgent
	return svc, nil
}
208689
func (ccr *ccResolverWrapper) NewServiceConfig(sc string) {
	if ccr.isDone() {
		return
	}
	grpclog.Infof("ccResolverWrapper: got new service config: %v", sc)
	if channelz.IsOn() {
		ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: sc})
	}
	ccr.curState.ServiceConfig = sc
	ccr.cc.updateResolverState(ccr.curState)
}
669231
func (_m *APIClient) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
	ret := _m.Called(ctx, options)

	var r0 []swarm.Config
	if rf, ok := ret.Get(0).(func(context.Context, types.ConfigListOptions) []swarm.Config); ok {
		r0 = rf(ctx, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]swarm.Config)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, types.ConfigListOptions) error); ok {
		r1 = rf(ctx, options)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
191606
func (a *Armor) GetConfigForClient(clientHelloInfo *tls.ClientHelloInfo) (*tls.Config, error) {
	// Get the host from the hello info
	host := a.Hosts[clientHelloInfo.ServerName]
	// If the host or the clientCAs are not configured the function
	// returns the default TLS configuration
	if host == nil || len(host.ClientCAs) == 0 {
		return nil, nil
	}

	// Use existing host config if exist
	if host.TLSConfig != nil {
		return host.TLSConfig, nil
	}

	// Build and save the host config
	host.TLSConfig = a.buildTLSConfig(clientHelloInfo, host)

	return host.TLSConfig, nil
}
158189
func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error) {
	// This maker function is used to do the actual fetch of the ServiceConfig
	// from datastore.  It is called if the ServiceConfig is not in proc cache.
	item, err := serviceCfgCache.Fetch(c, func(interface{}) (interface{}, time.Duration, error) {
		msg := ServiceConfig{ID: ServiceConfigID}
		err := datastore.Get(c, &msg)
		if err != nil {
			return nil, time.Minute, err
		}
		logging.Infof(c, "loaded service config from datastore")
		return msg, time.Minute, nil
	})
	if err != nil {
		return nil, fmt.Errorf("failed to get service config: %s", err.Error())
	}
	if msg, ok := item.(ServiceConfig); ok {
		logging.Infof(c, "loaded config entry from %s", msg.LastUpdated.Format(time.RFC3339))
		return &msg, nil
	}
	return nil, fmt.Errorf("could not load service config %#v", item)
}
1069349
func NewTokenService(context servicecontext.ServiceContext, config TokenServiceConfiguration) service.TokenService {
	tokenManager, err := manager.NewTokenManager(config)
	if err != nil {
		log.Panic(nil, map[string]interface{}{
			"err": err,
		}, "failed to create token manager")
	}

	return &tokenServiceImpl{
		BaseService:  base.NewBaseService(context),
		config:       config,
		tokenManager: tokenManager,
	}
}
963690
func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) {
	tlsConfig := &tls.Config{InsecureSkipVerify: cfg.InsecureSkipVerify}

	// If a CA cert is provided then let's read it in so we can validate the
	// scrape target's certificate properly.
	if len(cfg.CAFile) > 0 {
		b, err := readCAFile(cfg.CAFile)
		if err != nil {
			return nil, err
		}
		if !updateRootCA(tlsConfig, b) {
			return nil, fmt.Errorf("unable to use specified CA cert %s", cfg.CAFile)
		}
	}

	if len(cfg.ServerName) > 0 {
		tlsConfig.ServerName = cfg.ServerName
	}
	// If a client cert & key is provided then configure TLS config accordingly.
	if len(cfg.CertFile) > 0 && len(cfg.KeyFile) == 0 {
		return nil, fmt.Errorf("client cert file %q specified without client key file", cfg.CertFile)
	} else if len(cfg.KeyFile) > 0 && len(cfg.CertFile) == 0 {
		return nil, fmt.Errorf("client key file %q specified without client cert file", cfg.KeyFile)
	} else if len(cfg.CertFile) > 0 && len(cfg.KeyFile) > 0 {
		// Verify that client cert and key are valid.
		if _, err := cfg.getClientCertificate(nil); err != nil {
			return nil, err
		}
		tlsConfig.GetClientCertificate = cfg.getClientCertificate
	}

	return tlsConfig, nil
}
747819
func NewTenantService(config tenantConfig) service.TenantService {
	return &tenantServiceImpl{config: config, doer: rest.DefaultHttpDoer()}
}
468133
func NewTaskService(logger *zap.Logger, ts platform.TaskService, bs platform.BucketService) platform.TaskService {
	return &taskServiceValidator{
		TaskService: ts,
		preAuth:     query.NewPreAuthorizer(bs),
		logger:      logger,
	}
}
412897
func (mongoArgs *ConfigArgs) asServiceConf() common.Conf {
	// See https://docs.mongodb.com/manual/reference/ulimit/.
	limits := map[string]string{
		"fsize":   "unlimited", // file size
		"cpu":     "unlimited", // cpu time
		"as":      "unlimited", // virtual memory size
		"memlock": "unlimited", // locked-in-memory size
		"nofile":  "64000",     // open files
		"nproc":   "64000",     // processes/threads
	}
	conf := common.Conf{
		Desc:        "juju state database",
		Limit:       limits,
		Timeout:     serviceTimeout,
		ExecStart:   mongoArgs.startCommand(),
		ExtraScript: mongoArgs.extraScript(),
	}
	return conf
}
674795
func (s *TelegrafConfigStore) FindTelegrafConfigs(ctx context.Context, filter platform.TelegrafConfigFilter, opt ...platform.FindOptions) ([]*platform.TelegrafConfig, int, error) {
	return s.FindTelegrafConfigsF(ctx, filter, opt...)
}