outputsink

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KRMResourceFormat = "krm"
	HCLResourceFormat = "hcl"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectorySink

type DirectorySink struct {
	// contains filtered or unexported fields
}

This internal type exists to share some code between the HCL and KRM output streams, namely the KRM output streams get a somewhat useful filename with the resource name in it, while the HCL streams do not get this

func (*DirectorySink) Close

func (ds *DirectorySink) Close() error

type FileSink

type FileSink struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(filePath string) (*FileSink, error)

NewFile returns a FileSink which will write all received bytes to a single file

func (*FileSink) Close

func (fs *FileSink) Close() error

func (*FileSink) Receive

func (fs *FileSink) Receive(ctx context.Context, bytes []byte, _ *unstructured.Unstructured) error

type HCLDirectorySink

type HCLDirectorySink struct {
	DirectorySink
}

func (*HCLDirectorySink) Receive

func (ds *HCLDirectorySink) Receive(ctx context.Context, bytes []byte, unstructured *unstructured.Unstructured) error

type KRMYAMLDirectorySink

type KRMYAMLDirectorySink struct {
	DirectorySink
}

func (*KRMYAMLDirectorySink) Close

func (ds *KRMYAMLDirectorySink) Close() error

func (*KRMYAMLDirectorySink) Receive

func (ds *KRMYAMLDirectorySink) Receive(ctx context.Context, bytes []byte, unstructured *unstructured.Unstructured) error

type OutputSink

type OutputSink interface {
	io.Closer
	Receive(ctx context.Context, bytes []byte, unstructured *unstructured.Unstructured) error
}

func New

func New(tfProvider *schema.Provider, outputParam string, resourceFormat ResourceFormat) (OutputSink, error)

New returns a new output sink appropriate for the given resource format.

func NewHCLDirectory

func NewHCLDirectory(tfProvider *schema.Provider, filepath string) OutputSink

func NewKRMYAMLDirectory

func NewKRMYAMLDirectory(tfProvider *schema.Provider, filePath string) OutputSink

NewKRMYAMLDirectory returns a KRMYAMLDirectorySink. This sink assumes the given filepath parameter is a directory. For each received bytes it will yaml.Unmarshal the bytes to map[string]interface{} and then use the 'metadata.name' property and write out an associated YAML file using the name.

type ResourceFormat

type ResourceFormat string

type WriterSink

type WriterSink struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w io.Writer) *WriterSink

NewWriter returns a WriterSink which can be used to write to any io.Writer, all received bytes will be written to the io.Writer

func (*WriterSink) Close

func (ws *WriterSink) Close() error

func (*WriterSink) Receive

func (ws *WriterSink) Receive(ctx context.Context, bytes []byte, _ *unstructured.Unstructured) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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