resourceconverter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendAllConverted

func SendAllConverted[T any](ctx context.Context, output chan<- model.Resource, converter ResourceConverter, resources []T) error

func SendAllConvertedTags

func SendAllConvertedTags[T any](ctx context.Context, output chan<- model.Resource, converter ResourceConverter, resources []T, tF tagFunc[T]) error

Types

type MapConverter added in v0.0.26

type MapConverter struct {
	AccountId      string
	Region         string
	ResourceType   string
	IdField        string
	DisplayIdField string
	TagField       TagField
}

func (*MapConverter) ToResource added in v0.0.26

func (mc *MapConverter) ToResource(ctx context.Context, x any, tags model.Tags) (model.Resource, error)

type ReflectionConverter

type ReflectionConverter struct {
	AccountId      string
	Region         string
	ResourceType   string
	IdField        string
	DisplayIdField string
	TagField       TagField
}

func (*ReflectionConverter) ToResource

func (rc *ReflectionConverter) ToResource(ctx context.Context, x any, tags model.Tags) (model.Resource, error)

type ResourceConverter

type ResourceConverter interface {
	ToResource(context.Context, any, model.Tags) (model.Resource, error)
}

type TagField

type TagField struct {
	//how to fetch the tags
	//field name
	Name string `yaml:"name"`
	//name of key attribute
	Key string `yaml:"key"`
	//name of value attribute
	Value string `yaml:"value"`
}

func (TagField) IsZero added in v0.1.0

func (f TagField) IsZero() bool

Jump to

Keyboard shortcuts

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