Documentation
¶
Index ¶
- Variables
- func Do(fn Func) error
- func FindRepoInvitation(client *githubclient.Client, ctx context.Context, ...) (*github.RepositoryInvitation, 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 CollaboratorForRepositoryCollaboratorsFix
- type CopyFileFix
- type Data
- type DeploymentBranchPolicyForGitHubRepositoryEnvironmentsFix
- type DirExistRule
- type EnvironmentForGitHubRepositoryEnvironmentsDatasource
- type EnvironmentForGitHubRepositoryEnvironmentsFix
- type FailedRule
- type FileExistRule
- type FileHashRule
- type Fix
- type Func
- type GitHubRepositoryCollaboratorsDatasource
- type GitHubRepositoryCollaboratorsFix
- type GitHubRepositoryEnvironmentsDatasource
- type GitHubRepositoryEnvironmentsFix
- type GitHubRepositoryTeamsDatasource
- type GitHubTeamDatasource
- type GitHubTeamFix
- type GitHubTeamMembersFix
- type GitHubTeamRepositoryFix
- type GitIgnoreDatasource
- type GitIgnoreFix
- type GreptConfig
- type GreptPlan
- type HttpDatasource
- type LocalFileFix
- type LocalShellFix
- type MustBeTrueRule
- type RenameFileFix
- type ReviewerForGitHubRepositoryEnvironmentsFix
- type RmLocalFileFix
- type Rule
- type Team
- type TeamMember
- type TeamRepositoryBinding
- type User
- 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 FindRepoInvitation ¶ added in v0.3.0
func FindRepoInvitation(client *githubclient.Client, ctx context.Context, owner, repo, collaborator string) (*github.RepositoryInvitation, error)
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 CollaboratorForRepositoryCollaboratorsFix ¶ added in v0.3.0
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 DeploymentBranchPolicyForGitHubRepositoryEnvironmentsFix ¶ added in v0.3.0
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 EnvironmentForGitHubRepositoryEnvironmentsDatasource ¶ added in v0.3.0
type EnvironmentForGitHubRepositoryEnvironmentsFix ¶ added in v0.3.0
type EnvironmentForGitHubRepositoryEnvironmentsFix struct {
Name string `hcl:"name"`
CanAdminsBypass bool `hcl:"can_admins_bypass,optional" default:"true"`
PreventSelfReview bool `hcl:"prevent_self_review,optional" default:"false"`
WaitTimer *int `hcl:"wait_timer,optional" validate:"gte=0,lte=43200"`
Reviewers []ReviewerForGitHubRepositoryEnvironmentsFix `hcl:"reviewer,block" validate:"max=6"`
DeploymentBranchPolicy *DeploymentBranchPolicyForGitHubRepositoryEnvironmentsFix `hcl:"deployment_branch_policy,block"`
}
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 GitHubRepositoryCollaboratorsDatasource ¶ added in v0.3.0
type GitHubRepositoryCollaboratorsDatasource struct {
*golden.BaseBlock
*BaseData
Owner string `hcl:"owner" json:"owner"`
RepoName string `hcl:"repo_name" json:"repo_name"`
Collaborators []User `attribute:"users"`
}
func (*GitHubRepositoryCollaboratorsDatasource) ExecuteDuringPlan ¶ added in v0.3.0
func (g *GitHubRepositoryCollaboratorsDatasource) ExecuteDuringPlan() error
func (*GitHubRepositoryCollaboratorsDatasource) Type ¶ added in v0.3.0
func (g *GitHubRepositoryCollaboratorsDatasource) Type() string
type GitHubRepositoryCollaboratorsFix ¶ added in v0.3.0
type GitHubRepositoryCollaboratorsFix struct {
*golden.BaseBlock
*BaseFix
Owner string `hcl:"owner"`
RepoName string `hcl:"repo_name"`
Collaborators []CollaboratorForRepositoryCollaboratorsFix `hcl:"collaborator,block"`
}
func (*GitHubRepositoryCollaboratorsFix) Apply ¶ added in v0.3.0
func (g *GitHubRepositoryCollaboratorsFix) Apply() error
func (*GitHubRepositoryCollaboratorsFix) Type ¶ added in v0.3.0
func (g *GitHubRepositoryCollaboratorsFix) Type() string
type GitHubRepositoryEnvironmentsDatasource ¶ added in v0.3.0
type GitHubRepositoryEnvironmentsDatasource struct {
*golden.BaseBlock
*BaseData
Owner string `hcl:"owner"`
RepoName string `hcl:"repo_name"`
Environments []EnvironmentForGitHubRepositoryEnvironmentsDatasource `attribute:"environments"`
}
func (*GitHubRepositoryEnvironmentsDatasource) ExecuteDuringPlan ¶ added in v0.3.0
func (g *GitHubRepositoryEnvironmentsDatasource) ExecuteDuringPlan() error
func (*GitHubRepositoryEnvironmentsDatasource) Type ¶ added in v0.3.0
func (g *GitHubRepositoryEnvironmentsDatasource) Type() string
type GitHubRepositoryEnvironmentsFix ¶ added in v0.3.0
type GitHubRepositoryEnvironmentsFix struct {
*golden.BaseBlock
*BaseFix
Owner string `hcl:"owner"`
RepoName string `hcl:"repo_name"`
Environments []EnvironmentForGitHubRepositoryEnvironmentsFix `hcl:"environment,block"`
}
func (*GitHubRepositoryEnvironmentsFix) Apply ¶ added in v0.3.0
func (g *GitHubRepositoryEnvironmentsFix) Apply() error
func (*GitHubRepositoryEnvironmentsFix) Type ¶ added in v0.3.0
func (g *GitHubRepositoryEnvironmentsFix) Type() string
type GitHubRepositoryTeamsDatasource ¶ added in v0.3.0
type GitHubRepositoryTeamsDatasource struct {
*golden.BaseBlock
*BaseData
Owner string `hcl:"owner"`
RepoName string `hcl:"repo_name"`
Teams []Team `attribute:"teams"`
}
func (*GitHubRepositoryTeamsDatasource) ExecuteDuringPlan ¶ added in v0.3.0
func (g *GitHubRepositoryTeamsDatasource) ExecuteDuringPlan() error
func (*GitHubRepositoryTeamsDatasource) Type ¶ added in v0.3.0
func (g *GitHubRepositoryTeamsDatasource) Type() string
type GitHubTeamDatasource ¶ added in v0.3.0
type GitHubTeamDatasource struct {
*golden.BaseBlock
*BaseData
Owner string `hcl:"owner"`
Slug string `hcl:"slug"`
MembershipType string `hcl:"membership_type,optional" default:"all" validate:"oneof=all immediate"`
TeamName string `attribute:"team_name"`
Description string `attribute:"description"`
Privacy string `attribute:"privacy"`
Permission string `attribute:"permission"`
NodeId string `attribute:"node_id"`
TeamId int64 `attribute:"team_id"`
Members []string `attribute:"members"`
}
func (*GitHubTeamDatasource) ExecuteDuringPlan ¶ added in v0.3.0
func (g *GitHubTeamDatasource) ExecuteDuringPlan() error
func (*GitHubTeamDatasource) Type ¶ added in v0.3.0
func (g *GitHubTeamDatasource) Type() string
type GitHubTeamFix ¶ added in v0.3.0
type GitHubTeamFix struct {
*golden.BaseBlock
*BaseFix
Owner string `hcl:"owner"`
TeamName string `hcl:"team_name"`
Description string `hcl:"description,optional"`
Privacy string `hcl:"privacy,optional" default:"secret" validate:"oneof=secret closed"`
ParentTeamId int64 `hcl:"parent_team_id,optional" default:"-1"`
LdapDistinguishedName string `hcl:"ldap_dn,optional"`
CreateDefaultMaintainer bool `hcl:"create_default_maintainer,optional" default:"false"`
}
func (*GitHubTeamFix) Apply ¶ added in v0.3.0
func (g *GitHubTeamFix) Apply() error
func (*GitHubTeamFix) Type ¶ added in v0.3.0
func (g *GitHubTeamFix) Type() string
type GitHubTeamMembersFix ¶ added in v0.3.0
type GitHubTeamMembersFix struct {
*golden.BaseBlock
*BaseFix
Owner string `hcl:"owner"`
TeamSlug string `hcl:"team_slug"`
PruneExtraMembers bool `hcl:"prune_extra_members,optional" default:"false"`
Members []TeamMember `hcl:"member,block"`
}
func (GitHubTeamMembersFix) Apply ¶ added in v0.3.0
func (g GitHubTeamMembersFix) Apply() error
func (GitHubTeamMembersFix) Type ¶ added in v0.3.0
func (g GitHubTeamMembersFix) Type() string
type GitHubTeamRepositoryFix ¶ added in v0.3.0
type GitHubTeamRepositoryFix struct {
*golden.BaseBlock
*BaseFix
Owner string `hcl:"owner"`
RepoName string `hcl:"repo_name"`
Teams []TeamRepositoryBinding `hcl:"team,block"`
}
func (*GitHubTeamRepositoryFix) Apply ¶ added in v0.3.0
func (g *GitHubTeamRepositoryFix) Apply() error
func (*GitHubTeamRepositoryFix) Type ¶ added in v0.3.0
func (g *GitHubTeamRepositoryFix) Type() string
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 ReviewerForGitHubRepositoryEnvironmentsFix ¶ added in v0.3.0
type RmLocalFileFix ¶
func (*RmLocalFileFix) Apply ¶
func (r *RmLocalFileFix) Apply() error
func (*RmLocalFileFix) Type ¶
func (r *RmLocalFileFix) Type() string
type TeamMember ¶ added in v0.3.0
type TeamRepositoryBinding ¶ added in v0.3.0
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_github_repository_collaborators.go
- data_github_repository_environments.go
- data_github_repository_teams.go
- data_github_team.go
- data_http.go
- fix.go
- fix_copy_file.go
- fix_git_ignore.go
- fix_github_repository_collaborators.go
- fix_github_repository_environments.go
- fix_github_team.go
- fix_github_team_members.go
- fix_github_team_repository.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
- retry.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.