// NewApplicationController creates new instance of ApplicationController.
421476
func NewApplicationController(
	namespace string,
	settingsMgr *settings_util.SettingsManager,
	kubeClientset kubernetes.Interface,
	applicationClientset appclientset.Interface,
	repoClientset reposerver.Clientset,
	argoCache *argocache.Cache,
	appResyncPeriod time.Duration,
) (*ApplicationController, error) {
	db := db.NewDB(namespace, settingsMgr, kubeClientset)
	settings, err := settingsMgr.GetSettings()
	if err != nil {
		return nil, err
	}
	kubectlCmd := kube.KubectlCmd{}
	ctrl := ApplicationController{
		cache:                     argoCache,
		namespace:                 namespace,
		kubeClientset:             kubeClientset,
		kubectl:                   kubectlCmd,
		applicationClientset:      applicationClientset,
		repoClientset:             repoClientset,
		appRefreshQueue:           workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),
		appOperationQueue:         workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),
		db:                        db,
		statusRefreshTimeout:      appResyncPeriod,
		refreshRequestedApps:      make(map[string]bool),
		refreshRequestedAppsMutex: &sync.Mutex{},
		auditLogger:               argo.NewAuditLogger(namespace, kubeClientset, "argocd-application-controller"),
		settingsMgr:               settingsMgr,
		settings:                  settings,
	}
	appInformer, appLister := ctrl.newApplicationInformerAndLister()
	projInformer := v1alpha1.NewAppProjectInformer(applicationClientset, namespace, appResyncPeriod, cache.Indexers{})
	metricsAddr := fmt.Sprintf("0.0.0.0:%d", common.PortArgoCDMetrics)
	ctrl.metricsServer = metrics.NewMetricsServer(metricsAddr, appLister)
	stateCache := statecache.NewLiveStateCache(db, appInformer, ctrl.settings, kubectlCmd, ctrl.metricsServer, ctrl.handleAppUpdated)
	appStateManager := NewAppStateManager(db, applicationClientset, repoClientset, namespace, kubectlCmd, ctrl.settings, stateCache, projInformer, ctrl.metricsServer)
	ctrl.appInformer = appInformer
	ctrl.appLister = appLister
	ctrl.projInformer = projInformer
	ctrl.appStateManager = appStateManager
	ctrl.stateCache = stateCache

	return &ctrl, nil
}
1159463
func (actor Actor) StartApplication(appGUID string) (Application, Warnings, error) {
	updatedApp, warnings, err := actor.CloudControllerClient.UpdateApplicationStart(appGUID)
	if err != nil {
		return Application{}, Warnings(warnings), err
	}

	return actor.convertCCToActorApplication(updatedApp), Warnings(warnings), nil
}
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}
}
620867
func NewApplicationProvider(capabilities map[string]*cb.Capability) *ApplicationProvider {
	ap := &ApplicationProvider{}
	ap.registry = newRegistry(ap, capabilities)
	_, ap.v11 = capabilities[ApplicationV1_1]
	_, ap.v12 = capabilities[ApplicationV1_2]
	_, ap.v13 = capabilities[ApplicationV1_3]
	_, ap.v11PvtDataExperimental = capabilities[ApplicationPvtDataExperimental]
	return ap
}
407349
func NewController(ps *pss.Pss) *Controller {
	ctrl := &Controller{
		pss:           ps,
		notifiers:     make(map[string]*notifier),
		subscriptions: make(map[string]*subscription),
	}
	ctrl.pss.Register(&controlTopic, pss.NewHandler(ctrl.Handler))
	return ctrl
}
1198194
func NewController() *Controller {
	return &Controller{
		queryServiceEnabled: false,
		BroadcastData:       make(chan *BroadcastData, 10),
		StateChanges:        make(chan *StateChange, 10),
		queryRulesMap:       make(map[string]*rules.Rules),
	}
}
1315704
func NewQueryController(service *goa.Service, db application.DB, config QueryControllerConfiguration) *QueryController {
	return &QueryController{
		Controller: service.NewController("QueryController"),
		db:         db,
		config:     config,
	}
}
185319
func (s *APNSSandboxChannelResponse) SetApplicationId(v string) *APNSSandboxChannelResponse {
	s.ApplicationId = &v
	return s
}
1340757
func (s *ActivityResponse) SetApplicationId(v string) *ActivityResponse {
	s.ApplicationId = &v
	return s
}
294151
func NewResourceController(name string, dal DataAccessLayer) *ResourceController {
	return &ResourceController{
		Name: name,
		DAL:  dal,
	}
}
787249
func newController(client engineapi.APIClient, nodeDescription *api.NodeDescription, task *api.Task, secrets exec.SecretGetter) (exec.Controller, error) {
	adapter, err := newContainerAdapter(client, nodeDescription, task, secrets)
	if err != nil {
		return nil, err
	}

	return &controller{
		task:    task,
		adapter: adapter,
		closed:  make(chan struct{}),
	}, nil
}
475058
func (s *CreateSimulationApplicationVersionInput) SetApplication(v string) *CreateSimulationApplicationVersionInput {
	s.Application = &v
	return s
}
1303568
func NewVerifyClientController(client hap.Device, database db.Database) *VerifyClientController {
	controller := VerifyClientController{
		client:   client,
		database: database,
		session:  NewVerifySession(),
	}

	return &controller
}
550335
func (c *listCommand) NewApplicationOffersAPI() (*applicationoffers.Client, error) {
	root, err := c.NewControllerAPIRoot()
	if err != nil {
		return nil, err
	}
	return applicationoffers.NewClient(root), nil
}
961829
func (c *Controller) updateApplication(ch ApplicationChange) {
	c.ensureModel(ch.ModelUUID).updateApplication(ch, c.manager)
}
932486
func NewAuthorizeController(service *goa.Service, app application.Application, config AuthorizeControllerConfiguration) *AuthorizeController {
	return &AuthorizeController{Controller: service.NewController("AuthorizeController"), app: app, config: config}
}
921843
func NewController(config *rest.Config, wfClientset wfclientset.Interface, namespace, instanceID string) *Controller {
	filterCompletedWithTTL := func(options *metav1.ListOptions) {
		// completed equals (true)
		completedReq, err := labels.NewRequirement(common.LabelKeyCompleted, selection.Equals, []string{"true"})
		if err != nil {
			panic(err)
		}
		labelSelector := labels.NewSelector().
			Add(*completedReq).
			Add(util.InstanceIDRequirement(instanceID))
		options.LabelSelector = labelSelector.String()
	}
	wfInformer := util.NewWorkflowInformer(config, namespace, workflowTTLResyncPeriod, filterCompletedWithTTL)

	controller := &Controller{
		wfclientset:  wfClientset,
		wfInformer:   wfInformer,
		workqueue:    workqueue.NewNamedDelayingQueue("workflow-ttl"),
		resyncPeriod: workflowTTLResyncPeriod,
		clock:        clock.RealClock{},
	}

	wfInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
		AddFunc: controller.enqueueWF,
		UpdateFunc: func(old, new interface{}) {
			controller.enqueueWF(new)
		},
		DeleteFunc: controller.enqueueWF,
	})
	return controller
}