pkg

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FsFactory = func() afero.Fs {
	return afero.NewOsFs()
}

Functions

func BuildGreptConfig added in v0.2.0

func BuildGreptConfig(baseDir, cfgDir string, ctx context.Context) (golden.Config, error)

func NewGreptConfig added in v0.2.0

func NewGreptConfig(baseDir string, ctx context.Context, hclBlocks []*golden.HclBlock) (golden.Config, error)

Types

type BaseData

type BaseData struct{}

func (*BaseData) AddressLength added in v0.2.0

func (bd *BaseData) AddressLength() int

func (*BaseData) BlockType

func (bd *BaseData) BlockType() string

func (*BaseData) CanExecutePrePlan added in v0.2.0

func (bd *BaseData) CanExecutePrePlan() bool

func (*BaseData) Data added in v0.2.0

func (bd *BaseData) Data()

type BaseFix

type BaseFix struct {
	RuleIds []string `json:"rule_ids" hcl:"rule_ids"`
}

func (*BaseFix) AddressLength added in v0.2.0

func (bf *BaseFix) AddressLength() int

func (*BaseFix) BlockType

func (bf *BaseFix) BlockType() string

func (*BaseFix) CanExecutePrePlan added in v0.2.0

func (bf *BaseFix) CanExecutePrePlan() bool

func (*BaseFix) Decode

func (bf *BaseFix) Decode(hb *golden.HclBlock, evalContext *hcl.EvalContext) error

func (*BaseFix) Fix added in v0.2.0

func (bf *BaseFix) Fix()

func (*BaseFix) GetRuleIds

func (bf *BaseFix) GetRuleIds() []string

func (*BaseFix) Values

func (bf *BaseFix) Values() map[string]cty.Value

type BaseRule

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

func (*BaseRule) AddressLength added in v0.2.0

func (br *BaseRule) AddressLength() int

func (*BaseRule) BlockType

func (br *BaseRule) BlockType() string

func (*BaseRule) CanExecutePrePlan added in v0.2.0

func (br *BaseRule) CanExecutePrePlan() bool

func (*BaseRule) CheckError

func (br *BaseRule) CheckError() error

func (*BaseRule) Rule added in v0.2.0

func (br *BaseRule) Rule()

type CopyFileFix

type CopyFileFix struct {
	*golden.BaseBlock
	*BaseFix
	Src  string `json:"src" hcl:"src"`
	Dest string `json:"dest" hcl:"dest"`
}

func (*CopyFileFix) Apply

func (c *CopyFileFix) Apply() error

func (*CopyFileFix) Type

func (c *CopyFileFix) Type() string

type Data

type Data interface {
	golden.PlanBlock
	// discriminator func
	Data()
}

type DirExistRule

type DirExistRule struct {
	*golden.BaseBlock
	*BaseRule
	Dir         string `hcl:"dir"`
	FailOnExist bool   `hcl:"fail_on_exist,optional"`
}

func (*DirExistRule) ExecuteDuringPlan

func (d *DirExistRule) ExecuteDuringPlan() error

func (*DirExistRule) Type

func (d *DirExistRule) Type() string

type FailedRule

type FailedRule struct {
	Rule
	CheckError error
}

func (*FailedRule) String

func (fr *FailedRule) String() string

type FileExistRule

type FileExistRule struct {
	*golden.BaseBlock
	*BaseRule
	Glob       string `hcl:"glob"`
	MatchFiles []string
}

func (*FileExistRule) ExecuteDuringPlan

func (f *FileExistRule) ExecuteDuringPlan() error

func (*FileExistRule) Type

func (f *FileExistRule) Type() string

func (*FileExistRule) Values

func (f *FileExistRule) Values() map[string]cty.Value

type FileHashRule

type FileHashRule struct {
	*golden.BaseBlock
	*BaseRule
	Glob               string   `hcl:"glob"`
	Hash               string   `hcl:"hash"`
	Algorithm          string   `hcl:"algorithm,optional" default:"sha1"`
	FailOnHashMismatch bool     `hcl:"fail_on_hash_mismatch,optional"`
	HashMismatchFiles  []string `attribute:"hash_mismatch_files"`
}

func (*FileHashRule) ExecuteDuringPlan

func (fhr *FileHashRule) ExecuteDuringPlan() error

func (*FileHashRule) Type

func (fhr *FileHashRule) Type() string

func (*FileHashRule) Validate

func (fhr *FileHashRule) Validate() error

func (*FileHashRule) Values

func (fhr *FileHashRule) Values() map[string]cty.Value

type Fix

type Fix interface {
	golden.ApplyBlock
	GetRuleIds() []string
	// discriminator func
	Fix()
	// contains filtered or unexported methods
}

type GitIgnoreDatasource

type GitIgnoreDatasource struct {
	*golden.BaseBlock
	*BaseData
	Records []string `attribute:"records"`
}

func (*GitIgnoreDatasource) ExecuteDuringPlan

func (g *GitIgnoreDatasource) ExecuteDuringPlan() error

func (*GitIgnoreDatasource) Type

func (g *GitIgnoreDatasource) Type() string

type GitIgnoreFix

type GitIgnoreFix struct {
	*golden.BaseBlock
	*BaseFix
	Exist    []string `hcl:"exist,optional" validate:"at_least_one_of=Exist NotExist"`
	NotExist []string `hcl:"not_exist,optional" validate:"at_least_one_of=Exist NotExist"`
}

func (*GitIgnoreFix) Apply

func (g *GitIgnoreFix) Apply() error

func (*GitIgnoreFix) Type

func (g *GitIgnoreFix) Type() string

type GreptConfig added in v0.2.0

type GreptConfig struct {
	*golden.BaseConfig
}

type GreptPlan added in v0.2.0

type GreptPlan struct {
	FailedRules []*FailedRule
	Fixes       map[string]Fix
	// contains filtered or unexported fields
}

func RunGreptPlan added in v0.2.0

func RunGreptPlan(c golden.Config) (*GreptPlan, error)

func (*GreptPlan) Apply added in v0.2.0

func (p *GreptPlan) Apply() error

func (*GreptPlan) String added in v0.2.0

func (p *GreptPlan) String() string

type HttpDatasource

type HttpDatasource struct {
	*golden.BaseBlock
	*BaseData
	Url string `hcl:"url"`
	/*
		if !validHttpMethods.Contains(h.Method) {
				err = multierror.Append(err, fmt.Errorf(`"method"" must be one of "GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"`))
			}
	*/
	Method          string            `hcl:"method,optional" default:"GET" validate:"oneof=GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE PATCH"`
	RequestBody     string            `hcl:"request_body,optional"`
	RequestHeaders  map[string]string `hcl:"request_headers,optional"`
	RetryMax        int               `hcl:"retry_max,optional" default:"4"`
	ResponseBody    string            `attribute:"response_body"`
	ResponseHeaders map[string]string `attribute:"response_headers"`
	StatusCode      int               `attribute:"status_code"`
}

func (*HttpDatasource) ExecuteDuringPlan

func (h *HttpDatasource) ExecuteDuringPlan() error

func (*HttpDatasource) Type

func (h *HttpDatasource) Type() string

func (*HttpDatasource) Values

func (h *HttpDatasource) Values() map[string]cty.Value

type LocalFileFix

type LocalFileFix struct {
	*golden.BaseBlock
	*BaseFix
	Paths   []string     `json:"paths" hcl:"paths"`
	Content string       `json:"content" hcl:"content"`
	Mode    *fs.FileMode `json:"mode" hcl:"mode,optional" default:"0644" validate:"file_mode"`
}

func (*LocalFileFix) Apply

func (lf *LocalFileFix) Apply() error

func (*LocalFileFix) Type

func (lf *LocalFileFix) Type() string

type LocalShellFix

type LocalShellFix struct {
	*golden.BaseBlock
	*BaseFix
	ExecuteCommand []string          `hcl:"execute_command,optional" default:"[/bin/sh,-c]"` // The command used to execute the script.
	InlineShebang  string            `hcl:"inline_shebang,optional" validate:"required_with=Inlines"`
	Inlines        []string          `hcl:"inlines,optional" validate:"conflict_with=Script RemoteScript,at_least_one_of=Inlines Script RemoteScript"`
	Script         string            `hcl:"script,optional" validate:"conflict_with=Inlines RemoteScript,at_least_one_of=Inlines Script RemoteScript"`
	RemoteScript   string            `hcl:"remote_script,optional" validate:"conflict_with=Inlines Script,at_least_one_of=Inlines Script RemoteScript,eq=|http_url"`
	OnlyOn         []string          `` /* 129-byte string literal not displayed */
	Env            map[string]string `hcl:"env,optional"`
}

func (*LocalShellFix) Apply

func (l *LocalShellFix) Apply() (err error)

func (*LocalShellFix) Type

func (l *LocalShellFix) Type() string

type MustBeTrueRule

type MustBeTrueRule struct {
	*golden.BaseBlock
	*BaseRule
	Condition    bool   `hcl:"condition"`
	ErrorMessage string `hcl:"error_message,optional"`
}

func (*MustBeTrueRule) ExecuteDuringPlan

func (m *MustBeTrueRule) ExecuteDuringPlan() error

func (*MustBeTrueRule) Type

func (m *MustBeTrueRule) Type() string

type RenameFileFix

type RenameFileFix struct {
	*golden.BaseBlock
	*BaseFix
	OldName string `json:"old_name" hcl:"old_name"`
	NewName string `json:"new_name" hcl:"new_name"`
}

func (*RenameFileFix) Apply

func (rf *RenameFileFix) Apply() error

func (*RenameFileFix) Type

func (rf *RenameFileFix) Type() string

type RmLocalFileFix

type RmLocalFileFix struct {
	*golden.BaseBlock
	*BaseFix
	Paths []string `hcl:"paths" json:"paths"`
}

func (*RmLocalFileFix) Apply

func (r *RmLocalFileFix) Apply() error

func (*RmLocalFileFix) Type

func (r *RmLocalFileFix) Type() string

type Rule

type Rule interface {
	golden.PlanBlock
	CheckError() error
	// discriminator func
	Rule()
	// contains filtered or unexported methods
}

type YamlTransform

type YamlTransform struct {
	YamlPath    string `hcl:"yaml_path" json:"yaml_path"`
	StringValue string `hcl:"string_value" json:"string_value"`
}

type YamlTransformFix

type YamlTransformFix struct {
	*golden.BaseBlock
	*BaseFix
	FilePath  string          `hcl:"file_path" json:"file_path" validate:"endswith=.yaml|endswith=.yml"`
	Transform []YamlTransform `hcl:"transform,block"`
}

func (*YamlTransformFix) Apply

func (y *YamlTransformFix) Apply() error

func (*YamlTransformFix) Type

func (y *YamlTransformFix) Type() string

Jump to

Keyboard shortcuts

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