blob: 98da71f634a284f0f2e879158680368b11055201 [file] [log] [blame]
// Package providermanagementapi provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
package providermanagementapi
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"github.com/deepmap/oapi-codegen/pkg/runtime"
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
externalRef0 "oransc.org/nonrtric/sme/internal/common29122"
externalRef1 "oransc.org/nonrtric/sme/internal/common29571"
)
// ServerInterface represents all server handlers.
type ServerInterface interface {
// (POST /registrations)
PostRegistrations(ctx echo.Context) error
// (DELETE /registrations/{registrationId})
DeleteRegistrationsRegistrationId(ctx echo.Context, registrationId string) error
// (PATCH /registrations/{registrationId})
ModifyIndApiProviderEnrolment(ctx echo.Context, registrationId string) error
// (PUT /registrations/{registrationId})
PutRegistrationsRegistrationId(ctx echo.Context, registrationId string) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// PostRegistrations converts echo context to params.
func (w *ServerInterfaceWrapper) PostRegistrations(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.PostRegistrations(ctx)
return err
}
// DeleteRegistrationsRegistrationId converts echo context to params.
func (w *ServerInterfaceWrapper) DeleteRegistrationsRegistrationId(ctx echo.Context) error {
var err error
// ------------- Path parameter "registrationId" -------------
var registrationId string
err = runtime.BindStyledParameterWithLocation("simple", false, "registrationId", runtime.ParamLocationPath, ctx.Param("registrationId"), &registrationId)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter registrationId: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.DeleteRegistrationsRegistrationId(ctx, registrationId)
return err
}
// ModifyIndApiProviderEnrolment converts echo context to params.
func (w *ServerInterfaceWrapper) ModifyIndApiProviderEnrolment(ctx echo.Context) error {
var err error
// ------------- Path parameter "registrationId" -------------
var registrationId string
err = runtime.BindStyledParameterWithLocation("simple", false, "registrationId", runtime.ParamLocationPath, ctx.Param("registrationId"), &registrationId)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter registrationId: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.ModifyIndApiProviderEnrolment(ctx, registrationId)
return err
}
// PutRegistrationsRegistrationId converts echo context to params.
func (w *ServerInterfaceWrapper) PutRegistrationsRegistrationId(ctx echo.Context) error {
var err error
// ------------- Path parameter "registrationId" -------------
var registrationId string
err = runtime.BindStyledParameterWithLocation("simple", false, "registrationId", runtime.ParamLocationPath, ctx.Param("registrationId"), &registrationId)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter registrationId: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.PutRegistrationsRegistrationId(ctx, registrationId)
return err
}
// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
RegisterHandlersWithBaseURL(router, si, "")
}
// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
wrapper := ServerInterfaceWrapper{
Handler: si,
}
router.POST(baseURL+"/registrations", wrapper.PostRegistrations)
router.DELETE(baseURL+"/registrations/:registrationId", wrapper.DeleteRegistrationsRegistrationId)
router.PATCH(baseURL+"/registrations/:registrationId", wrapper.ModifyIndApiProviderEnrolment)
router.PUT(baseURL+"/registrations/:registrationId", wrapper.PutRegistrationsRegistrationId)
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+xa73LbuBF/FQzambRTmpRke3LWN53/XDXXXDSWrv1wl/FAxFLElQR4AGhHzfiB+hp9",
"ss4CoiSKpORESe7mRl8ch+Qu9s9vf7sA/IHGKi+UBGkNHX6gJk4hZ+7X0WQ80epRcNC3UqssB2lvwDKR",
"udccTKxFYYWSdEjvodBgUAthkowmY1KsZAlXORPylSFQaSHcqwlpQAutCtBWgFPKCoFr3qh8zJuLtKgl",
"4xvCjBELCZzMl8SmQK5Hk/EdiZUGkpQyRmFilXuFGnIm2QKcHevXT6nIgGhYCGNBC7lYf72zXkimKcsy",
"IpUlcyArp4mQTuDvs9mETN5OZ0TDryUYSxKt8rWuNy0rrwxrsTnAd0qezRXTnAhrIEuq5etL4xNlU9De",
"gNXamAlONJhCSQMu2BoYfyuzJR1aXUJA7bIAOqTGosv0OdiOv0xUMwPfgQQtYiJkonTOnAcaMmaBb4d4",
"N0mmjFPCTJV3opLmp6woMhE7lc7WLtvuShm3AHBEMmEsahaSi0fBS5a12lKFd21NSP6VgiRCxlnJNyjq",
"gsp2qqss52AMW0BAhHVmmM5IbFa3KbMHFrIgucG4VsCMyoIzC2iDf6R9CpQmqze1x4VWMfBSQ4eLbYVS",
"d89jZ49/XUH17jG9KSrgGzM5IiIGY5Iyy5aYbWEhd1n9s4aEDumfog0vRStSirYY6W61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eA1SW4B6vOh6oHvf7XM+Uw",
"f2zture32jSgKTAO2tn8DxV3UOK1kpYJ6SfXH+/HVVuV8JQtSazB9WcNRpU6hoCwOFaau7HG92xjdRnj",
"TmdIPrBC3CtlnyNWiLPK0LNN+USP/Traog/b/x3zZ7ob/WArkrtkhQG66PV2dmr9wWDvTm2dzAhlnYr+",
"ESr6XsX5ESrOvYqLI1RcOBX9Ixzpe0f6RzjS9470L49QcelUDK4+XcXgClVcHoGLS4+LyyOSeumTyiFh",
"ZWY/WU0l77F+qHZccWdgW+bBG9Br+m5jkfmSOFEs7Lb3OP+vObxJ3Tdu2Rp514Yy7hoOdnrrGOmnxuGT",
"q2kiOEgrkiX+zmrc1k59npXcNhe1YE+jAZUsR57Quxa8nFneNTj/ohnTWceOJWc2dqNw3QAceX16eIjY",
"OO+9/mRcoKxT8c0RKr6hJ/6s8+eJdhq04wbFtpPHN4qLZLl3r7Q5samzhRcdS761lV2PP02m+AKl/ZKh",
"Mge9gDPn/d8+21Tnj3FfNGX2fqspE3mNQyKk2D6/x02JiD3jCUNyzKHYGTpdm2BEV9vs2gXA+kKorkiD",
"LbUEXh18Vcddc8WXjidbufcHRa59aELy6faeePg0x57m2K/aUAJq2QJ5nY7rbWN9lNC4rqLvsAuVLUcS",
"PzpK2XP1VTvl6+xHk9L+wUbX3+DQpOOk9dAdcGuKiFVkvukYQrZdaoT0d9xDX+xp+59JHG57p8516lyn",
"zvV1T2CeA+qO5ldtwF9KvOTQkwb0kWnB5tn6kghFfH2v7FvfbsB7lhcZhLHK6S6trAT9NWgiVmOzKedx",
"xkoD5HV4iVxbv3VB2989/z8AAP//iW60XwAqAAA=",
}
// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
if err != nil {
return nil, fmt.Errorf("error base64 decoding spec: %s", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
return buf.Bytes(), nil
}
var rawSpec = decodeSpecCached()
// a naive cached of a decoded swagger spec
func decodeSpecCached() func() ([]byte, error) {
data, err := decodeSpec()
return func() ([]byte, error) {
return data, err
}
}
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
var res = make(map[string]func() ([]byte, error))
if len(pathToFile) > 0 {
res[pathToFile] = rawSpec
}
pathPrefix := path.Dir(pathToFile)
for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
if _, ok := res[rawPath]; ok {
// it is not possible to compare functions in golang, so always overwrite the old value
}
res[rawPath] = rawFunc
}
for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
if _, ok := res[rawPath]; ok {
// it is not possible to compare functions in golang, so always overwrite the old value
}
res[rawPath] = rawFunc
}
return res
}
// 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 GetSwagger() (swagger *openapi3.T, err error) {
var resolvePath = PathToRawSpec("")
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
var pathToFile = url.String()
pathToFile = path.Clean(pathToFile)
getSpec, ok := resolvePath[pathToFile]
if !ok {
err1 := fmt.Errorf("path not found: %s", pathToFile)
return nil, err1
}
return getSpec()
}
var specData []byte
specData, err = rawSpec()
if err != nil {
return
}
swagger, err = loader.LoadFromData(specData)
if err != nil {
return
}
return
}