1 // Package eventsapi provides primitives to interact with the openapi HTTP API.
3 // Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
16 "github.com/deepmap/oapi-codegen/pkg/runtime"
17 "github.com/getkin/kin-openapi/openapi3"
18 "github.com/labstack/echo/v4"
19 externalRef0 "oransc.org/nonrtric/capifcore/internal/accesscontrolpolicyapi"
20 externalRef1 "oransc.org/nonrtric/capifcore/internal/common"
21 externalRef2 "oransc.org/nonrtric/capifcore/internal/common29122"
22 externalRef3 "oransc.org/nonrtric/capifcore/internal/common29571"
23 externalRef4 "oransc.org/nonrtric/capifcore/internal/loggingapi"
24 externalRef5 "oransc.org/nonrtric/capifcore/internal/publishserviceapi"
25 externalRef6 "oransc.org/nonrtric/capifcore/internal/routinginfoapi"
28 // ServerInterface represents all server handlers.
29 type ServerInterface interface {
31 // (POST /{subscriberId}/subscriptions)
32 PostSubscriberIdSubscriptions(ctx echo.Context, subscriberId string) error
34 // (DELETE /{subscriberId}/subscriptions/{subscriptionId})
35 DeleteSubscriberIdSubscriptionsSubscriptionId(ctx echo.Context, subscriberId string, subscriptionId string) error
38 // ServerInterfaceWrapper converts echo contexts to parameters.
39 type ServerInterfaceWrapper struct {
40 Handler ServerInterface
43 // PostSubscriberIdSubscriptions converts echo context to params.
44 func (w *ServerInterfaceWrapper) PostSubscriberIdSubscriptions(ctx echo.Context) error {
46 // ------------- Path parameter "subscriberId" -------------
47 var subscriberId string
49 err = runtime.BindStyledParameterWithLocation("simple", false, "subscriberId", runtime.ParamLocationPath, ctx.Param("subscriberId"), &subscriberId)
51 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter subscriberId: %s", err))
54 // Invoke the callback with all the unmarshalled arguments
55 err = w.Handler.PostSubscriberIdSubscriptions(ctx, subscriberId)
59 // DeleteSubscriberIdSubscriptionsSubscriptionId converts echo context to params.
60 func (w *ServerInterfaceWrapper) DeleteSubscriberIdSubscriptionsSubscriptionId(ctx echo.Context) error {
62 // ------------- Path parameter "subscriberId" -------------
63 var subscriberId string
65 err = runtime.BindStyledParameterWithLocation("simple", false, "subscriberId", runtime.ParamLocationPath, ctx.Param("subscriberId"), &subscriberId)
67 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter subscriberId: %s", err))
70 // ------------- Path parameter "subscriptionId" -------------
71 var subscriptionId string
73 err = runtime.BindStyledParameterWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, ctx.Param("subscriptionId"), &subscriptionId)
75 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter subscriptionId: %s", err))
78 // Invoke the callback with all the unmarshalled arguments
79 err = w.Handler.DeleteSubscriberIdSubscriptionsSubscriptionId(ctx, subscriberId, subscriptionId)
83 // This is a simple interface which specifies echo.Route addition functions which
84 // are present on both echo.Echo and echo.Group, since we want to allow using
85 // either of them for path registration
86 type EchoRouter interface {
87 CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
88 DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
89 GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
90 HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
91 OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
92 PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
93 POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
94 PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
95 TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
98 // RegisterHandlers adds each server route to the EchoRouter.
99 func RegisterHandlers(router EchoRouter, si ServerInterface) {
100 RegisterHandlersWithBaseURL(router, si, "")
103 // Registers handlers, and prepends BaseURL to the paths, so that the paths
104 // can be served under a prefix.
105 func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
107 wrapper := ServerInterfaceWrapper{
111 router.POST(baseURL+"/:subscriberId/subscriptions", wrapper.PostSubscriberIdSubscriptions)
112 router.DELETE(baseURL+"/:subscriberId/subscriptions/:subscriptionId", wrapper.DeleteSubscriberIdSubscriptionsSubscriptionId)
116 // Base64 encoded, gzipped, json marshaled Swagger object
117 var swaggerSpec = []string{
119 "H4sIAAAAAAAC/+xZ4Y7iOPJ/Fcv7/zAjZaFhpv+zzbcM0DPRoQYRek57sy1kkgp4J9hZ26GbayHdO9xT",
120 "3Gvco9yTnGyHEEICdHMrre5mtdptOa5fVbmqflU2zzjgy4QzYErizjOWwQKWxPzpBgFI2eVMCR6PeEyD",
121 "9YBK1X9S+iuJ42GEO1+f8f8JiHAHT/z2TbvdnnbdkXc7tcLTTHpqxafuyGusyTL+obnT2sxUNmv04Y3z",
122 "jBPBExCKgrGMJNQL9R9qnQDuYKkEZXO82TjbFT77FQKFNw8ODkEGgiaKcoY7eAyJAKn1IrUABE8KmKSc",
123 "oYgLRIwFKLAmoETbQEE2sIMF/JZSASHufM3UP2wcbHztr4CZI9nXNOJS0lkMaEXiFCQiAjq/sB+R3x9/",
124 "8bp9fRZT94vrDdyPg34HGRSJBMREQYgUN/aRFaExmdGYqjXiEZIgVjQA5I48iUikQJht+8sCUJLOYioX",
125 "EDbKKu/vTipN2WvVpuyI4lHPnVTqDBaEzQFRVgRElEVcLIk+TYOlMby7L8M/9cfT4d3HoTvu9XtVcFZ4",
126 "xb+BQJzNOBGh/WCidYh1e3suWBRt0SLBlwW8op8at+tOvOHd1L/vdvu+X3fOMjX5FqWxUREYX8vHfQz/",
127 "1vUG9+PaOEaExhCewnaNjdPu8G4yHg6mo+HA6/58JFomQ5KQKDA1Y7K0om7WB96eqfg1+XmBEYVMcO8n",
128 "n4dj7y/2cMd9vdqrM0JA8VSNAalacEH/mi8WckdqsczCk3bYsz+ZjongEY23wajI8MlwNBwMP/08/ez1",
129 "vLtP0+64X4erbQoEZK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HRdqMeMp",
142 "C82lEDs4FTHu4IVSiew0m4+Pj4138yRpcDFvRipp+gkEsklEsKAraLZvphIEBdm0Wpt27I34oXnaAK3W",
143 "Muxem1oSRuawBKYaCP3C/vkP1L5qtx1r4VDMCcseG0iMRkQoBkKiN+7Y++ggd+L5Dup2fddB/YnvOWji",
144 "98z/Jq7+T/etwXTjGAk6X5g7tk6d7YVXURXrc7bxttfwqR2JViCktb3VaDeutGs8AUYSqk+7cdW40nlH",
145 "1MIEo/ksc/bxwk2z6KHZkHB73wpIHM9I8M0sHqHP54y/GjMern9o1uzcFKEziY88XBtNnKnsyZYkSZwJ",
146 "N3+VVoFN3VO94HC22uynsCZfsyATzqStqvbV+8MMuOOoay1CbwpPgkXH3upDfnf14YXMletualkD8dMF",
147 "ED9piPdXV6+G0LIGonUBRMtCvLsA4p2FeH8BxHsD0brAkZZ1pHWBIy3rSOv6AohrA9G+eT1E+0ZDXF+Q",
148 "F9c2L64vCOq1DWoIEUlj9WqYrfzG/FP+8agrgCjQd10Gj+eM3roD6/5LthcVPOJS+QVC9PfoUPOmbkZ2",
149 "Hv96+lqzg9IzrN6jiVcPIGRpGnxBFS6zk1OguvIV5sH5/Vhz735zFmu2fm8DquIcojf+jo53r+PRXpd+",
150 "ix28ABJmN6gBr5vJNccTyuwQdz/2tiFk8BivLTyE+V3NQSQIuDAP2dvfLpRIAz3WomeS0DHnatMMSEKj",
151 "H+3Y2Vy1jjbb/GN2E92YRn9+Smy+s/939v+fYX8Hv6yYbMHHoKDqVVivn/tec9g0rHxt2/DLD0x/lCbi",
152 "HNe9fxzZT3173HzMnJ27L+xqp+bxyQJqwrRvHVoSFSwMQZceGL0QUYlsNpj71Pfp/Y/I399pr2Lotb91",
153 "banDvnrUzhvYwSsiKJnF+fuS3mdrKjMqfzOBJ7JMYmgEfInLE1cmWHpfzB8XrzVd7D/kaGsfNv8OAAD/",
157 // GetSwagger returns the content of the embedded swagger specification file
158 // or error if failed to decode
159 func decodeSpec() ([]byte, error) {
160 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
162 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
164 zr, err := gzip.NewReader(bytes.NewReader(zipped))
166 return nil, fmt.Errorf("error decompressing spec: %s", err)
169 _, err = buf.ReadFrom(zr)
171 return nil, fmt.Errorf("error decompressing spec: %s", err)
174 return buf.Bytes(), nil
177 var rawSpec = decodeSpecCached()
179 // a naive cached of a decoded swagger spec
180 func decodeSpecCached() func() ([]byte, error) {
181 data, err := decodeSpec()
182 return func() ([]byte, error) {
187 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
188 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
189 var res = make(map[string]func() ([]byte, error))
190 if len(pathToFile) > 0 {
191 res[pathToFile] = rawSpec
194 pathPrefix := path.Dir(pathToFile)
196 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "CommonData.yaml")) {
197 if _, ok := res[rawPath]; ok {
198 // it is not possible to compare functions in golang, so always overwrite the old value
200 res[rawPath] = rawFunc
202 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
203 if _, ok := res[rawPath]; ok {
204 // it is not possible to compare functions in golang, so always overwrite the old value
206 res[rawPath] = rawFunc
208 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Access_Control_Policy_API.yaml")) {
209 if _, ok := res[rawPath]; ok {
210 // it is not possible to compare functions in golang, so always overwrite the old value
212 res[rawPath] = rawFunc
214 for rawPath, rawFunc := range externalRef4.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Logging_API_Invocation_API.yaml")) {
215 if _, ok := res[rawPath]; ok {
216 // it is not possible to compare functions in golang, so always overwrite the old value
218 res[rawPath] = rawFunc
220 for rawPath, rawFunc := range externalRef5.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
221 if _, ok := res[rawPath]; ok {
222 // it is not possible to compare functions in golang, so always overwrite the old value
224 res[rawPath] = rawFunc
226 for rawPath, rawFunc := range externalRef6.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Routing_Info_API.yaml")) {
227 if _, ok := res[rawPath]; ok {
228 // it is not possible to compare functions in golang, so always overwrite the old value
230 res[rawPath] = rawFunc
232 for rawPath, rawFunc := range externalRef3.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
233 if _, ok := res[rawPath]; ok {
234 // it is not possible to compare functions in golang, so always overwrite the old value
236 res[rawPath] = rawFunc
241 // GetSwagger returns the Swagger specification corresponding to the generated code
242 // in this file. The external references of Swagger specification are resolved.
243 // The logic of resolving external references is tightly connected to "import-mapping" feature.
244 // Externally referenced files must be embedded in the corresponding golang packages.
245 // Urls can be supported but this task was out of the scope.
246 func GetSwagger() (swagger *openapi3.T, err error) {
247 var resolvePath = PathToRawSpec("")
249 loader := openapi3.NewLoader()
250 loader.IsExternalRefsAllowed = true
251 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
252 var pathToFile = url.String()
253 pathToFile = path.Clean(pathToFile)
254 getSpec, ok := resolvePath[pathToFile]
256 err1 := fmt.Errorf("path not found: %s", pathToFile)
262 specData, err = rawSpec()
266 swagger, err = loader.LoadFromData(specData)