extensions

package
v2.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 11 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARMResourceModifier

type ARMResourceModifier interface {
	// ModifyARMResource takes a genruntime.ARMResource and returns an updated genruntime.ARMResource. The updated resource
	// is then serialized and sent to ARM in the body of a PUT request.
	ModifyARMResource(
		ctx context.Context,
		armObj genruntime.ARMResource,
		obj genruntime.ARMMetaObject,
		kubeClient kubeclient.Client,
		resolver *resolver.Resolver,
		log logr.Logger) (genruntime.ARMResource, error)
}

ARMResourceModifier provides a hook allowing resources to modify the payload that will be sent to ARM just before it is sent.

type ARMResourceModifierFunc

type ARMResourceModifierFunc = func(ctx context.Context, obj genruntime.ARMMetaObject, armObj genruntime.ARMResource) (genruntime.ARMResource, error)

func CreateARMResourceModifier

func CreateARMResourceModifier(
	host genruntime.ResourceExtension,
	kubeClient kubeclient.Client,
	resolver *resolver.Resolver,
	log logr.Logger) ARMResourceModifierFunc

CreateARMResourceModifier returns a function that performs per-resource modifications. If the ARMResourceModifier extension has not been implemented for the resource in question, the default behavior is to return the provided genruntime.ARMResource unmodified.

type ClaimFunc

type ClaimFunc = func(ctx context.Context, log logr.Logger, obj genruntime.ARMOwnedMetaObject) error

ClaimFunc is the signature of a function that can be used to create a default Claimer

func CreateClaimer

func CreateClaimer(
	host genruntime.ResourceExtension,
	next ClaimFunc) ClaimFunc

CreateClaimer creates a ClaimFunc. If the resource in question has not implemented the Claimer interface the provided default ClaimFunc is run by default.

type Claimer

type Claimer interface {
	// Claim claims the resource
	Claim(ctx context.Context, log logr.Logger, obj genruntime.ARMOwnedMetaObject, next ClaimFunc) error
}

Claimer can be implemented to customize how the reconciler claims a resource

type DeleteFunc

type DeleteFunc = func(
	ctx context.Context,
	log logr.Logger,
	resolver *resolver.Resolver,
	armClient *genericarmclient.GenericClient,
	obj genruntime.ARMMetaObject) (ctrl.Result, error)

DeleteFunc is the signature of a function that can be used to create a default Deleter

func CreateDeleter

func CreateDeleter(
	host genruntime.ResourceExtension,
	next DeleteFunc) DeleteFunc

CreateDeleter creates a DeleteFunc. If the resource in question has not implemented the Deleter interface the provided default DeleteFunc is run by default.

type Deleter

type Deleter interface {
	// Delete deletes the resource
	Delete(
		ctx context.Context,
		log logr.Logger,
		resolver *resolver.Resolver,
		armClient *genericarmclient.GenericClient,
		obj genruntime.ARMMetaObject,
		next DeleteFunc) (ctrl.Result, error)
}

Deleter can be implemented to customize how the reconciler deletes resources

type ErrorClassifier

type ErrorClassifier interface {
	// ClassifyError evaluates the provided error, returning including whether it is fatal or can be retried.
	// cloudError is the error returned from ARM.
	// apiVersion is the ARM API version used for the request.
	// log is a logger than can be used for telemetry.
	// next is the next implementation to call.
	ClassifyError(
		cloudError *genericarmclient.CloudError,
		apiVersion string,
		log logr.Logger,
		next ErrorClassifierFunc) (core.CloudErrorDetails, error)
}

ErrorClassifier can be implemented to customize how the reconciler reacts to specific errors

type ErrorClassifierFunc

type ErrorClassifierFunc func(cloudError *genericarmclient.CloudError) (core.CloudErrorDetails, error)

ErrorClassifierFunc is the signature of a function that can be used to create a DefaultErrorClassifier

func CreateErrorClassifier

func CreateErrorClassifier(
	host genruntime.ResourceExtension,
	classifier ErrorClassifierFunc,
	apiVersion string,
	log logr.Logger) ErrorClassifierFunc

type KubernetesExportFunc

type KubernetesExportFunc = func(obj genruntime.MetaObject) ([]client.Object, error)

func CreateKubernetesExporter

func CreateKubernetesExporter(
	ctx context.Context,
	host genruntime.ResourceExtension,
	armClient *genericarmclient.GenericClient,
	log logr.Logger) KubernetesExportFunc

CreateKubernetesExporter creates a function to create Kubernetes resources. If the resource in question has not been configured with the genruntime.KubernetesExporter interface, the returned function is a no-op.

type SuccessFunc

type SuccessFunc = func(obj genruntime.ARMMetaObject) error

SuccessFunc is the signature of a function that can be used to create a default SuccessfulCreationHandler

func CreateSuccessfulCreationHandler

func CreateSuccessfulCreationHandler(
	host genruntime.ResourceExtension,
	log logr.Logger) SuccessFunc

CreateSuccessfulCreationHandler creates a SuccessFunc if the resource implements SuccessfulCreationHandler. If the resource did not implement SuccessfulCreationHandler a default handler that does nothing is returned.

type SuccessfulCreationHandler

type SuccessfulCreationHandler interface {
	// Success modifies the resource based on a successful creation
	Success(obj genruntime.ARMMetaObject) error
}

SuccessfulCreationHandler can be implemented to customize the resource upon successful creation

Jump to

Keyboard shortcuts

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