controller

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound error = errors.New("configuration file isn't found")

Functions

func New

func New(ctx context.Context, params Params) (Controller, Params, error)

Types

type Controller

type Controller struct {
	GitHub  GitHub
	DataDog DataDog
	Stdout  io.Writer
	Stderr  io.Writer
}

func (Controller) CheckRepo

func (ctrl Controller) CheckRepo(ctx context.Context, repo Repo) (bool, error)

func (Controller) CheckRun

func (ctrl Controller) CheckRun(ctx context.Context, repo Repo) (bool, error)

func (Controller) CheckStatus

func (ctrl Controller) CheckStatus(ctx context.Context, repo Repo) (bool, error)

func (Controller) CheckSuite

func (ctrl Controller) CheckSuite(ctx context.Context, repo Repo) (bool, error)

func (Controller) Run

func (ctrl Controller) Run(ctx context.Context, params Params) error

type DataDog

type DataDog interface {
	Check(ctx context.Context, params datadog.ParamCheck) (*http.Response, error)
}

type ExistFile

type ExistFile func(string) bool

type GitHub

type GitHub interface {
	GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *github.ListOptions) (*github.CombinedStatus, *github.Response, error)
	ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *github.ListCheckRunsOptions) (*github.ListCheckRunsResults, *github.Response, error)
	ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *github.ListCheckSuiteOptions) (*github.ListCheckSuiteResults, *github.Response, error)
}

type Params

type Params struct {
	Repos         []Repo
	GitHubToken   string `yaml:"github_token"`
	DataDogAPIKey string `yaml:"datadog_api_key"`
	LogLevel      string `yaml:"log_level"`
	CheckName     string `yaml:"check_name"`
	Tags          map[string]string
}

type Reader

type Reader struct {
	ExistFile ExistFile
}

func (Reader) FindAndRead

func (reader Reader) FindAndRead(cfgPath, wd string) (Params, string, error)

type Repo

type Repo struct {
	Owner      string
	Repo       string
	Ref        string
	Status     bool
	CheckRun   bool `yaml:"check_run"`
	CheckSuite bool `yaml:"check_suite"`
	Tags       map[string]string
}

Jump to

Keyboard shortcuts

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