本文整理汇总了Golang中github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic.MatcherFunc函数的典型用法代码示例。如果您正苦于以下问题:Golang MatcherFunc函数的具体用法?Golang MatcherFunc怎么用?Golang MatcherFunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MatcherFunc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: MatchClusterNetwork
// MatchClusterNetwork returns a generic matcher for a given label and field selector.
func MatchClusterNetwork(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
_, ok := obj.(*api.ClusterNetwork)
if !ok {
return false, fmt.Errorf("not a ClusterNetwork")
}
return true, nil
})
}
开发者ID:cjnygard,项目名称:origin,代码行数:10,代码来源:strategy.go
示例2: MatchTemplate
// MatchTemplate returns a generic matcher for a given label and field selector.
func MatchTemplate(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
o, ok := obj.(*api.Template)
if !ok {
return false, fmt.Errorf("not a pod")
}
return label.Matches(labels.Set(o.Labels)), nil
})
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:10,代码来源:strategy.go
示例3: MatchNetNamespace
// MatchNetNamespace returns a generic matcher for a given label and field selector.
func MatchNetNamespace(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
_, ok := obj.(*api.NetNamespace)
if !ok {
return false, fmt.Errorf("not a NetNamespace")
}
return true, nil
})
}
开发者ID:spohnan,项目名称:origin,代码行数:10,代码来源:strategy.go
示例4: MatchIdentity
// MatchIdentity returns a generic matcher for a given label and field selector.
func MatchIdentity(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
identityObj, ok := obj.(*api.Identity)
if !ok {
return false, fmt.Errorf("not an identity")
}
fields := IdentityToSelectableFields(identityObj)
return label.Matches(labels.Set(identityObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:brandon-adams,项目名称:origin,代码行数:11,代码来源:rest.go
示例5: MatchImageStream
// MatchImageStream returns a generic matcher for a given label and field selector.
func MatchImageStream(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
ir, ok := obj.(*api.ImageStream)
if !ok {
return false, fmt.Errorf("not an ImageStream")
}
fields := ImageStreamToSelectableFields(ir)
return label.Matches(labels.Set(ir.Labels)) && field.Matches(fields), nil
})
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:11,代码来源:strategy.go
示例6: MatchUser
// MatchUser returns a generic matcher for a given label and field selector.
func MatchUser(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
userObj, ok := obj.(*api.User)
if !ok {
return false, fmt.Errorf("not a user")
}
fields := UserToSelectableFields(userObj)
return label.Matches(labels.Set(userObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:cjnygard,项目名称:origin,代码行数:11,代码来源:strategy.go
示例7: Matcher
// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
sa, ok := obj.(*api.ServiceAccount)
if !ok {
return false, fmt.Errorf("not a serviceaccount")
}
fields := SelectableFields(sa)
return label.Matches(labels.Set(sa.Labels)) && field.Matches(fields), nil
})
}
开发者ID:Ima8,项目名称:kubernetes,代码行数:11,代码来源:strategy.go
示例8: MatchPersistentVolumeClaim
// MatchPersistentVolumeClaim returns a generic matcher for a given label and field selector.
func MatchPersistentVolumeClaim(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
persistentvolumeclaimObj, ok := obj.(*api.PersistentVolumeClaim)
if !ok {
return false, fmt.Errorf("not a persistentvolumeclaim")
}
fields := PersistentVolumeClaimToSelectableFields(persistentvolumeclaimObj)
return label.Matches(labels.Set(persistentvolumeclaimObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:mbforbes,项目名称:kubernetes,代码行数:11,代码来源:rest.go
示例9: MatchResourceQuota
// MatchResourceQuota returns a generic matcher for a given label and field selector.
func MatchResourceQuota(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
resourcequotaObj, ok := obj.(*api.ResourceQuota)
if !ok {
return false, fmt.Errorf("not a resourcequota")
}
fields := ResourceQuotaToSelectableFields(resourcequotaObj)
return label.Matches(labels.Set(resourcequotaObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:mbforbes,项目名称:kubernetes,代码行数:11,代码来源:rest.go
示例10: MatchNamespace
// MatchNamespace returns a generic matcher for a given label and field selector.
func MatchNamespace(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
namespaceObj, ok := obj.(*api.Namespace)
if !ok {
return false, fmt.Errorf("not a namespace")
}
fields := NamespaceToSelectableFields(namespaceObj)
return label.Matches(labels.Set(namespaceObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:mbforbes,项目名称:kubernetes,代码行数:11,代码来源:rest.go
示例11: Matcher
// Matchtoken returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
tokenObj, ok := obj.(*api.OAuthAccessToken)
if !ok {
return false, fmt.Errorf("not a token")
}
fields := SelectableFields(tokenObj)
return label.Matches(labels.Set(tokenObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:11,代码来源:strategy.go
示例12: Matcher
// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
scc, ok := obj.(*api.SecurityContextConstraints)
if !ok {
return false, fmt.Errorf("not a securitycontextconstraint")
}
fields := SelectableFields(scc)
return label.Matches(labels.Set(scc.Labels)) && field.Matches(fields), nil
})
}
开发者ID:dustintownsend,项目名称:origin,代码行数:11,代码来源:strategy.go
示例13: MatchPod
// MatchPod returns a generic matcher for a given label and field selector.
func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
podObj, ok := obj.(*api.Pod)
if !ok {
return false, fmt.Errorf("not a pod")
}
fields := PodToSelectableFields(podObj)
return label.Matches(labels.Set(podObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:vrosnet,项目名称:kubernetes,代码行数:11,代码来源:rest.go
示例14: Matcher
// Matchtoken returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
clientObj, ok := obj.(*api.OAuthClientAuthorization)
if !ok {
return false, fmt.Errorf("not a client authorization")
}
fields := SelectableFields(clientObj)
return label.Matches(labels.Set(clientObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:brandon-adams,项目名称:origin,代码行数:11,代码来源:strategy.go
示例15: MatchGroup
// MatchGroup returns a generic matcher for a given label and field selector.
func MatchGroup(label labels.Selector, field fields.Selector) generic.Matcher {
return generic.MatcherFunc(func(obj runtime.Object) (bool, error) {
groupObj, ok := obj.(*api.Group)
if !ok {
return false, fmt.Errorf("not a group")
}
fields := GroupToSelectableFields(groupObj)
return label.Matches(labels.Set(groupObj.Labels)) && field.Matches(fields), nil
})
}
开发者ID:patrykattc,项目名称:origin,代码行数:11,代码来源:strategy.go
注:本文中的github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic.MatcherFunc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论