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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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