drift

package
v0.9.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package drift provides types and helpers for cloud drifts.

Index

Constants

View Source
const (
	// ErrInvalidStatus represents an invalid drift status error.
	ErrInvalidStatus errors.Kind = "invalid drift status"
	// ErrInvalidFilterStatus represents an invalid drift status filter error.
	ErrInvalidFilterStatus errors.Kind = "invalid drift stack filter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterStatus added in v0.9.1

type FilterStatus Status

FilterStatus represents a filter for drift statuses.

const (
	// UnhealthyFilter status is used for filtering not OK drift status.
	UnhealthyFilter FilterStatus = FilterStatus(^OK)
	// HealthyFilter status is used for filtering for healthy statuses. Just [OK] for now.
	HealthyFilter FilterStatus = FilterStatus(OK)
	// NoFilter disables the filtering for statuses.
	NoFilter FilterStatus = 0
)

func NewStatusFilter added in v0.9.1

func NewStatusFilter(str string) (FilterStatus, error)

NewStatusFilter creates a new filter for drift statuses.

func (FilterStatus) Is added in v0.9.1

func (f FilterStatus) Is(status Status) bool

Is tells if the filter matches the provided status.

func (FilterStatus) String added in v0.9.1

func (f FilterStatus) String() string

type Status

type Status uint8

Status of a drift.

const (
	OK           Status = 1 << iota // OK status is used when the stack is not drifted.
	Unknown                         // Unknown indicates the drift detection was not executed yet.
	Drifted                         // Drifted status indicates the stack is drifted.
	Failed                          // Failed status indicates the drift detection of the stack failed.
	Unrecognized                    // Unrecognized indicates any drift status returned from TMC but not recognized by this client version.

)

func NewStatus

func NewStatus(str string) Status

NewStatus creates a new stack drift status from a string.

func (Status) Is added in v0.9.1

func (s Status) Is(filter FilterStatus) bool

Is tells if status matches the provided filter.

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaller interface.

func (Status) String

func (s Status) String() string

String representation of the status.

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals drift status from JSONs.

func (Status) Validate

func (s Status) Validate() error

Validate the status.

Jump to

Keyboard shortcuts

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