// Package aefsecurityapi 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 aefsecurityapi import ( "bytes" "compress/gzip" "encoding/base64" "fmt" "net/url" "path" "strings" "github.com/getkin/kin-openapi/openapi3" "github.com/labstack/echo/v4" externalRef0 "oransc.org/nonrtric/capifcore/internal/common29571" ) // ServerInterface represents all server handlers. type ServerInterface interface { // Check authentication. // (POST /check-authentication) PostCheckAuthentication(ctx echo.Context) error // Revoke authorization. // (POST /revoke-authorization) PostRevokeAuthorization(ctx echo.Context) error } // ServerInterfaceWrapper converts echo contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface } // PostCheckAuthentication converts echo context to params. func (w *ServerInterfaceWrapper) PostCheckAuthentication(ctx echo.Context) error { var err error // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostCheckAuthentication(ctx) return err } // PostRevokeAuthorization converts echo context to params. func (w *ServerInterfaceWrapper) PostRevokeAuthorization(ctx echo.Context) error { var err error // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostRevokeAuthorization(ctx) 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+"/check-authentication", wrapper.PostCheckAuthentication) router.POST(baseURL+"/revoke-authorization", wrapper.PostRevokeAuthorization) } // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ "H4sIAAAAAAAC/+xY3W7iOBR+Fcu7F7tSSEgo6pC7DG1XuZlFgPZmOkImOSGeJrbHdmDYigfa19gnW9lO", "2UKhqhpNpZF6U6L4nM/n5/Pnk97jjNeCM2Ba4fgeq6yEmtjHcQnZXdLoEpimGdGUsyl8Mys5qExSYd7g", "GE9BSFAGAJEDa5QZBCThWwNKo5xo4mMPC8kFSE3B7kIETdma34FM86fYySRF1C2j9AoRpeiKQY6WW6RL", "QONkkt6gjEtARcMyu6nmdumx56akFSDOektOZE7Z6tjChKW3AnCMlZaUrfDOw6oRgksN+Q0Q3UgX7q8S", "Chzj+SwaDS/DxZjXNWdXJrMtqatfgv+rGbSlDGZPcHY7D5uqUAk5jj8f1uDUxl/24fHlV8i0Ce9Ue5R4", "TXuU4EzBmf68XRVelvYUTKFM3lzSv1/Myr0xkrDm2cPjc8yUdqeUFfwo5SiKFpZ5ixlkjaR6u0gm6TOp", "t1afuKZFW/y3JdijVLwOdX4Bvc7U+SeimPGB7xokI9UVz9TTlAd/TCZoPkPRyI+iCP0VXvqh30cuRCsr", "N5LUsOHyDhVcImv/iUtdLnnDcmOhsIcbWeEYl1qLOAg2m40/WAnhc7kKCi2CmYBMBURmJV1DEI0WCiQF", "FbhNA9Mi2lLzqWSaXZPrG6Ra5qGaMLKCGpj2b9m//6CoH4WeC+xPuSKsbRqp0IRIzUAq9FsyTT96KJmn", "Mw+Nx7PEQ9fzWeqh+ezK/swT82f8u3/LkqpCkq5KrUyvQa4h92+ZEVWqK1Pc5PrwsGAPr0EqF3HoR36/", "RypREj80iXEBjAhqSu33/b4hDNGl7URgRat3qGRmQXClza8hln1prhM84UqfEErsaAFKf+T51rhlnGlg", "2t1Iomrtgq/KoTuKPeLlSQKeuTF3hzTUsgH7wh0Km1bU7//QKJRwURxSZV7CXgM3RCHVZBkoVTSVb9ow", "6F8encTQKN8zJ3GfU2B8LcSHDhAfDMSFK82rIIyvhQg7QIQOYtABYuAgLjpAXFiIsEMioUsk7JBI6BIJ", "hx0ghhYiGr0eIhoZiGEHXgwdL4Ydmjp0Tc2hIE2lXw3z4L+z80BdE7nFsZvtjsY139oE7irvHdy1z+vf", "iZv8B+nfmdnsjfXvzOTyrn/v+veufz+H/rkjfPhB4bsTbKdLqXD8+b6doO+JoFPO9S4gUPQeRt5gHZoh", "k0hKltX+Xw3Gzo3Mbdh2/lZxEMB3UosK/IzX+FgnWkdEFMqhoAxyRBlSzTKrSKMAXfpDxAt0+F1g4/2y", "+y8AAP//CPXtp2ERAAA=", } // 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, "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 }