resource

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 403

Documentation

Index

Constants

View Source
const (
	TypeLastAsyncOperation = "LastAsyncOperation"
	TypeAsyncOperation     = "AsyncOperation"

	ReasonApplyFailure   xpv1.ConditionReason = "ApplyFailure"
	ReasonDestroyFailure xpv1.ConditionReason = "DestroyFailure"
	ReasonSuccess        xpv1.ConditionReason = "Success"
	ReasonOngoing        xpv1.ConditionReason = "Ongoing"
	ReasonFinished       xpv1.ConditionReason = "Finished"
)

Condition constants.

View Source
const (
	// AnnotationKeyPrivateRawAttribute is the key that points to private attribute
	// of the Terraform State. It's non-sensitive and used by provider to store
	// arbitrary metadata, usually details about schema version.
	AnnotationKeyPrivateRawAttribute = "terrajet.crossplane.io/provider-meta"

	// CNameWildcard can be used as the canonical name of a value filter option
	// that will apply to all fields of a struct
	CNameWildcard = ""
)

Variables

This section is empty.

Functions

func AsyncOperationFinishedCondition

func AsyncOperationFinishedCondition() xpv1.Condition

AsyncOperationFinishedCondition returns the condition TypeAsyncOperation Finished if the operation was finished

func AsyncOperationOngoingCondition

func AsyncOperationOngoingCondition() xpv1.Condition

AsyncOperationOngoingCondition returns the condition TypeAsyncOperation Ongoing if the operation is still running

func GetConnectionDetails

func GetConnectionDetails(attr map[string]interface{}, tr Terraformed, cfg *config.Resource) (managed.ConnectionDetails, error)

GetConnectionDetails returns connection details including the sensitive Terraform attributes and additions connection details configured.

func GetSensitiveAttributes

func GetSensitiveAttributes(from map[string]interface{}, mapping map[string]string) (map[string][]byte, error)

GetSensitiveAttributes returns strings matching provided field paths in the input data. See the unit tests for examples.

func GetSensitiveObservation

func GetSensitiveObservation(ctx context.Context, client SecretClient, from *v1.SecretReference, into map[string]interface{}) error

GetSensitiveObservation will return sensitive information as terraform state attributes by reading them from connection details.

func GetSensitiveParameters

func GetSensitiveParameters(ctx context.Context, client SecretClient, from runtime.Object, into map[string]interface{}, mapping map[string]string) error

GetSensitiveParameters will collect sensitive information as terraform state attributes by following secret references in the spec.

func LastAsyncOperationCondition

func LastAsyncOperationCondition(err error) xpv1.Condition

LastAsyncOperationCondition returns the condition depending on the content of the error.

func SetCriticalAnnotations

func SetCriticalAnnotations(tr metav1.Object, cfg *config.Resource, tfstate map[string]interface{}, privateRaw string) (bool, error)

SetCriticalAnnotations sets the critical annotations of the resource and reports whether there has been a change.

Types

type GenericLateInitializer

type GenericLateInitializer struct {
	// contains filtered or unexported fields
}

GenericLateInitializer performs late-initialization of a Terraformed resource.

func NewGenericLateInitializer

func NewGenericLateInitializer(opts ...GenericLateInitializerOption) *GenericLateInitializer

NewGenericLateInitializer constructs a new GenericLateInitializer with the supplied options

func (*GenericLateInitializer) LateInitialize

func (li *GenericLateInitializer) LateInitialize(desiredObject, observedObject interface{}) (changed bool, err error)

LateInitialize Copy unset (nil) values from responseObject to crObject Both crObject and responseObject must be pointers to structs. Otherwise, an error will be returned. Returns `true` if at least one field has been stored from source `responseObject` into a corresponding field of target `crObject`. nolint:gocyclo

type GenericLateInitializerOption

type GenericLateInitializerOption func(l *GenericLateInitializer)

GenericLateInitializerOption are options that control the late-initialization behavior of a Terraformed resource.

func WithNameFilter

func WithNameFilter(cname string) GenericLateInitializerOption

WithNameFilter returns a GenericLateInitializer that causes to skip initialization of the field with the specified canonical name

func WithZeroElemPtrFilter

func WithZeroElemPtrFilter(cName string) GenericLateInitializerOption

WithZeroElemPtrFilter returns a GenericLateInitializerOption that causes to skip initialization of a pointer field with a zero-valued element

func WithZeroValueJSONOmitEmptyFilter

func WithZeroValueJSONOmitEmptyFilter(cName string) GenericLateInitializerOption

WithZeroValueJSONOmitEmptyFilter returns a GenericLateInitializerOption that causes to skip initialization of a zero-valued field that has omitempty JSON tag

type LateInitializer

type LateInitializer interface {
	// LateInitialize this Terraformed resource using its observed tfState.
	// returns True if the there are any spec changes for the resource.
	LateInitialize(attrs []byte) (bool, error)
}

LateInitializer late-initializes the managed resource from observed Terraform state.

type MetadataProvider

type MetadataProvider interface {
	GetTerraformResourceType() string
	GetTerraformSchemaVersion() int
	GetConnectionDetailsMapping() map[string]string
}

MetadataProvider provides Terraform metadata for the Terraform managed resource.

type NameFilter

type NameFilter func(string) bool

NameFilter defines a late-initialization filter on CR field canonical names. Fields with matching cnames will not be processed during late-initialization

type Observable

type Observable interface {
	GetObservation() (map[string]interface{}, error)
	SetObservation(map[string]interface{}) error
	GetID() string
}

Observable structs can get and set observations in the form of Terraform JSON.

type Parameterizable

type Parameterizable interface {
	GetParameters() (map[string]interface{}, error)
	SetParameters(map[string]interface{}) error
}

Parameterizable structs can get and set parameters of the managed resource using map form of Terraform JSON.

type SecretClient

type SecretClient interface {
	GetSecretData(ctx context.Context, ref *v1.SecretReference) (map[string][]byte, error)
	GetSecretValue(ctx context.Context, sel v1.SecretKeySelector) ([]byte, error)
}

SecretClient is the client to get sensitive data from kubernetes secrets

type Terraformed

Terraformed is a Kubernetes object representing a concrete terraform managed resource.

type ValueFilter

type ValueFilter func(string, reflect.StructField, reflect.Value) bool

ValueFilter defines a late-initialization filter on CR field values. Fields with matching values will not be processed during late-initialization

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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