api

package
v0.0.0-...-94bebd6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Copyright 2025 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	ApplicationvndVeraisonCharesJson string = "application/vnd.veraison.chares+json"
	JsonType                         string = "application/json"
)

Defines missing consts in the API Spec

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type BadRequestError

type BadRequestError struct {
	Detail   *string               `json:"detail,omitempty"`
	Instance *string               `json:"instance,omitempty"`
	Status   BadRequestErrorStatus `json:"status"`
	Title    BadRequestErrorTitle  `json:"title"`
	Type     BadRequestErrorType   `json:"type"`
}

BadRequestError defines model for BadRequestError.

type BadRequestErrorStatus

type BadRequestErrorStatus float32

BadRequestErrorStatus defines model for BadRequestError.Status.

const (
	N400 BadRequestErrorStatus = 400
)

Defines values for BadRequestErrorStatus.

type BadRequestErrorTitle

type BadRequestErrorTitle string

BadRequestErrorTitle defines model for BadRequestError.Title.

const (
	InvalidRequest BadRequestErrorTitle = "invalid request"
)

Defines values for BadRequestErrorTitle.

type BadRequestErrorType

type BadRequestErrorType string

BadRequestErrorType defines model for BadRequestError.Type.

const (
	TagGithubCom2024VeraisonratsdErrorInvalidrequest BadRequestErrorType = "tag:github.com,2024:veraison/ratsd:error:invalidrequest"
)

Defines values for BadRequestErrorType.

type CMW

type CMW struct {
	Typ CMWTyp `json:"typ"`
	Val string `json:"val"`
}

CMW defines model for CMW.

type CMWTyp

type CMWTyp string

CMWTyp defines model for CMW.Typ.

const (
	ApplicationvndVeraisonConfigfsTsmJson CMWTyp = "application/vnd.veraison.configfs-tsm+json"
)

Defines values for CMWTyp.

type ChaResRequest

type ChaResRequest struct {
	AttesterSelection json.RawMessage `json:"attester-selection,omitempty"`
	Nonce             string          `json:"nonce"`
}

ChaResRequest defines model for ChaResRequest.

type ChaResRequestParametersAccept

type ChaResRequestParametersAccept = string

ChaResRequestParametersAccept defines model for ChaResRequestParameters.accept.

type EAT

type EAT struct {
	EatProfile  EATEatProfile `json:"eat_profile"`
	NestedToken CMW           `json:"nested-token"`
}

EAT defines model for EAT.

type EATEatProfile

type EATEatProfile string

EATEatProfile defines model for EAT.EatProfile.

const (
	TagGithubCom2024Veraisonratsd EATEatProfile = "tag:github.com,2024:veraison/ratsd"
)

Defines values for EATEatProfile.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Option

type Option struct {
	DataType OptionDataType `json:"data-type"`
	Name     string         `json:"name"`
}

Option defines model for Option.

type OptionDataType

type OptionDataType string

OptionDataType defines model for Option.DataType.

const (
	Array   OptionDataType = "array"
	Boolean OptionDataType = "boolean"
	Integer OptionDataType = "integer"
	Number  OptionDataType = "number"
	Object  OptionDataType = "object"
	String  OptionDataType = "string"
)

Defines values for OptionDataType.

type RatsdCharesApplicationVndVeraisonCharesPlusJSONRequestBody

type RatsdCharesApplicationVndVeraisonCharesPlusJSONRequestBody = ChaResRequest

RatsdCharesApplicationVndVeraisonCharesPlusJSONRequestBody defines body for RatsdChares for application/vnd.veraison.chares+json ContentType.

type RatsdCharesParams

type RatsdCharesParams struct {
	Accept *ChaResRequestParametersAccept `json:"accept,omitempty"`
}

RatsdCharesParams defines parameters for RatsdChares.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type Server

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

func NewServer

func NewServer(logger *zap.SugaredLogger, manager plugin.IManager, options string) *Server

func (*Server) RatsdChares

func (s *Server) RatsdChares(w http.ResponseWriter, r *http.Request, param RatsdCharesParams)

func (*Server) RatsdSubattesters

func (s *Server) RatsdSubattesters(w http.ResponseWriter, r *http.Request)

type ServerInterface

type ServerInterface interface {

	// (POST /ratsd/chares)
	RatsdChares(w http.ResponseWriter, r *http.Request, params RatsdCharesParams)

	// (GET /ratsd/subattesters)
	RatsdSubattesters(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) RatsdChares

func (siw *ServerInterfaceWrapper) RatsdChares(w http.ResponseWriter, r *http.Request)

RatsdChares operation middleware

func (*ServerInterfaceWrapper) RatsdSubattesters

func (siw *ServerInterfaceWrapper) RatsdSubattesters(w http.ResponseWriter, r *http.Request)

RatsdSubattesters operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type SubAttester

type SubAttester struct {
	Name    string    `json:"name"`
	Options *[]Option `json:"options,omitempty"`
}

SubAttester defines model for SubAttester.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnauthorizedError

type UnauthorizedError struct {
	Detail   *string                 `json:"detail,omitempty"`
	Instance *string                 `json:"instance,omitempty"`
	Status   UnauthorizedErrorStatus `json:"status"`
	Title    UnauthorizedErrorTitle  `json:"title"`
	Type     UnauthorizedErrorType   `json:"type"`
}

UnauthorizedError defines model for UnauthorizedError.

type UnauthorizedErrorStatus

type UnauthorizedErrorStatus float32

UnauthorizedErrorStatus defines model for UnauthorizedError.Status.

const (
	N401 UnauthorizedErrorStatus = 401
)

Defines values for UnauthorizedErrorStatus.

type UnauthorizedErrorTitle

type UnauthorizedErrorTitle string

UnauthorizedErrorTitle defines model for UnauthorizedError.Title.

const (
	AccessUnauthorized UnauthorizedErrorTitle = "access unauthorized"
)

Defines values for UnauthorizedErrorTitle.

type UnauthorizedErrorType

type UnauthorizedErrorType string

UnauthorizedErrorType defines model for UnauthorizedError.Type.

const (
	TagGithubCom2024VeraisonratsdErrorUnauthorized UnauthorizedErrorType = "tag:github.com,2024:veraison/ratsd:error:unauthorized"
)

Defines values for UnauthorizedErrorType.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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