openapi

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTypeAssertionError = errors.New("unable to assert type")

ErrTypeAssertionError is thrown when type an interface does not match the asserted type

Functions

func AssertArtifactTypeQueryParamConstraints added in v0.3.0

func AssertArtifactTypeQueryParamConstraints(obj model.ArtifactTypeQueryParam) error

AssertArtifactTypeQueryParamConstraints checks if the values respects the defined constraints

func AssertArtifactTypeQueryParamRequired added in v0.3.0

func AssertArtifactTypeQueryParamRequired(obj model.ArtifactTypeQueryParam) error

AssertArtifactTypeQueryParamRequired checks if the required fields are not zero-ed

func AssertBaseModelConstraints

func AssertBaseModelConstraints(obj model.BaseModel) error

AssertBaseModelConstraints checks if the values respects the defined constraints

func AssertBaseModelRequired

func AssertBaseModelRequired(obj model.BaseModel) error

AssertBaseModelRequired checks if the required fields are not zero-ed

func AssertBaseResourceConstraints added in v0.3.2

func AssertBaseResourceConstraints(obj model.BaseResource) error

AssertBaseResourceConstraints checks if the values respects the defined constraints

func AssertBaseResourceDatesConstraints

func AssertBaseResourceDatesConstraints(obj model.BaseResourceDates) error

AssertBaseResourceDatesConstraints checks if the values respects the defined constraints

func AssertBaseResourceDatesRequired

func AssertBaseResourceDatesRequired(obj model.BaseResourceDates) error

AssertBaseResourceDatesRequired checks if the required fields are not zero-ed

func AssertBaseResourceListConstraints

func AssertBaseResourceListConstraints(obj model.BaseResourceList) error

AssertBaseResourceListConstraints checks if the values respects the defined constraints

func AssertBaseResourceListRequired

func AssertBaseResourceListRequired(obj model.BaseResourceList) error

AssertBaseResourceListRequired checks if the required fields are not zero-ed

func AssertBaseResourceRequired added in v0.3.2

func AssertBaseResourceRequired(obj model.BaseResource) error

AssertBaseResourceRequired checks if the required fields are not zero-ed

func AssertCatalogArtifactConstraints added in v0.3.3

func AssertCatalogArtifactConstraints(obj model.CatalogArtifact) error

AssertCatalogArtifactConstraints checks if the values respects the defined constraints

func AssertCatalogArtifactListConstraints added in v0.3.2

func AssertCatalogArtifactListConstraints(obj model.CatalogArtifactList) error

AssertCatalogArtifactListConstraints checks if the values respects the defined constraints

func AssertCatalogArtifactListRequired added in v0.3.2

func AssertCatalogArtifactListRequired(obj model.CatalogArtifactList) error

AssertCatalogArtifactListRequired checks if the required fields are not zero-ed

func AssertCatalogArtifactRequired added in v0.3.2

func AssertCatalogArtifactRequired(obj model.CatalogArtifact) error

AssertCatalogArtifactRequired checks if the required fields are not zero-ed

func AssertCatalogLabelConstraints added in v0.3.3

func AssertCatalogLabelConstraints(obj model.CatalogLabel) error

AssertCatalogLabelConstraints checks if the values respects the defined constraints

func AssertCatalogLabelListConstraints added in v0.3.3

func AssertCatalogLabelListConstraints(obj model.CatalogLabelList) error

AssertCatalogLabelListConstraints checks if the values respects the defined constraints

func AssertCatalogLabelListRequired added in v0.3.3

func AssertCatalogLabelListRequired(obj model.CatalogLabelList) error

AssertCatalogLabelListRequired checks if the required fields are not zero-ed

func AssertCatalogLabelRequired added in v0.3.3

func AssertCatalogLabelRequired(obj model.CatalogLabel) error

AssertCatalogLabelRequired checks if the required fields are not zero-ed

func AssertCatalogMetricsArtifactConstraints added in v0.3.2

func AssertCatalogMetricsArtifactConstraints(obj model.CatalogMetricsArtifact) error

AssertCatalogMetricsArtifactConstraints checks if the values respects the defined constraints

func AssertCatalogMetricsArtifactRequired added in v0.3.2

func AssertCatalogMetricsArtifactRequired(obj model.CatalogMetricsArtifact) error

AssertCatalogMetricsArtifactRequired checks if the required fields are not zero-ed

func AssertCatalogModelArtifactConstraints

func AssertCatalogModelArtifactConstraints(obj model.CatalogModelArtifact) error

AssertCatalogModelArtifactConstraints checks if the values respects the defined constraints

func AssertCatalogModelArtifactRequired

func AssertCatalogModelArtifactRequired(obj model.CatalogModelArtifact) error

AssertCatalogModelArtifactRequired checks if the required fields are not zero-ed

func AssertCatalogModelConstraints

func AssertCatalogModelConstraints(obj model.CatalogModel) error

AssertCatalogModelConstraints checks if the values respects the defined constraints

func AssertCatalogModelListConstraints

func AssertCatalogModelListConstraints(obj model.CatalogModelList) error

AssertCatalogModelListConstraints checks if the values respects the defined constraints

func AssertCatalogModelListRequired

func AssertCatalogModelListRequired(obj model.CatalogModelList) error

AssertCatalogModelListRequired checks if the required fields are not zero-ed

func AssertCatalogModelRequired

func AssertCatalogModelRequired(obj model.CatalogModel) error

AssertCatalogModelRequired checks if the required fields are not zero-ed

func AssertCatalogSourceConstraints

func AssertCatalogSourceConstraints(obj model.CatalogSource) error

AssertCatalogSourceConstraints checks if the values respects the defined constraints

func AssertCatalogSourceListConstraints

func AssertCatalogSourceListConstraints(obj model.CatalogSourceList) error

AssertCatalogSourceListConstraints checks if the values respects the defined constraints

func AssertCatalogSourceListRequired

func AssertCatalogSourceListRequired(obj model.CatalogSourceList) error

AssertCatalogSourceListRequired checks if the required fields are not zero-ed

func AssertCatalogSourcePreviewResponseAllOfSummaryConstraints added in v0.3.4

func AssertCatalogSourcePreviewResponseAllOfSummaryConstraints(obj model.CatalogSourcePreviewResponseAllOfSummary) error

AssertCatalogSourcePreviewResponseAllOfSummaryConstraints checks if the values respects the defined constraints

func AssertCatalogSourcePreviewResponseAllOfSummaryRequired added in v0.3.4

func AssertCatalogSourcePreviewResponseAllOfSummaryRequired(obj model.CatalogSourcePreviewResponseAllOfSummary) error

AssertCatalogSourcePreviewResponseAllOfSummaryRequired checks if the required fields are not zero-ed

func AssertCatalogSourcePreviewResponseConstraints added in v0.3.4

func AssertCatalogSourcePreviewResponseConstraints(obj model.CatalogSourcePreviewResponse) error

AssertCatalogSourcePreviewResponseConstraints checks if the values respects the defined constraints

func AssertCatalogSourcePreviewResponseRequired added in v0.3.4

func AssertCatalogSourcePreviewResponseRequired(obj model.CatalogSourcePreviewResponse) error

AssertCatalogSourcePreviewResponseRequired checks if the required fields are not zero-ed

func AssertCatalogSourceRequired

func AssertCatalogSourceRequired(obj model.CatalogSource) error

AssertCatalogSourceRequired checks if the required fields are not zero-ed

func AssertCatalogSourceStatusConstraints added in v0.3.4

func AssertCatalogSourceStatusConstraints(obj model.CatalogSourceStatus) error

AssertCatalogSourceStatusConstraints checks if the values respects the defined constraints

func AssertCatalogSourceStatusRequired added in v0.3.4

func AssertCatalogSourceStatusRequired(obj model.CatalogSourceStatus) error

AssertCatalogSourceStatusRequired checks if the required fields are not zero-ed

func AssertErrorConstraints

func AssertErrorConstraints(obj model.Error) error

AssertErrorConstraints checks if the values respects the defined constraints

func AssertErrorRequired

func AssertErrorRequired(obj model.Error) error

AssertErrorRequired checks if the required fields are not zero-ed

func AssertFieldFilterConstraints added in v0.3.4

func AssertFieldFilterConstraints(obj model.FieldFilter) error

AssertFieldFilterConstraints checks if the values respects the defined constraints

func AssertFieldFilterRequired added in v0.3.4

func AssertFieldFilterRequired(obj model.FieldFilter) error

AssertFieldFilterRequired checks if the required fields are not zero-ed

func AssertFilterOptionRangeConstraints added in v0.3.2

func AssertFilterOptionRangeConstraints(obj model.FilterOptionRange) error

AssertFilterOptionRangeConstraints checks if the values respects the defined constraints

func AssertFilterOptionRangeRequired added in v0.3.2

func AssertFilterOptionRangeRequired(obj model.FilterOptionRange) error

AssertFilterOptionRangeRequired checks if the required fields are not zero-ed

func AssertFilterOptionRequired added in v0.3.2

func AssertFilterOptionRequired(obj model.FilterOption) error

AssertFilterOptionRequired checks if the required fields are not zero-ed

func AssertFilterOptionsListConstraints added in v0.3.2

func AssertFilterOptionsListConstraints(obj model.FilterOptionsList) error

AssertFilterOptionsListConstraints checks if the values respects the defined constraints

func AssertFilterOptionsListRequired added in v0.3.2

func AssertFilterOptionsListRequired(obj model.FilterOptionsList) error

AssertFilterOptionsListRequired checks if the required fields are not zero-ed

func AssertMetadataBoolValueConstraints

func AssertMetadataBoolValueConstraints(obj model.MetadataBoolValue) error

AssertMetadataBoolValueConstraints checks if the values respects the defined constraints

func AssertMetadataBoolValueRequired

func AssertMetadataBoolValueRequired(obj model.MetadataBoolValue) error

AssertMetadataBoolValueRequired checks if the required fields are not zero-ed

func AssertMetadataDoubleValueConstraints

func AssertMetadataDoubleValueConstraints(obj model.MetadataDoubleValue) error

AssertMetadataDoubleValueConstraints checks if the values respects the defined constraints

func AssertMetadataDoubleValueRequired

func AssertMetadataDoubleValueRequired(obj model.MetadataDoubleValue) error

AssertMetadataDoubleValueRequired checks if the required fields are not zero-ed

func AssertMetadataIntValueConstraints

func AssertMetadataIntValueConstraints(obj model.MetadataIntValue) error

AssertMetadataIntValueConstraints checks if the values respects the defined constraints

func AssertMetadataIntValueRequired

func AssertMetadataIntValueRequired(obj model.MetadataIntValue) error

AssertMetadataIntValueRequired checks if the required fields are not zero-ed

func AssertMetadataProtoValueConstraints

func AssertMetadataProtoValueConstraints(obj model.MetadataProtoValue) error

AssertMetadataProtoValueConstraints checks if the values respects the defined constraints

func AssertMetadataProtoValueRequired

func AssertMetadataProtoValueRequired(obj model.MetadataProtoValue) error

AssertMetadataProtoValueRequired checks if the required fields are not zero-ed

func AssertMetadataStringValueConstraints

func AssertMetadataStringValueConstraints(obj model.MetadataStringValue) error

AssertMetadataStringValueConstraints checks if the values respects the defined constraints

func AssertMetadataStringValueRequired

func AssertMetadataStringValueRequired(obj model.MetadataStringValue) error

AssertMetadataStringValueRequired checks if the required fields are not zero-ed

func AssertMetadataStructValueConstraints

func AssertMetadataStructValueConstraints(obj model.MetadataStructValue) error

AssertMetadataStructValueConstraints checks if the values respects the defined constraints

func AssertMetadataStructValueRequired

func AssertMetadataStructValueRequired(obj model.MetadataStructValue) error

AssertMetadataStructValueRequired checks if the required fields are not zero-ed

func AssertModelPreviewResultConstraints added in v0.3.4

func AssertModelPreviewResultConstraints(obj model.ModelPreviewResult) error

AssertModelPreviewResultConstraints checks if the values respects the defined constraints

func AssertModelPreviewResultRequired added in v0.3.4

func AssertModelPreviewResultRequired(obj model.ModelPreviewResult) error

AssertModelPreviewResultRequired checks if the required fields are not zero-ed

func AssertOrderByFieldConstraints

func AssertOrderByFieldConstraints(obj model.OrderByField) error

AssertOrderByFieldConstraints checks if the values respects the defined constraints

func AssertOrderByFieldRequired

func AssertOrderByFieldRequired(obj model.OrderByField) error

AssertOrderByFieldRequired checks if the required fields are not zero-ed

func AssertRecurseInterfaceRequired

func AssertRecurseInterfaceRequired[T any](obj interface{}, callback func(T) error) error

AssertRecurseInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.

func AssertRecurseValueRequired

func AssertRecurseValueRequired[T any](value reflect.Value, callback func(T) error) error

AssertRecurseValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion. ErrTypeAssertionError is thrown if the underlying struct does not match type T.

func AssertSortOrderConstraints

func AssertSortOrderConstraints(obj model.SortOrder) error

AssertSortOrderConstraints checks if the values respects the defined constraints

func AssertSortOrderRequired

func AssertSortOrderRequired(obj model.SortOrder) error

AssertSortOrderRequired checks if the required fields are not zero-ed

func DefaultErrorHandler

func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error, result *ImplResponse)

DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.

func EncodeJSONResponse

func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error

EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code

func IsZeroValue

func IsZeroValue(val interface{}) bool

IsZeroValue checks if the val is the zero-ed value.

func Logger

func Logger(inner http.Handler) http.Handler

func NewRouter

func NewRouter(routers ...Router) chi.Router

NewRouter creates a new router for any number of api routers

func ReadFormFileToTempFile

func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)

ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file

func ReadFormFilesToTempFiles

func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)

ReadFormFilesToTempFiles reads files array data from a request form and writes it to a temporary files

Types

type Constraint

type Constraint[T Number | string | bool] func(actual T) error

func WithMaximum

func WithMaximum[T Number](expected T) Constraint[T]

func WithMinimum

func WithMinimum[T Number](expected T) Constraint[T]

type ErrorHandler

type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if you would like errors to be handled differently from the DefaultErrorHandler

type ImplResponse

type ImplResponse struct {
	Code int
	Body interface{}
}

ImplResponse defines an implementation response with error code and the associated body

func ErrorResponse

func ErrorResponse(code int, err error) ImplResponse

func Response

func Response(code int, body interface{}) ImplResponse

Response return a ImplResponse struct filled

type ModelCatalogServiceAPIController

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

ModelCatalogServiceAPIController binds http requests to an api service and writes the service results to the http response

func NewModelCatalogServiceAPIController

NewModelCatalogServiceAPIController creates a default api controller

func (*ModelCatalogServiceAPIController) FindLabels added in v0.3.3

FindLabels - List All CatalogLabels

func (*ModelCatalogServiceAPIController) FindModels

FindModels - Search catalog models across sources.

func (*ModelCatalogServiceAPIController) FindModelsFilterOptions added in v0.3.2

func (c *ModelCatalogServiceAPIController) FindModelsFilterOptions(w http.ResponseWriter, r *http.Request)

FindModelsFilterOptions - Lists fields and available options that can be used in `filterQuery` on the list models endpoint.

func (*ModelCatalogServiceAPIController) FindSources

FindSources - List All CatalogSources

func (*ModelCatalogServiceAPIController) GetAllModelArtifacts

func (c *ModelCatalogServiceAPIController) GetAllModelArtifacts(w http.ResponseWriter, r *http.Request)

GetAllModelArtifacts - List CatalogArtifacts.

func (*ModelCatalogServiceAPIController) GetAllModelPerformanceArtifacts added in v0.3.4

func (c *ModelCatalogServiceAPIController) GetAllModelPerformanceArtifacts(w http.ResponseWriter, r *http.Request)

GetAllModelPerformanceArtifacts - List CatalogArtifacts.

func (*ModelCatalogServiceAPIController) GetModel

GetModel - Get a `CatalogModel`.

func (*ModelCatalogServiceAPIController) OrderedRoutes added in v0.3.3

func (c *ModelCatalogServiceAPIController) OrderedRoutes() []Route

OrderedRoutes returns all the api routes in a deterministic order for the ModelCatalogServiceAPIController

func (*ModelCatalogServiceAPIController) PreviewCatalogSource added in v0.3.4

func (c *ModelCatalogServiceAPIController) PreviewCatalogSource(w http.ResponseWriter, r *http.Request)

PreviewCatalogSource - Preview catalog source configuration

func (*ModelCatalogServiceAPIController) Routes

Routes returns all the api routes for the ModelCatalogServiceAPIController

type ModelCatalogServiceAPIOption

type ModelCatalogServiceAPIOption func(*ModelCatalogServiceAPIController)

ModelCatalogServiceAPIOption for how the controller is set up.

func WithModelCatalogServiceAPIErrorHandler

func WithModelCatalogServiceAPIErrorHandler(h ErrorHandler) ModelCatalogServiceAPIOption

WithModelCatalogServiceAPIErrorHandler inject ErrorHandler into controller

type ModelCatalogServiceAPIRouter

type ModelCatalogServiceAPIRouter interface {
	FindLabels(http.ResponseWriter, *http.Request)
	FindModels(http.ResponseWriter, *http.Request)
	FindModelsFilterOptions(http.ResponseWriter, *http.Request)
	FindSources(http.ResponseWriter, *http.Request)
	PreviewCatalogSource(http.ResponseWriter, *http.Request)
	GetModel(http.ResponseWriter, *http.Request)
	GetAllModelArtifacts(http.ResponseWriter, *http.Request)
	GetAllModelPerformanceArtifacts(http.ResponseWriter, *http.Request)
}

ModelCatalogServiceAPIRouter defines the required methods for binding the api requests to a responses for the ModelCatalogServiceAPI The ModelCatalogServiceAPIRouter implementation should parse necessary information from the http request, pass the data to a ModelCatalogServiceAPIServicer to perform the required actions, then write the service results to the http response.

type ModelCatalogServiceAPIService

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

ModelCatalogServiceAPIService is a service that implements the logic for the ModelCatalogServiceAPIServicer This service should implement the business logic for every endpoint for the ModelCatalogServiceAPI s.coreApi. Include any external packages or services that will be required by this service.

func (*ModelCatalogServiceAPIService) FindLabels added in v0.3.3

func (m *ModelCatalogServiceAPIService) FindLabels(ctx context.Context, pageSize string, orderBy string, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) FindModels

func (m *ModelCatalogServiceAPIService) FindModels(ctx context.Context, sourceIDs []string, q string, sourceLabels []string, filterQuery string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) FindModelsFilterOptions added in v0.3.2

func (m *ModelCatalogServiceAPIService) FindModelsFilterOptions(ctx context.Context) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) FindSources

func (m *ModelCatalogServiceAPIService) FindSources(ctx context.Context, name string, strPageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) GetAllModelArtifacts

func (m *ModelCatalogServiceAPIService) GetAllModelArtifacts(ctx context.Context, sourceID string, modelName string, artifactType []model.ArtifactTypeQueryParam, artifactType2 []model.ArtifactTypeQueryParam, filterQuery string, pageSize string, orderBy string, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error)

GetAllModelArtifacts retrieves all model artifacts for a given model from the specified source.

func (*ModelCatalogServiceAPIService) GetAllModelPerformanceArtifacts added in v0.3.4

func (m *ModelCatalogServiceAPIService) GetAllModelPerformanceArtifacts(ctx context.Context, sourceID string, modelName string, targetRPS int32, recommendations bool, rpsProperty string, latencyProperty string, hardwareCountProperty string, hardwareTypeProperty string, filterQuery string, pageSize string, orderBy string, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) GetModel

func (m *ModelCatalogServiceAPIService) GetModel(ctx context.Context, sourceID, modelName string) (ImplResponse, error)

func (*ModelCatalogServiceAPIService) PreviewCatalogSource added in v0.3.4

func (m *ModelCatalogServiceAPIService) PreviewCatalogSource(ctx context.Context, configParam *os.File, pageSizeParam string, nextPageTokenParam string, filterStatusParam string, catalogDataParam *os.File) (ImplResponse, error)

type ModelCatalogServiceAPIServicer

ModelCatalogServiceAPIServicer defines the api actions for the ModelCatalogServiceAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewModelCatalogServiceAPIService

func NewModelCatalogServiceAPIService(provider catalog.APIProvider, sources *catalog.SourceCollection, labels *catalog.LabelCollection, sourceRepository models.CatalogSourceRepository) ModelCatalogServiceAPIServicer

NewModelCatalogServiceAPIService creates a default api service

type Number

type Number interface {
	~int32 | ~int64 | ~float32 | ~float64
}

type Operation

type Operation[T Number | string | bool] func(actual string) (T, bool, error)

func WithDefaultOrParse

func WithDefaultOrParse[T Number | string | bool](def T, parse ParseString[T]) Operation[T]

func WithParse

func WithParse[T Number | string | bool](parse ParseString[T]) Operation[T]

func WithRequire

func WithRequire[T Number | string | bool](parse ParseString[T]) Operation[T]

type ParseString

type ParseString[T Number | string | bool] func(v string) (T, error)

type ParsingError

type ParsingError struct {
	Param string
	Err   error
}

ParsingError indicates that an error has occurred when parsing request parameters

func (*ParsingError) Error

func (e *ParsingError) Error() string

func (*ParsingError) Unwrap

func (e *ParsingError) Unwrap() error

type RequiredError

type RequiredError struct {
	Field string
}

RequiredError indicates that an error has occurred when parsing request parameters

func (*RequiredError) Error

func (e *RequiredError) Error() string

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

A Route defines the parameters for an api endpoint

type Router

type Router interface {
	Routes() Routes
	OrderedRoutes() []Route
}

Router defines the required methods for retrieving api routes

type Routes

type Routes map[string]Route

Routes is a map of defined api endpoints

Jump to

Keyboard shortcuts

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