components

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const LabelKey string = "v1.smithy.smithy-security.com/component"

LabelKey is the key of the label where the value must be a string of the ComponentType enum

Variables

View Source
var ErrInvalidComponentType = fmt.Errorf("not a valid ComponentType, try [%s]", strings.Join(_ComponentTypeNames, ", "))

Functions

func ADifferenceFromB

func ADifferenceFromB(componentTypeA ComponentType, componentTypeB ComponentType) int

ADifferenceFromB returns the difference in position between ComponentType A and ComponentType B e.g. Enricher is 2 steps further along the pipeline than Producer

func AGreaterThanB

func AGreaterThanB(componentTypeA ComponentType, componentTypeB ComponentType) bool

AGreaterThanB returns whether ComponentType A is further along the pipeline than ComponentType B e.g. Enricher is further along the pipeline than Producer

func ComponentTypeNames

func ComponentTypeNames() []string

ComponentTypeNames returns a list of possible string values of ComponentType.

func LabelValueOneOf

func LabelValueOneOf(labels map[string]string, componentTypes ...ComponentType) (bool, error)

LabelValueOneOf checks if the labels map has the expected key set and if that key has any one of the expected values

Types

type ComponentType

type ComponentType string

ComponentType represents all the types of components that Smithy supports ENUM(unknown, base, source, producer, producer-aggregator, enricher, enricher-aggregator, consumer)

const (
	// Unknown is a ComponentType of type unknown.
	Unknown ComponentType = "unknown"
	// Base is a ComponentType of type base.
	Base ComponentType = "base"
	// Source is a ComponentType of type source.
	Source ComponentType = "source"
	// Producer is a ComponentType of type producer.
	Producer ComponentType = "producer"
	// ProducerAggregator is a ComponentType of type producer-aggregator.
	ProducerAggregator ComponentType = "producer-aggregator"
	// Enricher is a ComponentType of type enricher.
	Enricher ComponentType = "enricher"
	// EnricherAggregator is a ComponentType of type enricher-aggregator.
	EnricherAggregator ComponentType = "enricher-aggregator"
	// Consumer is a ComponentType of type consumer.
	Consumer ComponentType = "consumer"
)

func ComponentTypeValues

func ComponentTypeValues() []ComponentType

ComponentTypeValues returns a list of the values for ComponentType

func GetPrevious

func GetPrevious(componentType ComponentType) ComponentType

GetPrevious returns previous component type e.g. If we want the previous component type of Producer, we get Source

func MustParseComponentType

func MustParseComponentType(name string) ComponentType

MustParseComponentType converts a string to a ComponentType, and panics if is not valid.

func ParseComponentType

func ParseComponentType(name string) (ComponentType, error)

ParseComponentType attempts to convert a string to a ComponentType.

func (ComponentType) IsValid

func (x ComponentType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ComponentType) MarshalText

func (x ComponentType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (*ComponentType) Scan

func (x *ComponentType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (ComponentType) String

func (x ComponentType) String() string

String implements the Stringer interface.

func (*ComponentType) UnmarshalText

func (x *ComponentType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ComponentType) Value

func (x ComponentType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullComponentType

type NullComponentType struct {
	ComponentType ComponentType
	Valid         bool
	Set           bool
}

func NewNullComponentType

func NewNullComponentType(val interface{}) (x NullComponentType)

func (NullComponentType) MarshalJSON

func (n NullComponentType) MarshalJSON() ([]byte, error)

MarshalJSON correctly serializes a NullComponentType to JSON.

func (*NullComponentType) Scan

func (x *NullComponentType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (*NullComponentType) UnmarshalJSON

func (n *NullComponentType) UnmarshalJSON(b []byte) error

UnmarshalJSON correctly deserializes a NullComponentType from JSON.

func (NullComponentType) Value

func (x NullComponentType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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