handle

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MPL-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package handle provides a way to wrap "handle/descriptor-like" resources. That is, for this resource any sort of unmarsahling is not possible, but the user should define a way to marshal one into the yaml representation and can define equality checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceSpec

type ResourceSpec[S Spec] struct {
	Value S
}

ResourceSpec wraps "handle-like" structures and adds DeepCopy and marshaling methods.

func (ResourceSpec[S]) DeepCopy

func (spec ResourceSpec[S]) DeepCopy() ResourceSpec[S]

DeepCopy implemenents DeepCopyable without actually copying the object sine there is no way to actually do this.

func (*ResourceSpec[S]) Equal

func (spec *ResourceSpec[S]) Equal(other any) bool

Equal implements spec equality check.

func (*ResourceSpec[S]) MarshalJSON

func (spec *ResourceSpec[S]) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ResourceSpec[S]) MarshalProto

func (spec *ResourceSpec[S]) MarshalProto() ([]byte, error)

MarshalProto implements ProtoMarshaler.

func (*ResourceSpec[S]) MarshalYAML

func (spec *ResourceSpec[S]) MarshalYAML() (any, error)

MarshalYAML implements yaml.Marshaler interface. It calls MarshalYAML on the wrapped object.

func (*ResourceSpec[S]) UnmarshalJSON

func (spec *ResourceSpec[S]) UnmarshalJSON([]byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ResourceSpec[S]) UnmarshalProto

func (spec *ResourceSpec[S]) UnmarshalProto([]byte) error

UnmarshalProto implements protobuf.ResourceUnmarshaler.

func (*ResourceSpec[S]) UnmarshalYAML

func (spec *ResourceSpec[S]) UnmarshalYAML(*yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler interface. Since we cannot unmarshal the object, we just return an error.

type Spec

type Spec interface {
	yaml.Marshaler
}

Spec should be yaml.Marshaler.

Jump to

Keyboard shortcuts

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