reflecthelpers

package
v0.0.0-...-a37997b Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertResourceToDeployableResource

func ConvertResourceToDeployableResource(
	ctx context.Context,
	resolver *genruntime.Resolver,
	metaObject genruntime.MetaObject) (genruntime.DeployableResource, error)

ConvertResourceToDeployableResource converts a genruntime.MetaObject (a Kubernetes representation of a resource) into a genruntime.DeployableResource - a specification which can be submitted to Azure for deployment

func DeepCopyInto

func DeepCopyInto(in client.Object, out client.Object)

DeepCopyInto calls in.DeepCopyInto(out)

func FindResourceReferences

func FindResourceReferences(transformer interface{}) (map[genruntime.ResourceReference]struct{}, error)

FindResourceReferences finds all ResourceReferences specified by a given genruntime.ARMTransformer (resource spec)

func HasStatus

func HasStatus(metaObj genruntime.MetaObject) (bool, error)

func IdentityVisitMap

func IdentityVisitMap(this *ReflectVisitor, it interface{}, ctx interface{}) error

IdentityVisitMap is the identity visit function for maps. It visits each key and value in the map.

func IdentityVisitPrimitive

func IdentityVisitPrimitive(this *ReflectVisitor, it interface{}, ctx interface{}) error

IdentityVisitPrimitive is the identity visit function for primitive types.

func IdentityVisitPtr

func IdentityVisitPtr(this *ReflectVisitor, it interface{}, ctx interface{}) error

IdentityVisitPtr is the identity visit function for pointer types. It dereferences the pointer and visits the type pointed to.

func IdentityVisitSlice

func IdentityVisitSlice(this *ReflectVisitor, it interface{}, ctx interface{}) error

IdentityVisitSlice is the identity visit function for slices. It visits each element of the slice.

func IdentityVisitStruct

func IdentityVisitStruct(this *ReflectVisitor, it interface{}, ctx interface{}) error

IdentityVisitStruct is the identity visit function for structs. It visits each exported field of the struct.

func IsPrimitiveKind

func IsPrimitiveKind(k reflect.Kind) bool

IsPrimitiveKind returns true if the provided reflect.Kind is for a primitive type, otherwise false.

func NewEmptyArmResourceStatus

func NewEmptyArmResourceStatus(metaObject genruntime.MetaObject) (genruntime.ARMResourceStatus, error)

NewEmptyArmResourceStatus creates an empty genruntime.ARMResourceStatus from a genruntime.MetaObject (a Kubernetes representation of a resource), which can be filled by a call to Azure

func NewEmptyStatus

func NewEmptyStatus(metaObject genruntime.MetaObject) (genruntime.FromARMConverter, error)

NewEmptyStatus creates a new empty Status object (which implements FromArmConverter) from a genruntime.MetaObject.

func NewPtrFromValue

func NewPtrFromValue(value interface{}) interface{}

NewPtrFromValue creates a new pointer type from a value

func SetStatus

func SetStatus(metaObj genruntime.MetaObject, status interface{}) error

TODO: hacking this for now -- replace with a code-generated method later

func ValueOfPtr

func ValueOfPtr(ptr interface{}) interface{}

TODO: Can we delete this helper later when we have some better code generated functions? ValueOfPtr dereferences a pointer and returns the value the pointer points to. Use this as carefully as you would the * operator

Types

type ReflectVisitor

type ReflectVisitor struct {
	VisitPrimitive func(this *ReflectVisitor, it interface{}, ctx interface{}) error
	VisitStruct    func(this *ReflectVisitor, it interface{}, ctx interface{}) error
	VisitPtr       func(this *ReflectVisitor, it interface{}, ctx interface{}) error
	VisitSlice     func(this *ReflectVisitor, it interface{}, ctx interface{}) error
	VisitMap       func(this *ReflectVisitor, it interface{}, ctx interface{}) error
}

ReflectVisitor allows traversing an arbitrary object graph.

func NewReflectVisitor

func NewReflectVisitor() *ReflectVisitor

NewReflectVisitor creates an identity ReflectVisitor.

func (*ReflectVisitor) Visit

func (r *ReflectVisitor) Visit(val interface{}, ctx interface{}) error

Visit visits the provided value. The ctx parameter can be used to pass data through the visit hierarchy.

Jump to

Keyboard shortcuts

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