// 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/servicemanager/internal/common" externalRef1 "oransc.org/nonrtric/servicemanager/internal/common29122" externalRef2 "oransc.org/nonrtric/servicemanager/internal/common29571" ) // ServerInterface represents all server handlers. type ServerInterface interface { // (GET /{apfId}/service-apis) GetApfIdServiceApis(ctx echo.Context, apfId string) error // (POST /{apfId}/service-apis) PostApfIdServiceApis(ctx echo.Context, apfId string) error // (DELETE /{apfId}/service-apis/{serviceApiId}) DeleteApfIdServiceApisServiceApiId(ctx echo.Context, apfId string, serviceApiId string) error // (GET /{apfId}/service-apis/{serviceApiId}) GetApfIdServiceApisServiceApiId(ctx echo.Context, apfId string, serviceApiId string) error // (PATCH /{apfId}/service-apis/{serviceApiId}) ModifyIndAPFPubAPI(ctx echo.Context, apfId string, serviceApiId string) error // (PUT /{apfId}/service-apis/{serviceApiId}) PutApfIdServiceApisServiceApiId(ctx echo.Context, apfId string, serviceApiId string) 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 string 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 string 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 string 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 string 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 string 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 string 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 string 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 string 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 string 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 string 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/+xa/27bOPJ/FULfL3ANTpVjp2m3/s91nKy23UQXOQscNkVAS2OLW5nUkZRTX+EHute4", "JzuQlGRZZmIl7nZ/+Z/ENsnhzHDmMz/IL07E5hmjQKVw+l8cESUwx/rjAKYfWIQlYVR9jUFEn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6eeOszI1X7efdI/qmjG56lSC6pDZ", "WXStobTzRVQ26McrzXR761odoHYTart7CNI1gnT3EKRrBOme7kHi9AD4dsBfuU4bFzL+nYK01Ok3NKui", "g72zvxUrzjSpZrQIazu2ihxic0F7F3d/tRz4lf3lN6ExWZA4x6ldRWiOZZQ0XkAPAuLHiAhkNB8fUtHf", "Jz4eYMWSR+4oZdsihaWe/TPAxPG3zxc3K+IaIAlrIrmjKr6lBzA61MV/pbrYfh/5I4vJdIkwRfCZCKl8", "pCWymZU+jQfBeZBPTB/xjwJmbYrvOfAZvNR6+/tXwDRzIdyqGv8N0HWs3wvVEdbyvtPcSTerdExj/Tax", "uObBdQJ5Fus6uUGoWa+XF98TFi8LaLamopcMDY1aPPR8jg956KFOP9Tp3zQAuY7EMxUT9DuDInHbes/i", "fNRPLSyJ943GkfZpd5D/WdLu31Wb+DdP++vwXsWWJrTvCB0H9D+g/wH9v22XtngEV6KteXvxyLWI4zoL", "zAmepNVjIDXTuHXBVvV2Az7jeZaCF7G504SPYqH9CfAb77TxALjX63mK4Y+r/wUAAP//h5XpSShDAAA=", } // 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 }