api

package
v0.0.0-...-b212963 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Pending means the declared changes have yet to be made.
	Pending Phase = "Pending"
	// Succeeded means the declared changes have been made.
	Succeeded Phase = "Succeeded"
	// Failed means the declaared changes have not been made.
	Failed Phase = "Failed"
	// Unknown means that for some reason the state of the resource
	// could not be obtained.
	Unknown Phase = "Unknown"
	// NoOp means no changes will be made, resource matches declared state.
	NoOp Phase = "NoOp"

	// Plan represents the changes to make consistent with the desired state.
	Plan Action = "Plan"
	// Apply represents the changes to make the desired state.
	Apply Action = "Apply"
)

These are the valid statuses of the resource.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action plan or apply the resources.

type Manager

type Manager interface {
	Reconcile() error
	GetStatus() Phase
	GetStatusString() string
	GetStatusConditions() []StatusConditions
	SetStatusCondition(
		statusType SpecAction,
		status Phase,
		message string,
		got string,
		want string,
	)
	GetState() *StateResource
}

Manager interface to files.

type Phase

type Phase string

Phase is a label for the condition of the resource at the current time.

type SpecAction

type SpecAction string

SpecAction the kind of action to perform on resources.

type State

type State struct {
	Items    []*StateResource `json:"items,omitempty"`
	FileName string           `json:"-"`
	// contains filtered or unexported fields
}

State used by state file and status.

func NewState

func NewState(
	fileManager internal.FileManager,
	stateFile string,
) *State

NewState create a new instance of State.

func (*State) GetItems

func (s *State) GetItems() []*StateResource

GetItems get the items property.

func (*State) GetState

func (s *State) GetState() (*State, error)

GetState read state from file and unmarshal.

func (*State) GetStatus

func (s *State) GetStatus() Phase

GetStatus determine the state status.

func (*State) GetStatusString

func (s *State) GetStatusString() string

GetStatusString the status property as a string.

func (*State) SetItems

func (s *State) SetItems(
	stateResource *StateResource,
)

SetItems set the items property.

func (*State) SetState

func (s *State) SetState() error

SetState write state to file.

type StateManager

type StateManager interface {
	GetStatus() Phase
	GetStatusString() string
	GetItems() []*StateResource
	SetItems(stateResource *StateResource)
	SetState() error
	GetState() (*State, error)
}

StateManager interface to state.

type StateResource

type StateResource struct {
	Name       string `json:"name"`
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`

	Phase  Phase   `json:"phase,omitempty"`
	Status *Status `json:"status"`
}

StateResource container holding resource state.

func (*StateResource) GetStatus

func (r *StateResource) GetStatus() Phase

GetStatus the status property.

type Status

type Status struct {
	// Phase sets `phase` as .status.Phase of the resource.
	Phase Phase `json:"phase,omitempty"`
	// A human readable message indicating details about the transition.
	Message string `json:"message,omitempty"`
	// The reason for the condition's last transition.
	Reason string `json:"reason,omitempty"`
	// Conditions contains status of the File lifecycle.
	Conditions []StatusConditions `json:"conditions,omitempty"`
}

Status contains status of the resource.

type StatusConditions

type StatusConditions struct {
	// Type the resources condition type.
	Type SpecAction `json:"type,omitempty"`
	// Status the resources phase.
	Status Phase `json:"status,omitempty"`
	// A human readable message indicating details about the transition.
	Message string `json:"message,omitempty"`
	// The reason for the condition's last transition.
	Reason Action `json:"reason,omitempty"`
	// Got the resources current state.
	Got string `json:"got,omitempty"`
	// Want the resources desired state.
	Want string `json:"want,omitempty"`
}

StatusConditions contains status of the resource lifecycle.

func (*StatusConditions) GetGot

func (sc *StatusConditions) GetGot() string

GetGot get the got property.

func (*StatusConditions) GetMessage

func (sc *StatusConditions) GetMessage() string

GetMessage get the message property.

func (*StatusConditions) GetReason

func (sc *StatusConditions) GetReason() Action

GetReason the reason property.

func (*StatusConditions) GetReasonString

func (sc *StatusConditions) GetReasonString() string

GetReasonString the reason property.

func (*StatusConditions) GetStatus

func (sc *StatusConditions) GetStatus() Phase

GetStatus the status property.

func (*StatusConditions) GetStatusString

func (sc *StatusConditions) GetStatusString() string

GetStatusString the status property as a string.

func (*StatusConditions) GetType

func (sc *StatusConditions) GetType() SpecAction

GetType the action property.

func (*StatusConditions) GetTypeString

func (sc *StatusConditions) GetTypeString() string

GetTypeString the action property.

func (*StatusConditions) GetWant

func (sc *StatusConditions) GetWant() string

GetWant get the want property.

func (*StatusConditions) SetMessage

func (sc *StatusConditions) SetMessage(message string)

SetMessage set the message property.

Jump to

Keyboard shortcuts

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