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 ¶
- type ResourceSpec
- func (spec ResourceSpec[S]) DeepCopy() ResourceSpec[S]
- func (spec *ResourceSpec[S]) Equal(other any) bool
- func (spec *ResourceSpec[S]) MarshalJSON() ([]byte, error)
- func (spec *ResourceSpec[S]) MarshalProto() ([]byte, error)
- func (spec *ResourceSpec[S]) MarshalYAML() (any, error)
- func (spec *ResourceSpec[S]) UnmarshalJSON([]byte) error
- func (spec *ResourceSpec[S]) UnmarshalProto([]byte) error
- func (spec *ResourceSpec[S]) UnmarshalYAML(*yaml.Node) error
- type Spec
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.