api

package
v0.31.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HeaderContentType = "Content-Type"
	HeaderAccept      = "Accept"
)

Variables

View Source
var (
	MimeTypeVersion = map[string]string{"version": "1.0"}

	MimeTypeOCIImageManifest = MIMEType{
		Type:    "application",
		Subtype: "vnd.oci.image.manifest.v1+json",
	}
	MimeTypeDockerImageManifestV2 = MIMEType{
		Type:    "application",
		Subtype: "vnd.docker.distribution.manifest.v2+json",
	}
	MimeTypeScanResponse = MIMEType{
		Type:    "application",
		Subtype: "vnd.scanner.adapter.scan.response+json",
		Params:  MimeTypeVersion,
	}
	MimeTypeSecurityVulnerabilityReport = MIMEType{
		Type:    "application",
		Subtype: "vnd.security.vulnerability.report",
		Params:  map[string]string{"version": "1.1"},
	}
	MimeTypeSecuritySBOMReport = MIMEType{
		Type:    "application",
		Subtype: "vnd.security.sbom.report+json",
		Params:  map[string]string{"version": "1.0"},
	}
	MimeTypeMetadata = MIMEType{
		Type:    "application",
		Subtype: "vnd.scanner.adapter.metadata+json",
		Params:  MimeTypeVersion,
	}
	MimeTypeError = MIMEType{
		Type:    "application",
		Subtype: "vnd.scanner.adapter.error",
		Params:  MimeTypeVersion,
	}

	MediaTypeSPDX      MediaType = "application/spdx+json"
	MediaTypeCycloneDX MediaType = "application/vnd.cyclonedx+json"
)

Functions

This section is empty.

Types

type BaseHandler

type BaseHandler struct {
}

func (*BaseHandler) SendInternalServerError

func (h *BaseHandler) SendInternalServerError(res http.ResponseWriter)

func (*BaseHandler) WriteJSON

func (h *BaseHandler) WriteJSON(res http.ResponseWriter, data interface{}, mimeType MIMEType, statusCode int)

func (*BaseHandler) WriteJSONError

func (h *BaseHandler) WriteJSONError(res http.ResponseWriter, err Error)

type Error added in v0.31.0

type Error struct {
	HTTPCode int    `json:"-"`
	Message  string `json:"message"`
}

Error holds the information about an error, including metadata about its JSON structure.

type MIMEType added in v0.31.0

type MIMEType struct {
	Type    string
	Subtype string
	Params  MimeTypeParams
}

func (*MIMEType) Equal added in v0.31.0

func (mt *MIMEType) Equal(other MIMEType) bool

func (MIMEType) MarshalJSON added in v0.31.0

func (mt MIMEType) MarshalJSON() ([]byte, error)

func (*MIMEType) Parse added in v0.31.0

func (mt *MIMEType) Parse(value string) error

func (*MIMEType) String added in v0.31.0

func (mt *MIMEType) String() string

func (*MIMEType) UnmarshalJSON added in v0.31.0

func (mt *MIMEType) UnmarshalJSON(b []byte) error

type MediaType added in v0.31.0

type MediaType string

type MimeTypeParams

type MimeTypeParams map[string]string

type Server

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

func NewServer

func NewServer(config etc.API, handler http.Handler) (server *Server, err error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

func (*Server) Shutdown

func (s *Server) Shutdown()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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