1 Star 0 Fork 0

ryancartoon / sensu-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
namespace.go 874 Bytes
一键复制 编辑 原始数据 按行查看 历史
Eric Chlebek 提交于 2019-01-07 14:05 . Add package liveness (#2577)
package store
import (
"context"
"github.com/sensu/sensu-go/types"
)
const (
// WildcardValue is the symbol that denotes a wildcard namespace.
WildcardValue = "*"
// Root is the root of the sensu keyspace.
Root = "/sensu.io"
)
// NewNamespaceFromContext creates a new Namespace from a context.
func NewNamespaceFromContext(ctx context.Context) string {
if value := ctx.Value(types.NamespaceKey); value != nil {
return value.(string)
}
return ""
}
// NamespaceContext returns a context populated with the provided namespace.
func NamespaceContext(ctx context.Context, namespace string) context.Context {
return context.WithValue(ctx, types.NamespaceKey, namespace)
}
// NewNamespaceFromResource creates a new Namespace from a MultitenantResource.
func NewNamespaceFromResource(resource types.MultitenantResource) string {
return resource.GetNamespace()
}
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

搜索帮助