resourcereader

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

resourcereader package contains functions for reading, parsing and ordering kubernetes manifests from files or stdin. to use stdin as input use the "-" character as path.

Index

Constants

View Source
const StdinPath = "-"

StdinPath is the string expected for reading resources from reader instead of a local path

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	// ResourceReader return a Reader implementation based on the reader and path passed as arguments
	ResourceReader(reader io.Reader, path string) (Reader, error)
}

Builder defines the interface for creating the correct Reader and cofigure it

func NewResourceReaderBuilder

func NewResourceReaderBuilder(f util.ClientFactory) Builder

NewResourceReaderBuilder returns an instance of Builder.

type EnforcedNamespaceError

type EnforcedNamespaceError struct {
	EnforcedNamespace string
	NamespaceFound    string
	ResourceGVK       schema.GroupVersionKind
}

EnforcedNamespaceError is used if a resource is found with a different namespace then EnforcedNamespace

func (EnforcedNamespaceError) Error

func (e EnforcedNamespaceError) Error() string

Error implements the error interface

type FilepathReader

type FilepathReader struct {
	Path string

	ReaderConfigs
}

func (*FilepathReader) Read

Read implement the Reader interface

type Reader

type Reader interface {
	// Read reads data from the Reader and parse them in Resource objects.
	Read() ([]*unstructured.Unstructured, error)
}

Reader defines the interface for reading a set of data in Resource objects.

type ReaderConfigs

type ReaderConfigs struct {
	Mapper           meta.RESTMapper
	Namespace        string
	EnforceNamespace bool
}

ReaderConfigs common configurations between different Readers

type StreamReader

type StreamReader struct {
	Reader io.Reader

	ReaderConfigs
}

StreamReader a StreamReader is a concrete implementation of Reader that will parse data from a given io.Reader

func (*StreamReader) Read

func (r *StreamReader) Read() ([]*unstructured.Unstructured, error)

Read implement the Reader interface

Jump to

Keyboard shortcuts

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