Documentation ¶
Index ¶
- Variables
- func BuildGreptConfig(baseDir, cfgDir string, ctx context.Context) (golden.Config, error)
- func NewGreptConfig(baseDir string, ctx context.Context, hclBlocks []*golden.HclBlock) (golden.Config, error)
- type BaseData
- type BaseFix
- func (bf *BaseFix) AddressLength() int
- func (bf *BaseFix) BlockType() string
- func (bf *BaseFix) CanExecutePrePlan() bool
- func (bf *BaseFix) Decode(hb *golden.HclBlock, evalContext *hcl.EvalContext) 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 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() }
Functions ¶
func BuildGreptConfig ¶ added in v0.2.0
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) CanExecutePrePlan ¶ added in v0.2.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
}
type GreptPlan ¶ added in v0.2.0
type GreptPlan struct { FailedRules []*FailedRule Fixes map[string]Fix // contains filtered or unexported fields }
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
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 ¶
- data.go
- data_git_ignore.go
- data_http.go
- fix.go
- fix_copy_file.go
- fix_git_ignore.go
- fix_local_file.go
- fix_local_shell.go
- fix_rename_file.go
- fix_rm_local_file.go
- fix_yaml_transform.go
- fs.go
- grept_config.go
- grept_plan.go
- init.go
- rule.go
- rule_dir_exist.go
- rule_file_exist.go
- rule_file_hash.go
- rule_must_be_true.go
Click to show internal directories.
Click to hide internal directories.