// NewControllerAPIv6 creates a new ControllerAPIv6.
10573
func NewControllerAPIv6(ctx facade.Context) (*ControllerAPIv6, error) {
	v7, err := NewControllerAPIv7(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &ControllerAPIv6{v7}, nil
}
142738
func (s *store) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
	releaser, err := s.acquireLock()
	if err != nil {
		return nil, "", errors.Annotatef(err, "cannot acquire lock file to read controllers")
	}
	defer releaser.Release()

	controllers, err := ReadControllersFile(JujuControllersPath())
	if err != nil {
		return nil, "", errors.Trace(err)
	}

	matchEps := set.NewStrings(endpoints...)
	for name, ctrl := range controllers.Controllers {
		if matchEps.Intersection(set.NewStrings(ctrl.APIEndpoints...)).IsEmpty() {
			continue
		}

		return &ctrl, name, nil
	}
	return nil, "", errors.NotFoundf("controller with API endpoints %v", endpoints)
}
1214769
func NewAPI(
	auth facade.Authorizer,
	resources facade.Resources,
	externalControllers state.ExternalControllers,
) (*ExternalControllerUpdaterAPI, error) {
	if !auth.AuthController() {
		return nil, common.ErrPerm
	}
	return &ExternalControllerUpdaterAPI{
		externalControllers,
		resources,
	}, nil
}
577419
func NewFilterController(service *goa.Service, config FilterControllerConfiguration) *FilterController {
	return &FilterController{
		Controller: service.NewController("FilterController"),
		config:     config,
	}
}
947413
func (s *VirtualMachineService) NewAssignVirtualMachineParams(virtualmachineid string) *AssignVirtualMachineParams {
	p := &AssignVirtualMachineParams{}
	p.p = make(map[string]interface{})
	p.p["virtualmachineid"] = virtualmachineid
	return p
}
1242240
func NewLoginController(service *goa.Service, auth *login.KeycloakOAuthProvider, configuration loginConfiguration, identityRepository account.IdentityRepository) *LoginController {
	return &LoginController{Controller: service.NewController("login"), auth: auth, configuration: configuration, identityRepository: identityRepository}
}
1004866
func NewController(clock clock.Clock, client clientset.Interface, holderIdentity string, leaseDurationSeconds int32, onRepeatedHeartbeatFailure func()) Controller {
	var leaseClient coordclientset.LeaseInterface
	if client != nil {
		leaseClient = client.CoordinationV1beta1().Leases(corev1.NamespaceNodeLease)
	}
	return &controller{
		client:                     client,
		leaseClient:                leaseClient,
		holderIdentity:             holderIdentity,
		leaseDurationSeconds:       leaseDurationSeconds,
		renewInterval:              renewInterval,
		clock:                      clock,
		onRepeatedHeartbeatFailure: onRepeatedHeartbeatFailure,
	}
}
234869
func newAPI(prefix string, resolver URLResolver, router routing.Routeable) *API {
	// Add initial and trailing slash to prefix
	prefixSlashes := strings.Trim(prefix, "/")
	if len(prefixSlashes) > 0 {
		prefixSlashes = "/" + prefixSlashes + "/"
	} else {
		prefixSlashes = "/"
	}

	info := information{prefix: prefix, resolver: resolver}

	api := &API{
		ContentType:      defaultContentTypHeader,
		router:           router,
		info:             info,
		middlewares:      make([]HandlerFunc, 0),
		contextAllocator: nil,
	}

	api.contextPool.New = func() interface{} {
		if api.contextAllocator != nil {
			return api.contextAllocator(api)
		}
		return api.allocateDefaultContext()
	}

	return api
}
836201
func AddControllerType(moduleSource *Module, controllerType reflect.Type, methods []*MethodType) (newControllerType *ControllerType) {
	if moduleSource == nil {
		moduleSource = appModule
	}

	newControllerType = &ControllerType{ModuleSource: moduleSource, Type: controllerType, Methods: methods, ControllerIndexes: findControllers(controllerType)}
	newControllerType.ControllerEvents = NewControllerTypeEvents(newControllerType)
	newControllerType.Namespace = moduleSource.Namespace()
	controllerName := newControllerType.Name()

	// Store the first controller only in the controllers map with the unmapped namespace.
	if _, found := controllers[controllerName]; !found {
		controllers[controllerName] = newControllerType
		newControllerType.ModuleSource.AddController(newControllerType)
		if newControllerType.ModuleSource == appModule {
			// Add the controller mapping into the global namespace
			controllers[newControllerType.ShortName()] = newControllerType
		}
	} else {
		controllerLog.Errorf("Error, attempt to register duplicate controller as %s", controllerName)
	}
	controllerLog.Debugf("Registered controller: %s", controllerName)

	return
}
1046811
func getControllerAPI(c newControllerAPIRoot) (*controller.Client, error) {
	root, err := c.NewControllerAPIRoot()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return controller.NewClient(root), nil
}
932486
func NewAuthorizeController(service *goa.Service, app application.Application, config AuthorizeControllerConfiguration) *AuthorizeController {
	return &AuthorizeController{Controller: service.NewController("AuthorizeController"), app: app, config: config}
}
580667
func (c *removeCommand) NewApplicationOffersAPI(controllerName string) (*applicationoffers.Client, error) {
	root, err := c.CommandBase.NewAPIRoot(c.ClientStore(), controllerName, "")
	if err != nil {
		return nil, err
	}
	return applicationoffers.NewClient(root), nil
}
280065
func New(config control.Config) (*Controller, error) {
	config.MetricLabelKeys = append(config.MetricLabelKeys, orgLabel)
	c, err := control.New(config)
	if err != nil {
		return nil, err
	}
	return &Controller{c: c}, nil
}
648000
func NewResourceController(service *goa.Service, app application.Application) *ResourceController {
	return &ResourceController{Controller: service.NewController("ResourceController"), app: app}
}
280153
func NewCrossControllerAPI(
	resources facade.Resources,
	localControllerInfo localControllerInfoFunc,
	watchLocalControllerInfo watchLocalControllerInfoFunc,
) (*CrossControllerAPI, error) {
	return &CrossControllerAPI{
		resources:                resources,
		localControllerInfo:      localControllerInfo,
		watchLocalControllerInfo: watchLocalControllerInfo,
	}, nil
}
750965
func NewController(kubeClient clientset.Interface) (*Controller, error) {
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(klog.Infof)
	eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})

	if kubeClient != nil && kubeClient.CoreV1().RESTClient().GetRateLimiter() != nil {
		if err := metrics.RegisterMetricAndTrackRateLimiterUsage("cronjob_controller", kubeClient.CoreV1().RESTClient().GetRateLimiter()); err != nil {
			return nil, err
		}
	}

	jm := &Controller{
		kubeClient: kubeClient,
		jobControl: realJobControl{KubeClient: kubeClient},
		sjControl:  &realSJControl{KubeClient: kubeClient},
		podControl: &realPodControl{KubeClient: kubeClient},
		recorder:   eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "cronjob-controller"}),
	}

	return jm, nil
}
19657
func NewController(backend Backend, t *api.Task) (*Controller, error) {
	spec, err := readSpec(t)
	if err != nil {
		return nil, err
	}
	return &Controller{
		backend:   backend,
		spec:      spec,
		serviceID: t.ServiceID,
		logger: logrus.WithFields(logrus.Fields{
			"controller": "plugin",
			"task":       t.ID,
			"plugin":     spec.Name,
		})}, nil
}