// GetRouterByStreamName returns a registered stream by name. See GetRouter.
481467
func (registry streamRegistry) GetRouterByStreamName(name string) Router {
	streamID := registry.GetStreamID(name)
	return registry.GetRouter(streamID)
}
439056
func (s *RouterService) GetRouterByName(name string, opts ...OptionFunc) (*Router, int, error) {
	id, count, err := s.GetRouterID(name, opts...)
	if err != nil {
		return nil, count, err
	}

	r, count, err := s.GetRouterByID(id, opts...)
	if err != nil {
		return nil, count, err
	}
	return r, count, nil
}
763224
func (s *SerfEventHandler) getRawEventName(name string) string {
	return strings.TrimPrefix(name, s.ServicePrefix+":")
}
1308454
func (o *OrgsClient) GetByName(ctx context.Context, name string) (*envelope.Org, error) {
	v := &url.Values{}
	if name == "" {
		return nil, errors.New("invalid org name")
	}
	v.Set("name", name)

	var orgs []envelope.Org
	err := o.client.RoundTrip(ctx, "GET", "/orgs", v, nil, &orgs)
	if err != nil {
		return nil, err
	}
	if len(orgs) < 1 {
		return nil, nil
	}

	return &orgs[0], nil
}
993134
func (l *Live) GetStream(streamName string) *Stream {
	if "" == streamName {
		return nil
	}

	var credentials *StreamCredentials
	if nil != l.streamCert {
		credentials = l.streamCert.Clone()
	}

	return &Stream{
		domainName:     l.liveReq.DomainName,
		appName:        l.liveReq.AppName,
		StreamName:     streamName,
		videoCenterDns: l.videoCenterDns,
		streamCert:     credentials,
		signOn:         nil != l.streamCert,
		live:           l,
	}
}
1373682
func (s *LogsLocation) SetStreamName(v string) *LogsLocation {
	s.StreamName = &v
	return s
}
1203237
func (c *Client) GetDomainByName(domainName string) (*Domain, error) {
	uri := fmt.Sprintf("/%s", domainName)
	req, err := c.newRequest(http.MethodGet, uri, nil)
	if err != nil {
		return nil, err
	}

	domain := &Domain{}
	resp, err := c.do(req, domain)
	if err != nil {
		switch {
		case resp.StatusCode == http.StatusNotFound && strings.Count(domainName, ".") > 1:
			// Look up for the next sub domain
			subIndex := strings.Index(domainName, ".")
			return c.GetDomainByName(domainName[subIndex+1:])
		default:
			return nil, err
		}
	}

	return domain, nil
}
322089
func (bridge *Bridge) GetLightByName(name string) (Light, error) {
	lights, _ := bridge.GetAllLights()
	for _, light := range lights {
		if light.Name == name {
			return light, nil
		}
	}
	errOut := fmt.Sprintf("Error: Light name '%s' not found. ", name)
	return Light{}, errors.New(errOut)
}
995490
func (t *Template) GetAWSLogsLogStreamWithName(name string) (*resources.AWSLogsLogStream, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSLogsLogStream:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSLogsLogStream not found", name)
}
643283
func (s *CognitoStreams) SetStreamName(v string) *CognitoStreams {
	s.StreamName = &v
	return s
}
520411
func (registry *streamRegistry) GetStreamID(stream string) MessageStreamID {
	hash := fnv.New64a()
	hash.Write([]byte(stream))
	streamID := MessageStreamID(hash.Sum64())

	registry.nameGuard.Lock()
	registry.name[streamID] = stream
	registry.nameGuard.Unlock()

	return streamID
}
854320
func (t *Template) GetAWSEC2TransitGatewayRouteTablePropagationWithName(name string) (*resources.AWSEC2TransitGatewayRouteTablePropagation, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2TransitGatewayRouteTablePropagation:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2TransitGatewayRouteTablePropagation not found", name)
}
1204617
func (g *Cloud) getInstanceByName(name string) (*gceInstance, error) {
	// Avoid changing behaviour when not managing multiple zones
	for _, zone := range g.managedZones {
		instance, err := g.getInstanceFromProjectInZoneByName(g.projectID, zone, name)
		if err != nil {
			if isHTTPErrorCode(err, http.StatusNotFound) {
				continue
			}
			klog.Errorf("getInstanceByName: failed to get instance %s in zone %s; err: %v", name, zone, err)
			return nil, err
		}
		return instance, nil
	}

	return nil, cloudprovider.InstanceNotFound
}
740059
func (t *Template) GetAWSKinesisStreamWithName(name string) (*resources.AWSKinesisStream, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSKinesisStream:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSKinesisStream not found", name)
}
926879
func (sl *Slack) FindChannelByName(name string) (*Channel, error) {
	return sl.FindChannel(func(channel *Channel) bool {
		return channel.Name == name
	})
}
288215
func (t *Template) GetAWSAppStreamUserWithName(name string) (*resources.AWSAppStreamUser, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSAppStreamUser:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSAppStreamUser not found", name)
}
54582
func (r Routes) FindRouteByName(name string) (Route, bool) {
	for _, route := range r {
		if route.Name == name {
			return route, true
		}
	}
	return Route{}, false
}