internal

package
v0.0.0-...-87426b5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Group specifies the group of the test resource
	Group = "webhook.pkg.knative.dev"

	// Kind specifies the kind of the test resource
	Kind = "Resource"

	// ErrorMarshal when assigned to the Spec.Property of the ErrorResource
	// will cause json marshalling of the resource to fail
	ErrorMarshal = "marshal"

	// ErrorUnmarshal when assigned to the Spec.Property of the ErrorResource
	// will cause json unmarshalling of the resource to fail
	ErrorUnmarshal = "unmarshal"

	// ErrorConvertTo when assigned to the Spec.Property of the ErrorResource
	// will cause ConvertTo to fail
	ErrorConvertTo = "convertTo"

	// ErrorConvertFrom when assigned to the Spec.Property of the ErrorResource
	// will cause ConvertFrom to fail
	ErrorConvertFrom = "convertFrom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResource

type ErrorResource struct {
	// We embed the V1Resource as an easy way to still marshal & unmarshal
	// this type without infinite loops - since we override the methods
	// in order to induce failures
	V1Resource `json:",inline"`
}

ErrorResource explodes in various settings depending on the property set. Use the Error* constants

This type is used for testing conversion webhooks

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func NewErrorResource

func NewErrorResource(failure string) *ErrorResource

NewErrorResource returns an ErrorResource with Spec.Property set to failure

func (*ErrorResource) ConvertFrom

func (e *ErrorResource) ConvertFrom(ctx context.Context, from apis.Convertible) error

ConvertFrom implements apis.Convertible

func (*ErrorResource) ConvertTo

func (e *ErrorResource) ConvertTo(ctx context.Context, to apis.Convertible) error

ConvertTo implements apis.Convertible

func (*ErrorResource) DeepCopy

func (in *ErrorResource) DeepCopy() *ErrorResource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ErrorResource.

func (*ErrorResource) DeepCopyInto

func (in *ErrorResource) DeepCopyInto(out *ErrorResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ErrorResource) DeepCopyObject

func (in *ErrorResource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*ErrorResource) MarshalJSON

func (e *ErrorResource) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*ErrorResource) UnmarshalJSON

func (e *ErrorResource) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements json.Unmarshaler

type Spec

type Spec struct {
	Property string `json:"prop"`
}

Spec holds our fancy string property

type SpecWithDefault

type SpecWithDefault struct {
	Property    string `json:"prop"`
	NewProperty string `json:"defaulted_prop"`
}

SpecWithDefault holds two fancy string properties

type V1Resource

type V1Resource struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Spec `json:"spec"`
}

V1Resource will never has a prefix or suffix on Spec.Property This type is used for testing conversion webhooks

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func NewV1

func NewV1(prop string) *V1Resource

NewV1 returns a V1Resource with Spec.Property set to prop

func (*V1Resource) ConvertFrom

func (r *V1Resource) ConvertFrom(ctx context.Context, from apis.Convertible) error

ConvertFrom implements apis.Convertible

func (*V1Resource) ConvertTo

func (r *V1Resource) ConvertTo(ctx context.Context, to apis.Convertible) error

ConvertTo implements apis.Convertible

func (*V1Resource) DeepCopy

func (in *V1Resource) DeepCopy() *V1Resource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new V1Resource.

func (*V1Resource) DeepCopyInto

func (in *V1Resource) DeepCopyInto(out *V1Resource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*V1Resource) DeepCopyObject

func (in *V1Resource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type V2Resource

type V2Resource struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Spec `json:"spec"`
}

V2Resource will always have a 'prefix/' in front of it's property This type is used for testing conversion webhooks

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func NewV2

func NewV2(prop string) *V2Resource

NewV2 returns a V2Resource with Spec.Property set to 'prefix/' + prop

func (*V2Resource) ConvertFrom

func (*V2Resource) ConvertFrom(ctx context.Context, from apis.Convertible) error

ConvertFrom implements apis.Convertible

func (*V2Resource) ConvertTo

func (*V2Resource) ConvertTo(ctx context.Context, to apis.Convertible) error

ConvertTo implements apis.Convertible

func (*V2Resource) DeepCopy

func (in *V2Resource) DeepCopy() *V2Resource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new V2Resource.

func (*V2Resource) DeepCopyInto

func (in *V2Resource) DeepCopyInto(out *V2Resource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*V2Resource) DeepCopyObject

func (in *V2Resource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type V3Resource

type V3Resource struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              SpecWithDefault `json:"spec"`
}

V3Resource will always have a '/suffix' in front of it's property This type is used for testing conversion webhooks

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func NewV3

func NewV3(prop string) *V3Resource

NewV3 returns a V3Resource with Spec.Property set to prop + '/suffix'

func (*V3Resource) ConvertFrom

func (*V3Resource) ConvertFrom(ctx context.Context, from apis.Convertible) error

ConvertFrom implements apis.Convertible

func (*V3Resource) ConvertTo

func (*V3Resource) ConvertTo(ctx context.Context, to apis.Convertible) error

ConvertTo implements apis.Convertible

func (*V3Resource) DeepCopy

func (in *V3Resource) DeepCopy() *V3Resource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new V3Resource.

func (*V3Resource) DeepCopyInto

func (in *V3Resource) DeepCopyInto(out *V3Resource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*V3Resource) DeepCopyObject

func (in *V3Resource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*V3Resource) SetDefaults

func (r *V3Resource) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

Jump to

Keyboard shortcuts

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