check

package
v1.0.1-gitspaces-beta Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

WireSet provides a wire set for this package.

Functions

func ProvideCheckSanitizers

func ProvideCheckSanitizers() map[enum.CheckPayloadKind]func(in *ReportInput, s *auth.Session) error

func SanitizeJSONPayload

func SanitizeJSONPayload(source json.RawMessage, data any) (json.RawMessage, error)

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(
	tx dbtx.Transactor,
	authorizer authz.Authorizer,
	repoStore store.RepoStore,
	checkStore store.CheckStore,
	git git.Interface,
	sanitizers map[enum.CheckPayloadKind]func(in *ReportInput, s *auth.Session) error,
) *Controller

func ProvideController

func ProvideController(
	tx dbtx.Transactor,
	authorizer authz.Authorizer,
	repoStore store.RepoStore,
	checkStore store.CheckStore,
	rpcClient git.Interface,
	sanitizers map[enum.CheckPayloadKind]func(in *ReportInput, s *auth.Session) error,
) *Controller

func (*Controller) ListChecks

func (c *Controller) ListChecks(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	commitSHA string,
	opts types.CheckListOptions,
) ([]types.Check, int, error)

ListChecks return an array of status check results for a commit in a repository.

func (*Controller) ListRecentChecks

func (c *Controller) ListRecentChecks(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	opts types.CheckRecentOptions,
) ([]string, error)

ListRecentChecks return an array of status check UIDs that have been run recently.

func (*Controller) Report

func (c *Controller) Report(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	commitSHA string,
	in *ReportInput,
	metadata map[string]string,
) (*types.Check, error)

Report modifies an existing or creates a new (if none yet exists) status check report for a specific commit.

type ReportInput

type ReportInput struct {
	// TODO [CODE-1363]: remove after identifier migration.
	CheckUID   string             `json:"check_uid" deprecated:"true"`
	Identifier string             `json:"identifier"`
	Status     enum.CheckStatus   `json:"status"`
	Summary    string             `json:"summary"`
	Link       string             `json:"link"`
	Payload    types.CheckPayload `json:"payload"`

	Started int64 `json:"started,omitempty"`
	Ended   int64 `json:"ended,omitempty"`
}

func (*ReportInput) Sanitize

func (in *ReportInput) Sanitize(
	sanitizers map[enum.CheckPayloadKind]func(in *ReportInput, s *auth.Session) error, session *auth.Session,
) error

Sanitize validates and sanitizes the ReportInput data.

Jump to

Keyboard shortcuts

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