models

package
v0.0.0-...-d9b5379 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSchemaVersion               = "1.0.0"
	EventTypeDomainEvent             = "event.domain"
	EventTypeArtefactRequestSubject  = "event.artefact.request"
	EventTypeArtefactResponseSubject = "event.artefact.response"

	DomainEventTypeCreated = "event.type.created"
	DomainEventTypeUpdated = "event.type.updated"
	DomainEventTypeDeleted = "event.type.deleted"
)

Variables

View Source
var (
	ArtefactSourceTypeMaven2   = config_api.GatewayUpstreamType_Maven.String()
	ArtefactSourceTypeNpm      = config_api.GatewayUpstreamType_Npm.String()
	ArtefactSourceTypePypi     = config_api.GatewayUpstreamType_PyPI.String()
	ArtefactSourceTypeRubyGems = config_api.GatewayUpstreamType_RubyGems.String()

	ArtefactLicenseTypeSpdx      = "SPDX"
	ArtefactLicenseTypeCycloneDx = "CycloneDX"

	ArtefactVulnerabilitySeverityCritical = "CRITICAL"
	ArtefactVulnerabilitySeverityHigh     = "HIGH"
	ArtefactVulnerabilitySeverityMedium   = "MEDIUM"
	ArtefactVulnerabilitySeverityLow      = "LOW"
	ArtefactVulnerabilitySeverityInfo     = "INFO"

	ArtefactVulnerabilityScoreTypeCVSSv3 = "CVSSv3"
)

Functions

func NewArtefactRequestEvent

func NewArtefactRequestEvent(a Artefact, src string) *gen.TapArtefactRequestEvent

func NewSpecEventHeader

func NewSpecEventHeader(tp event_api.EventType, source string) *event_api.EventHeader

func NewSpecHeaderWithContext

func NewSpecHeaderWithContext(tp event_api.EventType, source string, ctx *event_api.EventContext) *event_api.EventHeader

Types

type Artefact

type Artefact struct {
	Source  ArtefactSource `json:"source"`
	Group   string         `json:"group"`
	Name    string         `json:"name"`
	Version string         `json:"version"`
}

func GetArtefactByHostAndPath

func GetArtefactByHostAndPath(host, path string) (Artefact, error)

func NewArtefact

func NewArtefact(src ArtefactSource, name, group, version string) Artefact

func (Artefact) OpenSsfEcosystem

func (a Artefact) OpenSsfEcosystem() string

func (Artefact) OpenSsfPackageName

func (a Artefact) OpenSsfPackageName() string

func (Artefact) OpenSsfPackageVersion

func (a Artefact) OpenSsfPackageVersion() string

type ArtefactLicense

type ArtefactLicense struct {
	Type string `json:"type"` // SPDX | CyloneDX
	Id   string `json:"id"`   // SPDX or CycloneDX ID
	Name string `json:"name"` // Human Readable Name
}

Align with SPDX / CycloneDX

type ArtefactRepository

type ArtefactRepository struct {
	Host           string                           `yaml:"host"`
	Port           int16                            `yaml:"port"`
	Tls            bool                             `yaml:"tls"`
	Sni            string                           `yaml:"sni"`
	Authentication ArtefactRepositoryAuthentication `yaml:"authentication"`
}

type ArtefactRepositoryAuthentication

type ArtefactRepositoryAuthentication struct {
	Type string `yaml:"type"`
}

type ArtefactRoutingRule

type ArtefactRoutingRule struct {
	Prefix string `yaml:"prefix"`
	Host   string `yaml:"host"`
}

type ArtefactSource

type ArtefactSource struct {
	Type string `json:"type"`
}

type ArtefactUpStream

type ArtefactUpStream struct {
	Name           string                         `yaml:"name"`
	Type           string                         `yaml:"type"`
	RoutingRule    ArtefactRoutingRule            `yaml:"route"`
	Repository     ArtefactRepository             `yaml:"repository"`
	Authentication ArtefactUpstreamAuthentication `yaml:"authentication"`
}

func GetUpstreamByHostAndPath

func GetUpstreamByHostAndPath(host, path string) (ArtefactUpStream, error)

func ToUpstream

Stop gap method to map a spec based upstream into legacy upstream

func (ArtefactUpStream) MatchHost

func (s ArtefactUpStream) MatchHost(host string) bool

func (ArtefactUpStream) MatchPath

func (s ArtefactUpStream) MatchPath(path string) bool

func (ArtefactUpStream) NeedAuthentication

func (s ArtefactUpStream) NeedAuthentication() bool

func (ArtefactUpStream) NeedUpstreamAuthentication

func (s ArtefactUpStream) NeedUpstreamAuthentication() bool

func (ArtefactUpStream) Path2Artefact

func (s ArtefactUpStream) Path2Artefact(path string) (Artefact, error)

Resolve an HTTP request path for this artefact into an Artefact model

type ArtefactUpstreamAuthentication

type ArtefactUpstreamAuthentication struct {
	Type     string `yaml:"type"`
	Provider string `yaml:"provider"`
}

func (ArtefactUpstreamAuthentication) IsBasic

func (ArtefactUpstreamAuthentication) IsNoAuth

func (s ArtefactUpstreamAuthentication) IsNoAuth() bool

type ArtefactVulnerability

type ArtefactVulnerability struct {
	Name     string                       `json:"name"`
	Id       ArtefactVulnerabilityId      `json:"id"`
	Severity string                       `json:"severity"`
	Scores   []ArtefactVulnerabilityScore `json:"scores"`
}

type ArtefactVulnerabilityId

type ArtefactVulnerabilityId struct {
	Source string `json:"source"`
	Id     string `json:"id"`
}

Align with CVE but keep room for enhancement

type ArtefactVulnerabilityScore

type ArtefactVulnerabilityScore struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

Align with CVSS v3 but keep room

type DomainEvent

type DomainEvent[T any] struct {
	MetaEventWithAttributes `json:"meta"`
	Data                    T `json:"data"`
}

type DomainEventBuilder

type DomainEventBuilder[T any] interface {
	Created(v T) DomainEvent[T]
	Updated(v T) DomainEvent[T]
	Deleted(v T) DomainEvent[T]
	From(v interface{}) (DomainEvent[T], error)
}

type MetaAttributes

type MetaAttributes struct {
	Attributes map[string]string `json:"attributes"`
}

type MetaEvent

type MetaEvent struct {
	Version string `json:"version"`
	Type    string `json:"type"`
}

type MetaEventWithAttributes

type MetaEventWithAttributes struct {
	MetaEvent
	MetaAttributes
}

func (MetaEventWithAttributes) Serialize

func (m MetaEventWithAttributes) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

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