v1alpha1

package
v0.0.0-...-a423d60 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the operations v1alpha1 API group +kubebuilder:object:generate=true +groupName=operations.compass

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "operations.compass", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type    ConditionType          `json:"type"`
	Status  corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
	Message string                 `json:"message,omitempty"`
}

Condition defines the states which the Operation CR can take

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

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

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

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

type ConditionType

type ConditionType string

+kubebuilder:validation:Enum=Ready;Error

const (
	ConditionTypeReady ConditionType = "Ready"
	ConditionTypeError ConditionType = "Error"
)

type Operation

type Operation struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   OperationSpec   `json:"spec,omitempty"`
	Status OperationStatus `json:"status,omitempty"`
}

Operation is the Schema for the operations API +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.operation_type` +kubebuilder:printcolumn:name="Resource ID",type=string,JSONPath=`.spec.resource_id` +kubebuilder:printcolumn:name="Resource Type",type=string,JSONPath=`.spec.resource_type` +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase` +kubebuilder:subresource:status

func (*Operation) DeepCopy

func (in *Operation) DeepCopy() *Operation

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

func (*Operation) DeepCopyInto

func (in *Operation) DeepCopyInto(out *Operation)

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

func (*Operation) DeepCopyObject

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

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

func (*Operation) HasPollURL

func (in *Operation) HasPollURL() bool

HasPollURL checks whether the current Operation has been provided with a Poll URL

func (*Operation) IsInProgress

func (in *Operation) IsInProgress() bool

IsInProgress checks if the Operation's Phase is StateInProgress

func (*Operation) NextPollTime

func (in *Operation) NextPollTime(retryInterval *int, timeLayout string) (time.Duration, error)

NextPollTime calculates the remaining time until the Poll URL associated with the current Operation can be requested/polled again.

func (*Operation) PollURL

func (in *Operation) PollURL() string

PollURL returns the Poll URL for the current Operation and empty string if a URL has not been provided

func (*Operation) RequestObject

RequestObject parses and returns the request object associated with the current operation. The request object is essential for the processing of webhook templates as part of the Operation Controller reconcile logic.

func (*Operation) TimeoutReached

func (in *Operation) TimeoutReached(timeout time.Duration) bool

TimeoutReached returns whether the current operation has timed-out or not based on the InitializedAt status timestamp of the Operation and the provided timeout duration variable.

func (*Operation) Validate

func (in *Operation) Validate() error

Validate implements validation logic for the Operation CR

type OperationList

type OperationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Operation `json:"items"`
}

OperationList contains a list of Operation

func (*OperationList) DeepCopy

func (in *OperationList) DeepCopy() *OperationList

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

func (*OperationList) DeepCopyInto

func (in *OperationList) DeepCopyInto(out *OperationList)

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

func (*OperationList) DeepCopyObject

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

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

type OperationSpec

type OperationSpec struct {
	OperationID       string        `json:"operation_id"`
	OperationType     OperationType `json:"operation_type"`
	OperationCategory string        `json:"operation_category"`
	ResourceType      string        `json:"resource_type"`
	ResourceID        string        `json:"resource_id"`
	CorrelationID     string        `json:"correlation_id"`
	WebhookIDs        []string      `json:"webhook_ids"`
	RequestObject     string        `json:"request_object"`
}

OperationSpec defines the desired state of Operation

func (*OperationSpec) DeepCopy

func (in *OperationSpec) DeepCopy() *OperationSpec

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

func (*OperationSpec) DeepCopyInto

func (in *OperationSpec) DeepCopyInto(out *OperationSpec)

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

type OperationStatus

type OperationStatus struct {
	Webhooks           []Webhook   `json:"webhooks,omitempty"`
	Conditions         []Condition `json:"conditions,omitempty"`
	Phase              State       `json:"phase,omitempty"`
	InitializedAt      metav1.Time `json:"initialized_at,omitempty"`
	ObservedGeneration *int64      `json:"observed_generation,omitempty"`
}

OperationStatus defines the observed state of Operation

func (*OperationStatus) DeepCopy

func (in *OperationStatus) DeepCopy() *OperationStatus

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

func (*OperationStatus) DeepCopyInto

func (in *OperationStatus) DeepCopyInto(out *OperationStatus)

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

type OperationType

type OperationType string

+kubebuilder:validation:Enum=Create;Update;Delete;Unpair

const (
	OperationTypeCreate OperationType = "Create"
	OperationTypeUpdate OperationType = "Update"
	OperationTypeDelete OperationType = "Delete"
)

type OperationValidationErr

type OperationValidationErr struct {
	Description string
}

OperationValidationErr represents an operation error potentially occurring during the intialization and validation of the OperationStatus

func (*OperationValidationErr) DeepCopy

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

func (*OperationValidationErr) DeepCopyInto

func (in *OperationValidationErr) DeepCopyInto(out *OperationValidationErr)

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

func (*OperationValidationErr) Error

func (o *OperationValidationErr) Error() string

Error implements the error interface

type State

type State string

+kubebuilder:validation:Enum=Success;Failed;In Progress

const (
	StateSuccess    State = "Success"
	StateFailed     State = "Failed"
	StateInProgress State = "In Progress"
)

type Webhook

type Webhook struct {
	WebhookID         string `json:"webhook_id"`
	RetriesCount      int    `json:"retries_count"`
	WebhookPollURL    string `json:"webhook_poll_url"`
	LastPollTimestamp string `json:"last_poll_timestamp"`
	State             State  `json:"state"`
}

Webhook is an entity part of the OperationStatus which holds information about the progression of the webhook execution

func (*Webhook) DeepCopy

func (in *Webhook) DeepCopy() *Webhook

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

func (*Webhook) DeepCopyInto

func (in *Webhook) DeepCopyInto(out *Webhook)

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

Jump to

Keyboard shortcuts

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