Documentation
¶
Index ¶
- Variables
- func Do(fn Func) error
- func IsMaxRetries(err error) bool
- type BaseData
- type BaseFix
- func (bf *BaseFix) AddressLength() int
- func (bf *BaseFix) BaseDecode(hb *golden.HclBlock, evalContext *hcl.EvalContext) error
- func (bf *BaseFix) BlockType() string
- func (bf *BaseFix) CanExecutePrePlan() bool
- func (bf *BaseFix) ExecuteDuringPlan() error
- func (bf *BaseFix) Fix()
- func (bf *BaseFix) GetRuleIds() []string
- func (bf *BaseFix) Values() map[string]cty.Value
- type BaseRule
- type CopyFileFix
- type Data
- type DirExistRule
- type FailedRule
- type FileExistRule
- type FileHashRule
- type Fix
- type Func
- type GitIgnoreDatasource
- type GitIgnoreFix
- type GreptConfig
- type GreptPlan
- type HttpDatasource
- type LocalFileFix
- type LocalShellFix
- type MustBeTrueRule
- type RenameFileFix
- type RmLocalFileFix
- type Rule
- type YamlTransform
- type YamlTransformFix
Constants ¶
This section is empty.
Variables ¶
View Source
var FsFactory = func() afero.Fs { return afero.NewOsFs() }
View Source
var MaxRetries = 10
MaxRetries is the maximum number of retries before bailing.
Functions ¶
func Do ¶ added in v0.3.0
Do keeps trying the function until the second argument returns false, or no error is returned.
func IsMaxRetries ¶ added in v0.3.0
IsMaxRetries checks whether the error is due to hitting the maximum number of retries or not.
Types ¶
type BaseData ¶
type BaseData struct{}
func (*BaseData) AddressLength ¶ added in v0.2.0
func (*BaseData) CanExecutePrePlan ¶ added in v0.2.0
type BaseFix ¶
type BaseFix struct {
RuleIds []string `json:"rule_ids" hcl:"rule_ids"`
}
func (*BaseFix) AddressLength ¶ added in v0.2.0
func (*BaseFix) BaseDecode ¶ added in v0.3.0
func (*BaseFix) CanExecutePrePlan ¶ added in v0.2.0
func (*BaseFix) ExecuteDuringPlan ¶ added in v0.3.0
func (*BaseFix) GetRuleIds ¶
type BaseRule ¶
type BaseRule struct {
// contains filtered or unexported fields
}
func (*BaseRule) AddressLength ¶ added in v0.2.0
func (*BaseRule) CanExecutePrePlan ¶ added in v0.2.0
func (*BaseRule) CheckError ¶
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 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 ¶
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
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
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
}
func BuildGreptConfig ¶ added in v0.2.0
func BuildGreptConfig(baseDir, cfgDir string, ctx context.Context, cliFlagAssignedVariables []golden.CliFlagAssignedVariables) (*GreptConfig, error)
func NewGreptConfig ¶ added in v0.2.0
func NewGreptConfig(baseDir string, cliFlagAssignedVariables []golden.CliFlagAssignedVariables, ctx context.Context, hclBlocks []*golden.HclBlock) (*GreptConfig, error)
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 *GreptConfig) (*GreptPlan, error)
type HttpDatasource ¶
type HttpDatasource struct {
*golden.BaseBlock
*BaseData
Url string `hcl:"url"`
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
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 ¶
func (*RmLocalFileFix) Apply ¶
func (r *RmLocalFileFix) Apply() error
func (*RmLocalFileFix) Type ¶
func (r *RmLocalFileFix) Type() string
type YamlTransform ¶
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
Source Files
¶
Click to show internal directories.
Click to hide internal directories.