// ControllerByName implements ControllerGetter.ControllerByName
965519
func (c *MemStore) ControllerByName(name string) (*ControllerDetails, error) {
	c.mu.Lock()
	defer c.mu.Unlock()

	if err := ValidateControllerName(name); err != nil {
		return nil, err
	}
	if result, ok := c.Controllers[name]; ok {
		return &result, nil
	}
	return nil, errors.NotFoundf("controller %s", name)
}
1044724
func (collection *ProxyCollection) getByName(name string) (*Proxy, error) {
	proxy, exists := collection.proxies[name]
	if !exists {
		return nil, ErrProxyNotFound
	}
	return proxy, nil
}
777887
func (g *ControlledResourceHandler) rebuildControllerByName(logger *zap.Logger, namespace, controllerName string) {
	if controllerName == "" {
		logger.Debug("Object has no controller, so nothing was enqueued")
		return
	}
	logger.
		With(logz.DelegateName(controllerName)).
		With(logz.DelegateGk(g.ControllerGvk.GroupKind())).
		Info("Enqueuing controller")
	g.WorkQueue.Add(ctrl.QueueKey{
		Namespace: namespace,
		Name:      controllerName,
	})
}
977050
func (m *MockConfig) Controller() names_v2.ControllerTag {
	ret := m.ctrl.Call(m, "Controller")
	ret0, _ := ret[0].(names_v2.ControllerTag)
	return ret0
}
362818
func LocationsByName(locations []Location) (interface{}, func(_, _ int) bool) {
	return locations, func(i, j int) bool {
		return locations[i].Name < locations[j].Name
	}
}
1188837
func (o *OracleEnviron) ControllerInstances(ctx context.ProviderCallContext, controllerUUID string) ([]instance.Id, error) {
	instances, err := o.allControllerManagedInstances(controllerUUID)
	if err != nil {
		return nil, errors.Trace(err)
	}

	filter := tagValue{tags.JujuIsController, "true"}
	ids := make([]instance.Id, 0, 1)
	for _, val := range instances {
		found := false
		for _, tag := range val.machine.Tags {
			if tag == filter.String() {
				found = true
				break
			}
		}
		if found == false {
			continue
		}
		ids = append(ids, val.Id())
	}

	if len(ids) == 0 {
		return nil, environs.ErrNoInstances
	}

	return ids, nil
}
596122
func (c *ModelCommandBase) ControllerName() (string, error) {
	c.assertRunStarted()
	if err := c.maybeInitModel(); err != nil {
		return "", errors.Trace(err)
	}
	return c._controllerName, nil
}
1352580
func (api *CrossControllerAPI) ControllerInfo() (params.ControllerAPIInfoResults, error) {
	results := params.ControllerAPIInfoResults{
		Results: make([]params.ControllerAPIInfoResult, 1),
	}
	addrs, caCert, err := api.localControllerInfo()
	if err != nil {
		results.Results[0].Error = common.ServerError(err)
		return results, nil
	}
	results.Results[0].Addresses = addrs
	results.Results[0].CACert = caCert
	return results, nil
}
252540
func (c *ExampleService) FindUserByName(ctx context.Context, n string) (*platform.User, error) {
	var u *platform.User

	err := c.kv.View(func(tx Tx) error {
		usr, err := c.findUserByName(ctx, tx, n)
		if err != nil {
			return err
		}
		u = usr
		return nil
	})

	return u, err
}
721299
func (api *DatabaseAPI) SortByName(reverse bool) *DatabaseAPI {
	api.sortByName(reverse)
	return api
}
84645
func SourceByName(name string) (Source, error) {
	for s, n := range sourceNames {
		if n == name {
			return s, nil
		}
	}
	return -1, fmt.Errorf("unknown source %q", name)
}
102846
func (c *Columns) FindByName(name string) *Column {
	for i, col := range c.columns {
		if col.Name == name {
			return c.columns[i]
		}
	}
	return nil
}
988546
func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) validation.PluginFactory {
	return m[string(name)]
}
299470
func (formats Formats) GetByName(name string) (f Format, found bool) {
	for _, ff := range formats {
		if strings.EqualFold(name, ff.Name) {
			f = ff
			found = true
			return
		}
	}
	return
}
129997
func (m *BaseMechanismManager) EnableByName(name string, c *MechanismContext) error {
	mechanism, ok := m.Mechanisms.Get(name)
	if !ok {
		return ErrMechanismNotRegistered
	}

	if mechanism.Enabled() {
		return nil
	}

	atomic.CompareAndSwapInt64(&m.enabled, 0, 1)
	mechanism.Enable(c)
	return nil
}
648344
func (c *MemStore) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
	c.mu.Lock()
	defer c.mu.Unlock()

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

		return &ctrl, name, nil
	}
	return nil, "", errors.NotFoundf("controller with API endpoints %v", endpoints)
}
735287
func (ps Params) ByName(name string) (va string) {
	va, _ = ps.Get(name)
	return
}