weldr

package
v0.0.0-...-6310115 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Package weldr - json contains Exported API request/response structures Copyright (C) 2020 by Red Hat, Inc.

Index

Constants

This section is empty.

Variables

View Source
var ValidBlueprintName = regexp.MustCompile(`^[a-zA-Z0-9._-]+$`)

Functions

This section is empty.

Types

type API

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

func New

func New(rr *reporegistry.RepoRegistry, stateDir string, solver *dnfjson.BaseSolver, df *distrofactory.Factory,
	logger *log.Logger, workers *worker.Server, distrosImageTypeDenylist map[string][]string) (*API, error)

func NewTestAPI

func NewTestAPI(solver *dnfjson.BaseSolver, rr *reporegistry.RepoRegistry,
	logger *log.Logger, storeFixture *store.Fixture, workers *worker.Server,
	compatOutputDir string, distrosImageTypeDenylist map[string][]string) *API

NewTestAPI is used for the test framework, sets up a single distro

func (*API) PreloadMetadata

func (api *API) PreloadMetadata()

PreloadMetadata loads the metadata for all supported distros This starts a background depsolve for all known distros in order to preload the metadata.

func (*API) Serve

func (api *API) Serve(listener net.Listener) error

func (*API) ServeHTTP

func (api *API) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*API) Shutdown

func (api *API) Shutdown(ctx context.Context) error

type BlueprintsChangesV0

type BlueprintsChangesV0 struct {
	BlueprintsChanges []bpChange      `json:"blueprints"`
	Errors            []ResponseError `json:"errors"`
	Limit             uint            `json:"limit"`
	Offset            uint            `json:"offset"`
}

BlueprintsChangesV0 is the response to /blueprints/changes/ request

type BlueprintsChangesV0Weldr

type BlueprintsChangesV0Weldr struct {
	Body BlueprintsChangesV0 `json:"body"`
}

BlueprintsChangesV0Weldr is the response to /blueprints/changes/ request using weldr-client

type BlueprintsDepsolveV0

type BlueprintsDepsolveV0 struct {
	Blueprints []depsolveEntry `json:"blueprints"`
	Errors     []ResponseError `json:"errors"`
}

BlueprintsDepsolveV0 is the response to /blueprints/depsolve/ request

type BlueprintsFreezeV0

type BlueprintsFreezeV0 struct {
	Blueprints []blueprintFrozen `json:"blueprints"`
	Errors     []ResponseError   `json:"errors"`
}

BlueprintsFreezeV0 is the response to /blueprints/freeze/ request

type BlueprintsInfoV0

type BlueprintsInfoV0 struct {
	Blueprints []blueprint.Blueprint `json:"blueprints"`
	Changes    []infoChange          `json:"changes"`
	Errors     []ResponseError       `json:"errors"`
}

BlueprintsInfoV0 is the response to /blueprints/info?format=json request

type BlueprintsListV0

type BlueprintsListV0 struct {
	Total      uint     `json:"total"`
	Offset     uint     `json:"offset"`
	Limit      uint     `json:"limit"`
	Blueprints []string `json:"blueprints"`
}

BlueprintsListV0 is the response to /blueprints/list request

type CancelComposeStatusV0

type CancelComposeStatusV0 struct {
	UUID   uuid.UUID `json:"uuid"`
	Status bool      `json:"status"`
}

type ComposeEntry

type ComposeEntry struct {
	ID          uuid.UUID              `json:"id"`
	Blueprint   string                 `json:"blueprint"`
	Version     string                 `json:"version"`
	ComposeType string                 `json:"compose_type"`
	ImageSize   uint64                 `json:"image_size"` // This is user-provided image size, not actual file size
	QueueStatus common.ImageBuildState `json:"queue_status"`
	JobCreated  float64                `json:"job_created"`
	JobStarted  float64                `json:"job_started,omitempty"`
	JobFinished float64                `json:"job_finished,omitempty"`
	Uploads     []uploadResponse       `json:"uploads,omitempty"`
}

type ComposeEntryV0

type ComposeEntryV0 struct {
	ID          uuid.UUID              `json:"id"`
	Blueprint   string                 `json:"blueprint"`
	Version     string                 `json:"version"`
	ComposeType string                 `json:"compose_type"`
	ImageSize   uint64                 `json:"image_size"` // This is user-provided image size, not actual file size
	QueueStatus common.ImageBuildState `json:"queue_status"`
	JobCreated  float64                `json:"job_created"`
	JobStarted  float64                `json:"job_started,omitempty"`
	JobFinished float64                `json:"job_finished,omitempty"`
	Uploads     []uploadResponse       `json:"uploads,omitempty"`
}

This is similar to weldr.ComposeEntry but different because internally the image types are capitalized

type ComposeFailedResponseV0

type ComposeFailedResponseV0 struct {
	Failed []ComposeEntryV0 `json:"failed"`
}

type ComposeFinishedResponseV0

type ComposeFinishedResponseV0 struct {
	Finished []ComposeEntryV0 `json:"finished"`
}

type ComposeInfoResponseV0

type ComposeInfoResponseV0 struct {
	ID        uuid.UUID            `json:"id"`
	Blueprint *blueprint.Blueprint `json:"blueprint"` // blueprint not frozen!
	Commit    string               `json:"commit"`    // empty for now
	Deps      struct {
		Packages []rpmmd.Package `json:"packages"`
	} `json:"deps"`
	ComposeType string           `json:"compose_type"`
	QueueStatus string           `json:"queue_status"`
	ImageSize   uint64           `json:"image_size"`
	Uploads     []uploadResponse `json:"uploads,omitempty"`
}

NOTE: This does not include the lorax-composer specific 'config' field

type ComposeQueueResponseV0

type ComposeQueueResponseV0 struct {
	New []ComposeEntryV0 `json:"new"`
	Run []ComposeEntryV0 `json:"run"`
}

type ComposeRequestV0

type ComposeRequestV0 struct {
	BlueprintName string `json:"blueprint_name"`
	ComposeType   string `json:"compose_type"`
	Branch        string `json:"branch"`
}

type ComposeResponseV0

type ComposeResponseV0 struct {
	BuildID uuid.UUID `json:"build_id"`
	Status  bool      `json:"status"`
}

type ComposeState

type ComposeState int
const (
	ComposeWaiting ComposeState = iota
	ComposeRunning
	ComposeFinished
	ComposeFailed
)

func (ComposeState) ToString

func (cs ComposeState) ToString() string

ToString converts ImageBuildState into a human readable string

type ComposeStatusResponseV0

type ComposeStatusResponseV0 struct {
	UUIDs []ComposeEntryV0 `json:"uuids"`
}

type ComposeTypeV0

type ComposeTypeV0 struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
}

type ComposeTypesResponseV0

type ComposeTypesResponseV0 struct {
	Types []ComposeTypeV0 `json:"types"`
}

type DeleteComposeResponseV0

type DeleteComposeResponseV0 struct {
	UUIDs  []DeleteComposeStatusV0 `json:"uuids"`
	Errors []ResponseError         `json:"errors"`
}

type DeleteComposeStatusV0

type DeleteComposeStatusV0 struct {
	UUID   uuid.UUID `json:"uuid"`
	Status bool      `json:"status"`
}

type ModuleName

type ModuleName struct {
	Name      string `json:"name"`
	GroupType string `json:"group_type"`
}

type ModulesInfoV0

type ModulesInfoV0 struct {
	Modules []rpmmd.PackageInfo `json:"modules"`
}

ModulesInfoV0 is the response to /modules/info request

type ModulesListV0

type ModulesListV0 struct {
	Total   uint         `json:"total"`
	Offset  uint         `json:"offset"`
	Limit   uint         `json:"limit"`
	Modules []ModuleName `json:"modules"`
}

type ProjectsDependenciesV0

type ProjectsDependenciesV0 struct {
	Projects []rpmmd.PackageSpec `json:"projects"`
}

ProjectsDependenciesV0 is the response to /projects/depsolve request

type ProjectsInfoV0

type ProjectsInfoV0 struct {
	Projects []rpmmd.PackageInfo `json:"projects"`
}

ProjectsInfoV0 is the response to /projects/info request

type ProjectsListV0

type ProjectsListV0 struct {
	Total    uint                `json:"total"`
	Offset   uint                `json:"offset"`
	Limit    uint                `json:"limit"`
	Projects []rpmmd.PackageInfo `json:"projects"`
}

ProjectsListV0 is the response to /projects/list request

type ResponseError

type ResponseError struct {
	Code int    `json:"code,omitempty"`
	ID   string `json:"id"`
	Msg  string `json:"msg"`
}

ResponseError holds the API response error details

type SourceConfig

type SourceConfig interface {
	GetKey() string
	GetName() string
	GetType() string
	SourceConfig() store.SourceConfig
}

SourceConfig interface defines the common functions needed to query the SourceConfigV0/V1 structs

type SourceConfigV0

type SourceConfigV0 struct {
	Name           string   `json:"name" toml:"name"`
	Type           string   `json:"type" toml:"type"`
	URL            string   `json:"url" toml:"url"`
	CheckGPG       bool     `json:"check_gpg" toml:"check_gpg"`
	CheckSSL       bool     `json:"check_ssl" toml:"check_ssl"`
	System         bool     `json:"system" toml:"system"`
	Proxy          string   `json:"proxy,omitempty" toml:"proxy,omitempty"`
	GPGKeys        []string `json:"gpgkeys,omitempty" toml:"gpgkeys,omitempty"`
	ModuleHotfixes *bool    `json:"module_hotfixes,omitempty"`
}

SourceConfigV0 holds the source repository information

func DecodeSourceConfigV0

func DecodeSourceConfigV0(body io.Reader, contentType string) (source SourceConfigV0, err error)

DecodeSourceConfigV0 parses a request.Body into a SourceConfigV0

func NewSourceConfigV0

func NewSourceConfigV0(s store.SourceConfig) SourceConfigV0

NewSourceConfigV0 converts a store.SourceConfig to a SourceConfigV0 The store does not support proxy and gpgkeys

func (SourceConfigV0) GetKey

func (s SourceConfigV0) GetKey() string

Key return the key, .Name in this case

func (SourceConfigV0) GetName

func (s SourceConfigV0) GetName() string

Name return the .Name field

func (SourceConfigV0) GetType

func (s SourceConfigV0) GetType() string

Type return the .Type field

func (SourceConfigV0) SourceConfig

func (s SourceConfigV0) SourceConfig() (ssc store.SourceConfig)

SourceConfig returns a SourceConfig struct populated with the supported variables The store does not support proxy and gpgkeys

type SourceConfigV1

type SourceConfigV1 struct {
	ID             string   `json:"id" toml:"id"`
	Name           string   `json:"name" toml:"name"`
	Type           string   `json:"type" toml:"type"`
	URL            string   `json:"url" toml:"url"`
	CheckGPG       bool     `json:"check_gpg" toml:"check_gpg"`
	CheckSSL       bool     `json:"check_ssl" toml:"check_ssl"`
	System         bool     `json:"system" toml:"system"`
	Proxy          string   `json:"proxy,omitempty" toml:"proxy,omitempty"`
	GPGKeys        []string `json:"gpgkeys,omitempty" toml:"gpgkeys,omitempty"`
	Distros        []string `json:"distros,omitempty" toml:"distros,omitempty"`
	RHSM           bool     `json:"rhsm" toml:"rhsm"`
	CheckRepoGPG   bool     `json:"check_repogpg" toml:"check_repogpg"`
	ModuleHotfixes *bool    `json:"module_hotfixes,omitempty" toml:"module_hotfixes,omitempty"`
}

SourceConfigV1 holds the source repository information

func DecodeSourceConfigV1

func DecodeSourceConfigV1(body io.Reader, contentType string) (source SourceConfigV1, err error)

DecodeSourceConfigV1 parses a request.Body into a SourceConfigV1

func NewSourceConfigV1

func NewSourceConfigV1(id string, s store.SourceConfig) SourceConfigV1

NewSourceConfigV1 converts a store.SourceConfig to a SourceConfigV1 The store does not support proxy and gpgkeys

func (SourceConfigV1) GetKey

func (s SourceConfigV1) GetKey() string

Key returns the key, .ID in this case

func (SourceConfigV1) GetName

func (s SourceConfigV1) GetName() string

Name return the .Name field

func (SourceConfigV1) GetType

func (s SourceConfigV1) GetType() string

Type return the .Type field

func (SourceConfigV1) SourceConfig

func (s SourceConfigV1) SourceConfig() (ssc store.SourceConfig)

SourceConfig returns a SourceConfig struct populated with the supported variables The store does not support proxy and gpgkeys

type SourceInfoResponseV0

type SourceInfoResponseV0 struct {
	Sources map[string]SourceConfigV0 `json:"sources"`
	Errors  []responseError           `json:"errors"`
}

SourceInfoResponseV0

type SourceInfoResponseV1

type SourceInfoResponseV1 struct {
	Sources map[string]SourceConfigV1 `json:"sources"`
	Errors  []responseError           `json:"errors"`
}

SourceInfoResponseV1

type SourceInfoV0

type SourceInfoV0 struct {
	Sources map[string]SourceConfigV0 `json:"sources"`
	Errors  []ResponseError           `json:"errors"`
}

SourceInfoV0 is the response to a /source/info request

func (*SourceInfoV0) SourceConfig

func (s *SourceInfoV0) SourceConfig(sourceName string) (ssc store.SourceConfig, ok bool)

SourceConfig returns a SourceConfig struct populated with the supported variables

type SourceListV0

type SourceListV0 struct {
	Sources []string `json:"sources"`
}

SourceListV0 is the response to /source/list request

type SourceListV1

type SourceListV1 struct {
	Sources []string `json:"sources"`
}

SourceListV1 is the response to /source/list request

type StatusV0

type StatusV0 struct {
	API           string   `json:"api"`
	DBSupported   bool     `json:"db_supported"`
	DBVersion     string   `json:"db_version"`
	SchemaVersion string   `json:"schema_version"`
	Backend       string   `json:"backend"`
	Build         string   `json:"build"`
	Messages      []string `json:"messages"`
}

StatusV0 is the response to /api/status from a v0+ server

Jump to

Keyboard shortcuts

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