// Package publishserviceapi 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 publishserviceapi 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/capifcore/internal/common" externalRef1 "oransc.org/nonrtric/capifcore/internal/common29122" externalRef2 "oransc.org/nonrtric/capifcore/internal/common29571" ) // ServerInterface represents all server handlers. type ServerInterface interface { // (GET /{apfId}/service-apis) GetApfIdServiceApis(ctx echo.Context, apfId ApfId) error // (POST /{apfId}/service-apis) PostApfIdServiceApis(ctx echo.Context, apfId ApfId) error // (DELETE /{apfId}/service-apis/{serviceApiId}) DeleteApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error // (GET /{apfId}/service-apis/{serviceApiId}) GetApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error // (PATCH /{apfId}/service-apis/{serviceApiId}) ModifyIndAPFPubAPI(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error // (PUT /{apfId}/service-apis/{serviceApiId}) PutApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error } // ServerInterfaceWrapper converts echo contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface } // GetApfIdServiceApis converts echo context to params. func (w *ServerInterfaceWrapper) GetApfIdServiceApis(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.GetApfIdServiceApis(ctx, apfId) return err } // PostApfIdServiceApis converts echo context to params. func (w *ServerInterfaceWrapper) PostApfIdServiceApis(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostApfIdServiceApis(ctx, apfId) return err } // DeleteApfIdServiceApisServiceApiId converts echo context to params. func (w *ServerInterfaceWrapper) DeleteApfIdServiceApisServiceApiId(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // ------------- Path parameter "serviceApiId" ------------- var serviceApiId ServiceApiId err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.DeleteApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId) return err } // GetApfIdServiceApisServiceApiId converts echo context to params. func (w *ServerInterfaceWrapper) GetApfIdServiceApisServiceApiId(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // ------------- Path parameter "serviceApiId" ------------- var serviceApiId ServiceApiId err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.GetApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId) return err } // ModifyIndAPFPubAPI converts echo context to params. func (w *ServerInterfaceWrapper) ModifyIndAPFPubAPI(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // ------------- Path parameter "serviceApiId" ------------- var serviceApiId ServiceApiId err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.ModifyIndAPFPubAPI(ctx, apfId, serviceApiId) return err } // PutApfIdServiceApisServiceApiId converts echo context to params. func (w *ServerInterfaceWrapper) PutApfIdServiceApisServiceApiId(ctx echo.Context) error { var err error // ------------- Path parameter "apfId" ------------- var apfId ApfId err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err)) } // ------------- Path parameter "serviceApiId" ------------- var serviceApiId ServiceApiId err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PutApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId) 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.GET(baseURL+"/:apfId/service-apis", wrapper.GetApfIdServiceApis) router.POST(baseURL+"/:apfId/service-apis", wrapper.PostApfIdServiceApis) router.DELETE(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.DeleteApfIdServiceApisServiceApiId) router.GET(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.GetApfIdServiceApisServiceApiId) router.PATCH(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.ModifyIndAPFPubAPI) router.PUT(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.PutApfIdServiceApisServiceApiId) } // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ "H4sIAAAAAAAC/+xa4XLbuBF+FQzbmcZTmrJkO7nonyLLPl1yNmvKN9M5ZzwQuRJxIQEW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YUXgsUWk1GvlMfPdwpIvadyyaPysSvSAArSYcit/FWjhsfwsmmuXAMqmvJRN5", "GIIQkzxJ5vphTu0KIOSg73yq/FOU7T4OMudFJ0vNvHfKN3D3jmnRxYAjUxObT1rupx9v9hmVpnpaZYHC", "YzJfY8RFOAz1281pWYhUfbaubsbdMiYXrUpMDaytWdsKuK0v9dRssdHa1pKtQ+hdDb3tPQRpG0HaewjS", "NoK0z/cgcX4AADsALFxnJwfS3p2AtPQk7mhWocWTFc0qdlxoUk30COrV1C5IIlYXvAxQVogsFu43TaHP", "7G/et9WIKMUyjBuvv3s+GUaICGQOKjpksr/PcHqIQpY0dEt1vGtgsZTIf8CocvLtM9HV+rsWv4Q1RT3U", "4Ica/BD8qhrcfqP7M4vIZI4wRfCZCKk8ZMcwaFYOadTzL/18bPqZ/6eRb5ceQAp8CsdazX/9CgHQ3MDv", "1BT4DqF4pF9n1cOx5TGteQTQbBZgGumHoMX92sq9SJ5FumBvEGq2DcqXBmMWzXUctya51wz1jVI89HJ+", "DzhxaBgcGgbfFK1cR+KpAhD9sKPI8daeDzkf9dsWS0p/p6PI7gm9n/9BE/rfVWv7uxcUdTSogKiJBFuQ", "5gAWB7A4gMW37S4Xb2TK4Gzel2y4zHFcZ4Y5weOkerKlZhq3Ltiq3qfAZ5xmCXghS51m+CgWPvlC+413", "3nih3el0PMXzx8V/AgAA///zJgSKrkQAAA==", } // 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, "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, "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 externalRef2.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 }