Documentation
¶
Index ¶
- Variables
- func FormatLog(f logrus.Formatter)
- func NewDiskRepo(fileName string) repos.RepoList
- func VerboseLog()
- type AppliesTo
- type AppliesToJSON
- type ComplianceSettings
- type ComplianceSettingsJSON
- type Corpus
- func (c *Corpus) ForEachOwner(fn func(o Owner) error) error
- func (c *Corpus) ForEachOwnerF(fn func(o Owner) error, filter func(o Owner) bool) error
- func (c *Corpus) ForEachOwnerFSort(fn func(o Owner) error, filter func(o Owner) bool, ...) error
- func (c *Corpus) ForEachRepo(fn func(r Repository) error) error
- func (c *Corpus) ForEachRepoF(fn func(r Repository) error, filter func(r Repository) bool) error
- func (c *Corpus) ForEachRepoFSort(fn func(r Repository) error, filter func(r Repository) bool, ...) error
- func (c *Corpus) Initialize(ctx context.Context, ghClient *githubservices.Client) error
- func (c *Corpus) SyncLoop(ctx context.Context, minutes int, ghClient *githubservices.Client) error
- func (c *Corpus) TrackRepo(ctx context.Context, ownerName string, repoName string, ...) error
- type Owner
- type Repository
- type RespondersJSON
- type SLORule
Constants ¶
This section is empty.
Variables ¶
var ErrGoGitHub = errors.New("an error came from go github")
ErrGoGitHub is a sentinel error against which to check github.ErrorResponse errors
var ErrNoContent = errors.New("no content found")
ErrNoContent is a sentinel error representing the github.RepositoryContent is nil
var ErrNotAFile = errors.New("not a file")
ErrNotAFile is a sentinel error representing that the github.RepositoryContent is not a file
var ErrRepoAlreadyTracked = errors.New("Already tracked")
ErrRepoAlreadyTracked is a sentinel error which indicates the repository is already tracked by the owner
Functions ¶
func NewDiskRepo ¶
NewDiskRepo returns a RepoList based on a local file
Types ¶
type AppliesTo ¶
type AppliesTo struct { GitHubLabels []string `json:"gitHubLabels"` ExcludedGitHubLabels []string `json:"excludedGitHubLabels"` Issues bool `json:"issues"` PRs bool `json:"prs"` }
AppliesTo stores structured data on which issues and/or pull requests a SLO applies to
type AppliesToJSON ¶
type AppliesToJSON struct { GitHubLabelsRaw stringOrArray `json:"gitHubLabels"` ExcludedGitHubLabelsRaw stringOrArray `json:"excludedGitHubLabels"` Issues bool `json:"issues"` PRs bool `json:"prs"` }
AppliesToJSON is the intermediary struct between the JSON representation and the structured leif representation that stores structured data on which issues and/or pull requests a SLO applies to
type ComplianceSettings ¶
type ComplianceSettings struct { ResponseTime time.Duration `json:"responseTime"` ResolutionTime time.Duration `json:"resolutionTime"` RequiresAssignee bool `json:"requiresAssignee"` Responders []string `json:"responders"` }
ComplianceSettings stores data on the requirements for an issue or pull request to be considered compliant with the SLO
type ComplianceSettingsJSON ¶
type ComplianceSettingsJSON struct { ResponseTime duration `json:"responseTime"` ResolutionTime duration `json:"resolutionTime"` RequiresAssignee bool `json:"requiresAssignee"` RespondersJSON RespondersJSON `json:"responders"` }
ComplianceSettingsJSON is the intermediary struct between the JSON representation and the structured leif representation that stores data on the requirements for an issue or pull request to be considered compliant with the SLO
type Corpus ¶
type Corpus struct {
// contains filtered or unexported fields
}
Corpus holds all of a project's metadata.
func (*Corpus) ForEachOwner ¶
ForEachOwner iterates over the set of owners and performs the given function on each and returns the first non-nil error it receives.
func (*Corpus) ForEachOwnerF ¶
ForEachOwnerF iterates over the set of owners that match the given filter and performs the given function on them, and returns the first non-nil error.
func (*Corpus) ForEachOwnerFSort ¶
func (c *Corpus) ForEachOwnerFSort(fn func(o Owner) error, filter func(o Owner) bool, sortfn func(owners []*Owner) func(i, j int) bool) error
ForEachOwnerFSort iterates over the set of owners that match the given filter and performs the given function on them in the order given by the given sort func. Returns the first non-nil error it receives.
func (*Corpus) ForEachRepo ¶
func (c *Corpus) ForEachRepo(fn func(r Repository) error) error
ForEachRepo iterates over the set of repositories and performs the given function on each and returns the first non-nil error it receives.
func (*Corpus) ForEachRepoF ¶
func (c *Corpus) ForEachRepoF(fn func(r Repository) error, filter func(r Repository) bool) error
ForEachRepoF iterates over the set of repositories that match the given filter and performs the given function on them, and returns the first non-nil error it receives.
func (*Corpus) ForEachRepoFSort ¶
func (c *Corpus) ForEachRepoFSort(fn func(r Repository) error, filter func(r Repository) bool, sortfn func([]*Repository) func(i, j int) bool) error
ForEachRepoFSort iterates over the set of repositories that match the given filter and performs the given function on them in the order given by the given sort func. Returns the first non-nil error it receives.
func (*Corpus) Initialize ¶
Initialize should be the first call to the corpus to do the initial synchronization of the corpus's repos
type Owner ¶
type Owner struct { Repos []*Repository SLORules []*SLORule // contains filtered or unexported fields }
Owner represents a GitHub owner and their tracked repositories Owners can specify default SLO rules that will apply to all tracked repos unless the repository overrides them with its own SLO rules config
func (*Owner) Update ¶
Update reaches out to GitHub to update the SLO rules for the owner, then updates the SLO rules for each tracked repository under the owner
func (*Owner) UpdateLoop ¶
UpdateLoop updates the owner and their tracked repositories every given amount of minutes
type Repository ¶
type Repository struct { SLORules []*SLORule // contains filtered or unexported fields }
Repository represents a GitHub repository and stores its SLO rules
func (*Repository) OwnerName ¶
func (r *Repository) OwnerName() string
OwnerName returns the name of the repository's owner
func (*Repository) RepoName ¶
func (r *Repository) RepoName() string
RepoName returns the repository's name
func (*Repository) Update ¶
func (r *Repository) Update(ctx context.Context, owner Owner, ghClient *githubservices.Client) error
Update reaches out to GitHub to update the SLO rules for the repository
type RespondersJSON ¶
type RespondersJSON struct { Owners stringOrArray `json:"owners"` Contributors string `json:"contributors"` Users []string `json:"users"` }
RespondersJSON is the intermediary struct between the JSON representation and the structured leif representation that stores structured data on the responders to the issue or pull request the SLO applies to
func (RespondersJSON) MarshalJSON ¶
func (r RespondersJSON) MarshalJSON() ([]byte, error)
MarshalJSON for responders marshals only the users field into a single array of strings Call prepareForMarshalling before marshalling to get all responders in the marshalled data
type SLORule ¶
type SLORule struct { AppliesTo AppliesTo `json:"appliesTo"` ComplianceSettings ComplianceSettings `json:"complianceSettings"` }
SLORule represents a service level objective (SLO) rule