// namespacesFromConfig allows to unmarshal channel namespaces.
190179
func namespacesFromConfig(v *viper.Viper) []centrifuge.ChannelNamespace {
	ns := []centrifuge.ChannelNamespace{}
	if !v.IsSet("namespaces") {
		return ns
	}
	v.UnmarshalKey("namespaces", &ns)
	return ns
}
1323338
func (r *Request) Namespace(s string) *Request {
	r.namespace = s
	return r
}
947447
func WithNamespace(namespace string) Option {
	return func(o *Options) error {
		o.Namespace = namespace
		return nil
	}
}
940225
func Namespace(ctx context.Context) (string, bool) {
	namespace, ok := ctx.Value(namespaceKey{}).(string)
	if !ok {
		return fromGRPCHeader(ctx)
	}

	return namespace, ok
}
805744
func networkNamespaceMode(container *dockertypes.ContainerJSON) runtimeapi.NamespaceMode {
	if container != nil && container.HostConfig != nil && string(container.HostConfig.NetworkMode) == namespaceModeHost {
		return runtimeapi.NamespaceMode_NODE
	}
	return runtimeapi.NamespaceMode_POD
}
1164895
func RemoveNamespacesPrefix(value string) (string, error) {
	for _, prefix := range []string{"namespaces/", "namespace/", "ns/"} {
		if len(value) > len(prefix) && strings.EqualFold(value[0:len(prefix)], prefix) {
			value = value[len(prefix):]
			break
		}
	}
	return value, nil
}
1019374
func deploymentNamespaceFilter(namespace string) func(interface{}) bool {
	return func(raw interface{}) bool {
		d, ok := raw.(*structs.Deployment)
		if !ok {
			return true
		}

		return d.Namespace != namespace
	}
}
16620
func LoadPersistedNamespaceConfig(namespaceID string) (*PersistedNamespaceConfig, error) {
	sk, err := regstate.Open(cniRoot, false)
	if err != nil {
		return nil, err
	}
	defer sk.Close()

	pnc := PersistedNamespaceConfig{
		namespaceID: namespaceID,
		stored:      true,
	}
	if err := sk.Get(namespaceID, cniKey, &pnc); err != nil {
		return nil, err
	}
	return &pnc, nil
}
99772
func WithNamespaceService(namespaceService namespacesapi.NamespacesClient) ServicesOpt {
	return func(s *services) {
		s.namespaceStore = NewNamespaceStoreFromClient(namespaceService)
	}
}
26782
func (c *Config) WriteNamespaces(w quad.Writer, n *voc.Namespaces) error {
	rules, err := c.rulesFor(reflect.TypeOf(namespace{}))
	if err != nil {
		return fmt.Errorf("can't load rules: %v", err)
	}
	wr := c.newWriter(w)
	for _, ns := range n.List() {
		obj := namespace{
			Full:   quad.IRI(ns.Full),
			Prefix: quad.IRI(ns.Prefix),
		}
		rv := reflect.ValueOf(obj)
		if err = wr.writeValueAs(obj.Full, rv, "", rules); err != nil {
			return err
		}
	}
	return nil
}
1248728
func (self *Collector) namespace() string {
	if self.Spider.Namespace == nil {
		if self.Spider.GetSubName() == "" {
			return self.Spider.GetName()
		}
		return self.Spider.GetName() + "__" + self.Spider.GetSubName()
	}
	return self.Spider.Namespace(self.Spider)
}
374180
func NewNamespace(name string) Namespace {
	return Namespace{
		Kind:    KindNamespace,
		Version: V2,
		Metadata: Metadata{
			Name: name,
		},
	}
}
1202026
func Convert_v1_NamespaceSpec_To_core_NamespaceSpec(in *v1.NamespaceSpec, out *core.NamespaceSpec, s conversion.Scope) error {
	return autoConvert_v1_NamespaceSpec_To_core_NamespaceSpec(in, out, s)
}
532833
func (v *version) Namespaces() NamespaceInformer {
	return &namespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
974076
func (s *configMapLister) ConfigMaps(namespace string) ConfigMapNamespaceLister {
	return configMapNamespaceLister{indexer: s.indexer, namespace: namespace}
}
265236
func (c *EndpointConfig) ChannelConfig(name string) *fab.ChannelEndpointConfig {

	// get the mapped channel Name
	mappedChannelName := c.mappedChannelName(c.networkConfig, name)
	if mappedChannelName == defaultEntity {
		return c.defaultChannel
	}

	//look up in network config by channelName
	ch, ok := c.networkConfig.Channels[strings.ToLower(mappedChannelName)]
	if !ok {
		return c.defaultChannel
	}
	return &ch
}
654760
func ModifyNamespaceSettings(namespaceId string, request *ModifyNamespaceSettingRequest) error {
	logrus.Debugf("hcn::HostComputeNamespace::ModifyNamespaceSettings id=%s", namespaceId)

	namespaceSettings, err := json.Marshal(request)
	if err != nil {
		return err
	}

	_, err = modifyNamespace(namespaceId, string(namespaceSettings))
	if err != nil {
		return err
	}
	return nil
}