pyxis

package
v0.0.0-...-77eaac7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPyxis409StatusCode = errors.New("pyxis API returned a conflict")

Functions

func NewPyxisClient

func NewPyxisClient(pyxisHost string, apiToken string, projectID string, httpClient HTTPClient) *pyxisClient

Types

type Artifact

type Artifact struct {
	ID          string `json:"_id"`
	CertProject string `json:"cert_project"`
	Content     string `json:"content"`
	ContentType string `json:"content_type"`
	FileSize    int64  `json:"file_size"`
	Filename    string `json:"filename"`
	ImageID     string `json:"image_id"`
}

type CertImage

type CertImage struct {
	ID                     string           `json:"_id,omitempty"`
	Certified              bool             `json:"certified"`
	Deleted                bool             `json:"deleted" default:"false"`
	DockerImageDigest      string           `json:"docker_image_digest,omitempty"`
	DockerImageID          string           `json:"docker_image_id,omitempty"`
	ImageID                string           `json:"image_id,omitempty"`
	ISVPID                 string           `json:"isv_pid,omitempty"` // required
	ParsedData             *ParsedData      `json:"parsed_data,omitempty"`
	Architecture           string           `json:"architecture" default:"amd64"`
	RawConfig              string           `json:"raw_config,omitempty"`
	Repositories           []Repository     `json:"repositories,omitempty"`
	SumLayerSizeBytes      int64            `json:"sum_layer_size_bytes,omitempty"`
	UncompressedTopLayerID string           `json:"uncompressed_top_layer_id,omitempty"`
	FreshnessGrades        []FreshnessGrade `json:"freshness_grades,omitempty"`
}

type CertProject

type CertProject struct {
	ID                  string    `json:"_id,omitempty"`
	CertificationStatus string    `json:"certification_status" default:"In Progress"`
	Container           Container `json:"container"`
	Name                string    `json:"name"`           // required
	ProjectStatus       string    `json:"project_status"` // required
	Type                string    `json:"type,omitempty"` // required
}

func (CertProject) ScratchProject

func (cp CertProject) ScratchProject() bool

type CertificationInput

type CertificationInput struct {
	CertProject *CertProject
	CertImage   *CertImage
	TestResults *TestResults
	RpmManifest *RPMManifest
	Artifacts   []Artifact
}

func NewCertificationInput

func NewCertificationInput(ctx context.Context, project *CertProject, opts ...CertificationInputOption) (*CertificationInput, error)

NewCertificationInput accepts required values for submitting to Pyxis, and returns a CertificationInputBuilder for adding additional files as artifacts to the submission. The caller must call finalize() in order to receive a *CertificationInput.

type CertificationInputOption

type CertificationInputOption func(*certificationInputBuilder) error

func WithArtifact

func WithArtifact(r io.Reader, filename string) CertificationInputOption

WithArtifact reads from the io.Reader and binds it as an artifact to include in the submission. Multiple calls to this will append artifacts. Errors are logged, but will not halt execution. The filename parameter will be used as the Filename field in the Artifact struct. It will be sent as is. It should prepresent only the base filename.

func WithCertImage

func WithCertImage(r io.Reader) CertificationInputOption

WithCertImage adds a pyxis.CertImage from the passed io.Reader to the CertificationInput. Errors are logged, but will not halt execution.

func WithPreflightResults

func WithPreflightResults(r io.Reader) CertificationInputOption

WithPreflightResults adds formatters.UserResponse from the passed io.Reader to the CertificationInput. Errors are logged, but will not halt execution.

func WithRPMManifest

func WithRPMManifest(r io.Reader) CertificationInputOption

WithRPMManifest adds the pyxis.RPMManifest from the passed io.Reader to the CertificationInput. Errors are logged, but will not halt execution.

type CertificationResults

type CertificationResults struct {
	CertProject *CertProject
	CertImage   *CertImage
	TestResults *TestResults
}

type Container

type Container struct {
	DockerConfigJSON string `json:"docker_config_json,omitempty"`
	HostedRegistry   bool   `json:"hosted_registry,omitempty"`
	Type             string `json:"type,omitempty"`    // conditionally required
	ISVPID           string `json:"isv_pid,omitempty"` // required
	Registry         string `json:"registry,omitempty"`
	Repository       string `json:"repository,omitempty"`
	OsContentType    string `json:"os_content_type,omitempty"`
	Privileged       bool   `json:"privileged,omitempty"`
}

type FreshnessGrade

type FreshnessGrade struct {
	Grade     string
	StartDate time.Time
	EndDate   time.Time
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Label

type Label struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Layer

type Layer struct {
	LayerID string `json:"layer_id"`
	Size    int64  `json:"size_bytes"`
}

type ParsedData

type ParsedData struct {
	Architecture           string   `json:"architecture,omitempty"`
	Command                string   `json:"command,omitempty"`
	Comment                string   `json:"comment,omitempty"`
	Container              string   `json:"container,omitempty"`
	Created                string   `json:"created,omitempty"`
	DockerVersion          string   `json:"docker_version,omitempty"`
	ImageID                string   `json:"image_id,omitempty"`
	Labels                 []Label  `json:"labels,omitempty"` // required
	Layers                 []string `json:"layers,omitempty"` // required
	OS                     string   `json:"os,omitempty"`
	Ports                  string   `json:"ports,omitempty"`
	Size                   int64    `json:"size,omitempty"`
	UncompressedLayerSizes []Layer  `json:"uncompressed_layer_sizes,omitempty"`
}

type RPM

type RPM struct {
	Architecture string `json:"architecture,omitempty"`
	Gpg          string `json:"gpg,omitempty"`
	Name         string `json:"name,omitempty"`
	Nvra         string `json:"nvra,omitempty"`
	Release      string `json:"release,omitempty"`
	SrpmName     string `json:"srpm_name,omitempty"`
	SrpmNevra    string `json:"srpm_nevra,omitempty"`
	Summary      string `json:"summary,omitempty"`
	Version      string `json:"version,omitempty"`
}

type RPMManifest

type RPMManifest struct {
	ID      string `json:"_id,omitempty"`
	ImageID string `json:"image_id,omitempty"`
	RPMS    []RPM  `json:"rpms,omitempty"`
}

type Repository

type Repository struct {
	Published          bool   `json:"published" default:"false"`
	PushDate           string `json:"push_date,omitempty"` // time.Now
	Registry           string `json:"registry,omitempty"`
	Repository         string `json:"repository,omitempty"`
	Tags               []Tag  `json:"tags,omitempty"`
	ManifestListDigest string `json:"manifest_list_digest,omitempty"`
}

type Tag

type Tag struct {
	AddedDate string `json:"added_date,omitempty"` // time.Now
	Name      string `json:"name,omitempty"`
}

type TestResults

type TestResults struct {
	ID          string `json:"_id,omitempty"`
	CertProject string `json:"cert_project,omitempty"`
	OrgID       int    `json:"org_id,omitempty"`
	Version     string `json:"version,omitempty"`
	ImageID     string `json:"image_id,omitempty"`
	formatters.UserResponse
}

Jump to

Keyboard shortcuts

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