ref

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 13

Documentation

Index

Constants

View Source
const (
	AnnotationSchemaOwnerKeyName = "harvesterhci.io/owned-by"
)

Variables

This section is empty.

Functions

func Construct

func Construct(namespace string, name string) string

Construct creates the steve api ID.

func GroupKindToSchemaID

func GroupKindToSchemaID(kind schema.GroupKind) string

GroupKindToSchemaID translate the GroupKind to steve schema ID.

func Parse

func Parse(ref string) (namespace string, name string)

Parse parses the steve api ID.

Types

type AnnotationSchemaOwners

type AnnotationSchemaOwners map[string]AnnotationSchemaReference

AnnotationSchemaOwners structures the value recorded in "harvesterhci.io/owned-by" annotation.

func GetSchemaOwnersFromAnnotation

func GetSchemaOwnersFromAnnotation(obj metav1.Object) (AnnotationSchemaOwners, error)

GetSchemaOwnersFromAnnotation gets the annotation schema owners from resource.

func (AnnotationSchemaOwners) Add

func (o AnnotationSchemaOwners) Add(ownerGK schema.GroupKind, owner metav1.Object) bool

Add adds the given owner as an annotation schema owner, returns false to indicate that the ownerRef was a reference.

func (AnnotationSchemaOwners) Bind

Bind bind the schema owners to given object's annotation.

func (AnnotationSchemaOwners) Has

func (o AnnotationSchemaOwners) Has(ownerGK schema.GroupKind, owner metav1.Object) bool

Has checks if the given owner is owned.

func (AnnotationSchemaOwners) List

func (o AnnotationSchemaOwners) List(ownerGK schema.GroupKind) []string

List returns the owner's name list by given group kind.

func (AnnotationSchemaOwners) MarshalJSON

func (o AnnotationSchemaOwners) MarshalJSON() ([]byte, error)

func (AnnotationSchemaOwners) Remove

func (o AnnotationSchemaOwners) Remove(ownerGK schema.GroupKind, owner metav1.Object) bool

Remove remove the given owner from the annotation schema owners, returns false to indicate that the ownerRef isn't a reference.

func (AnnotationSchemaOwners) String

func (o AnnotationSchemaOwners) String() string

func (*AnnotationSchemaOwners) UnmarshalJSON

func (o *AnnotationSchemaOwners) UnmarshalJSON(bytes []byte) error

type AnnotationSchemaReference

type AnnotationSchemaReference struct {
	// SchemaID represents the ID of steve schema API.
	SchemaID string `json:"schema"`
	// References stores the steve data ID of the owners.
	References AnnotationSchemaReferences `json:"refs,omitempty"`
}

AnnotationSchemaReference represents the owners with same schema ID.

type AnnotationSchemaReferences

type AnnotationSchemaReferences struct {
	sets.String
}

AnnotationSchemaReferences represents the reference collection.

func NewAnnotationSchemaOwnerReferences

func NewAnnotationSchemaOwnerReferences(refs ...string) AnnotationSchemaReferences

func (AnnotationSchemaReferences) MarshalJSON

func (s AnnotationSchemaReferences) MarshalJSON() ([]byte, error)

func (*AnnotationSchemaReferences) UnmarshalJSON

func (s *AnnotationSchemaReferences) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL