controller

package
v0.1.0-0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, param Param) (Controller, Param, error)

Types

type Config

type Config struct {
	Owner string `yaml:"org_name"`
	Repo  RepoConfig
	Org   OrgConfig
}

type Controller

type Controller struct {
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Config  Config
	DataDog *datadog.Client
	Rules   []Rule
}

func (*Controller) RunOrg

func (ctrl *Controller) RunOrg(ctx context.Context, param Param) error

func (*Controller) RunRepo

func (ctrl *Controller) RunRepo(ctx context.Context, param Param) error

type NewOrgPolicy

type NewOrgPolicy func(param map[string]interface{}, action domain.ActionConfig) (domain.OrgPolicy, error)

type NewRepoPolicy

type NewRepoPolicy func(param map[string]interface{}, action domain.ActionConfig) (domain.RepoPolicy, error)

type OrgConfig

type OrgConfig struct {
	Rules []OrgRule
}

type OrgRule

type OrgRule struct {
	Policy domain.OrgPolicy
}

func (*OrgRule) UnmarshalYAML

func (rule *OrgRule) UnmarshalYAML(unmarshal func(interface{}) error) error

type Param

type Param struct {
	ConfigFilePath string
	LogLevel       string
	Owner          string
	GitHubToken    string
	DataDogAPIKey  string
	DryRun         bool
}

type PolicyConfig

type PolicyConfig struct {
	Type  string
	Param map[string]interface{}
}

type RepoConfig

type RepoConfig struct {
	Rules []Rule
}

type Rule

type Rule struct {
	Policy domain.RepoPolicy
	Target Target
}

func (*Rule) UnmarshalYAML

func (rule *Rule) UnmarshalYAML(unmarshal func(interface{}) error) error

type RuleConfig

type RuleConfig struct {
	Policy PolicyConfig
	Target Target
	Action domain.ActionConfig
}

type Target

type Target struct {
	Patterns []TargetPattern
}

func (*Target) Match

func (target *Target) Match(repo domain.Repository) (bool, error)

func (*Target) UnmarshalYAML

func (target *Target) UnmarshalYAML(unmarshal func(interface{}) error) error

type TargetPattern

type TargetPattern struct {
	Not     bool
	Pattern string
}

func (*TargetPattern) Match

func (target *TargetPattern) Match(repo domain.Repository) (bool, error)

Jump to

Keyboard shortcuts

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