lib

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectURL

func BuildConnectURL(projectID string) string

func BuildOverviewURL

func BuildOverviewURL(projectID string) string

func BuildScanResultsURL

func BuildScanResultsURL(projectID string, imageID string) string

func GetContainerPolicyExceptions

func GetContainerPolicyExceptions(ctx context.Context, pc PyxisClient) (policy.Policy, error)

GetContainerPolicyExceptions will query Pyxis to determine if a given project has a certification excemptions, such as root or scratch. This will then return the corresponding policy.

If no policy exception flags are found on the project, the standard container policy is returned.

func PreflightCheck

PreflightCheck executes checks, interacts with pyxis, format output, writes, and submits results.

Types

type CheckContainerRunner

type CheckContainerRunner struct {
	Cfg       *runtime.Config
	Pc        PyxisClient
	Eng       engine.CheckEngine
	Formatter formatters.ResponseFormatter
	Rw        ResultWriter
	Rs        ResultSubmitter
}

CheckContainerRunner contains all of the components necessary to run checkContainer.

func NewCheckContainerRunner

func NewCheckContainerRunner(ctx context.Context, cfg *runtime.Config, submit bool) (*CheckContainerRunner, error)

type CheckOperatorRunner

type CheckOperatorRunner struct {
	Cfg       *runtime.Config
	Eng       engine.CheckEngine
	Formatter formatters.ResponseFormatter
	Rw        ResultWriter
}

CheckOperatorRunner contains all of the components necessary to run checkOperator.

func NewCheckOperatorRunner

func NewCheckOperatorRunner(ctx context.Context, cfg *runtime.Config) (*CheckOperatorRunner, error)

NewCheckOperatorRunner returns a CheckOperatorRunner containing all of the tooling necessary to run checkOperator.

type ContainerCertificationSubmitter

type ContainerCertificationSubmitter struct {
	CertificationProjectID string
	Pyxis                  PyxisClient
	DockerConfig           string
	PreflightLogFile       string
}

ContainerCertificationSubmitter submits container results to Pyxis, and implements a ResultSubmitter.

func (*ContainerCertificationSubmitter) Submit

type NoopSubmitter

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

NoopSubmitter is a no-op ResultSubmitter that optionally logs a message and a reason as to why results were not submitted.

func NewNoopSubmitter

func NewNoopSubmitter(emitLog bool, reason string, log *log.Logger) *NoopSubmitter

func (*NoopSubmitter) SetEmitLog

func (s *NoopSubmitter) SetEmitLog(emitLog bool)

func (*NoopSubmitter) SetReason

func (s *NoopSubmitter) SetReason(reason string)

func (*NoopSubmitter) Submit

func (s *NoopSubmitter) Submit(ctx context.Context) error

type PyxisClient

type PyxisClient interface {
	FindImagesByDigest(ctx context.Context, digests []string) ([]pyxis.CertImage, error)
	GetProject(context.Context) (*pyxis.CertProject, error)
	SubmitResults(context.Context, *pyxis.CertificationInput) (*pyxis.CertificationResults, error)
}

PyxisClient defines pyxis API interactions that are relevant to check executions in cmd.

func NewPyxisClient

func NewPyxisClient(ctx context.Context, cfg certification.Config) PyxisClient

newPyxisClient initializes a pyxisClient with relevant information from cfg. If the the CertificationProjectID, PyxisAPIToken, or PyxisHost are empty, then nil is returned. Callers should treat a nil pyxis client as an indicator that pyxis calls should not be made.

type ResultSubmitter

type ResultSubmitter interface {
	Submit(context.Context) error
}

ResultSubmitter defines methods associated with submitting results to Red HAt.

func ResolveSubmitter

func ResolveSubmitter(pc PyxisClient, cfg certification.Config) ResultSubmitter

ResolveSubmitter will build out a ResultSubmitter if the provided pyxisClient, pc, is not nil. The pyxisClient is a required component of the submitter. If pc is nil, then a noop submitter is returned instead, which does nothing.

type ResultWriter

type ResultWriter interface {
	OpenFile(name string) (io.WriteCloser, error)
	io.WriteCloser
}

ResultWriter defines methods associated with writing check results.

Jump to

Keyboard shortcuts

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