mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 18:06:55 +00:00
19 lines
648 B
Go
19 lines
648 B
Go
|
package id
|
||
|
|
||
|
import (
|
||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||
|
)
|
||
|
|
||
|
type Id struct {
|
||
|
gvr schema.GroupVersionResource
|
||
|
ns string
|
||
|
name string
|
||
|
}
|
||
|
|
||
|
func New(gvr schema.GroupVersionResource, ns, name string) Id { return Id{gvr, ns, name} }
|
||
|
func (r Id) GetGvr() schema.GroupVersionResource { return r.gvr }
|
||
|
func (r Id) GetNamespace() string { return r.ns }
|
||
|
func (r Id) GetName() string { return r.name }
|
||
|
func (r Id) IsClustered() bool { return r.ns == "" }
|
||
|
func (r Id) IsNamespaced() bool { return !r.IsClustered() }
|