fixsetters

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FNV32aHash

func FNV32aHash(text string) (string, error)

FNV32aHash generates 32-bit FNV-1a hash for input string

Types

type FieldMetaV1

type FieldMetaV1 struct {
	Schema spec.Schema

	Extensions XKustomize
}

FieldMeta contains metadata that may be attached to fields as comments

func (*FieldMetaV1) UpgradeV1SetterComment

func (fm *FieldMetaV1) UpgradeV1SetterComment(n *yaml.RNode) error

UpgradeV1SetterComment reads the FieldMeta from a node and upgrade the setters comment to latest

type PartialFieldSetter

type PartialFieldSetter struct {
	// Name is the name of this setter.
	Name string `yaml:"name" json:"name"`

	// Value is the current value that has been set.
	Value string `yaml:"value" json:"value"`
}

PartialFieldSetter defines how to set part of a field rather than the full field value. e.g. the tag part of an image field

type SetterFixer

type SetterFixer struct {
	// PkgPath is path to the resource package
	PkgPath string

	// OpenAPIPath is path to the openAPI file in the package
	OpenAPIPath string

	// DryRun only displays the actions without performing
	DryRun bool
}

SetterFixer fixes setters in the input package

func (*SetterFixer) FixV1Setters

func (f *SetterFixer) FixV1Setters() (SetterFixerV1Result, error)

FixSettersV1 reads the package and upgrades v1 version of setters to latest

type SetterFixerV1Result

type SetterFixerV1Result struct {
	// NeedFix indicates if the resource in pkgPath are on V1 version of setters
	// and need to be fixed
	NeedFix bool

	// CreatedSetters are setters created as part of this fix
	CreatedSetters []string

	// CreatedSubst are substitutions created as part of this fix
	CreatedSubst []string

	// FailedSetters are setters failed to create from current V1 setters
	FailedSetters map[string]error

	// FailedSubst are substitutions failed to be created from V1 partial setters
	FailedSubst map[string]error
}

SetterFixerV1Result holds the results of V1 setters fix

type UpgradeV1Setters

type UpgradeV1Setters struct {
	// Name is the name of the setter to match.  Optional.
	Name string

	// SetterCounts is populated by Filter and contains the count of fields matching each setter.
	SetterCounts []setterCount

	// Substitutions are groups of partial setters
	Substitutions []substitution
}

UpgradeV1Setters identifies setters for a collection of Resources to upgrade

func (*UpgradeV1Setters) Filter

func (l *UpgradeV1Setters) Filter(input []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements kio.Filter

type XKustomize

type XKustomize struct {
	SetBy               string               `yaml:"setBy,omitempty" json:"setBy,omitempty"`
	PartialFieldSetters []PartialFieldSetter `yaml:"partialSetters,omitempty" json:"partialSetters,omitempty"`
	FieldSetter         *PartialFieldSetter  `yaml:"setter,omitempty" json:"setter,omitempty"`
}

Jump to

Keyboard shortcuts

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