1 // Package securityapi 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/common29122"
20 externalRef1 "oransc.org/nonrtric/capifcore/internal/common29571"
21 externalRef2 "oransc.org/nonrtric/capifcore/internal/publishserviceapi"
24 // ServerInterface represents all server handlers.
25 type ServerInterface interface {
27 // (POST /securities/{securityId}/token)
28 PostSecuritiesSecurityIdToken(ctx echo.Context, securityId string) error
30 // (DELETE /trustedInvokers/{apiInvokerId})
31 DeleteTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error
33 // (GET /trustedInvokers/{apiInvokerId})
34 GetTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string, params GetTrustedInvokersApiInvokerIdParams) error
36 // (PUT /trustedInvokers/{apiInvokerId})
37 PutTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error
39 // (POST /trustedInvokers/{apiInvokerId}/delete)
40 PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context, apiInvokerId string) error
42 // (POST /trustedInvokers/{apiInvokerId}/update)
43 PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context, apiInvokerId string) error
46 // ServerInterfaceWrapper converts echo contexts to parameters.
47 type ServerInterfaceWrapper struct {
48 Handler ServerInterface
51 // PostSecuritiesSecurityIdToken converts echo context to params.
52 func (w *ServerInterfaceWrapper) PostSecuritiesSecurityIdToken(ctx echo.Context) error {
54 // ------------- Path parameter "securityId" -------------
57 err = runtime.BindStyledParameterWithLocation("simple", false, "securityId", runtime.ParamLocationPath, ctx.Param("securityId"), &securityId)
59 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter securityId: %s", err))
62 // Invoke the callback with all the unmarshalled arguments
63 err = w.Handler.PostSecuritiesSecurityIdToken(ctx, securityId)
67 // DeleteTrustedInvokersApiInvokerId converts echo context to params.
68 func (w *ServerInterfaceWrapper) DeleteTrustedInvokersApiInvokerId(ctx echo.Context) error {
70 // ------------- Path parameter "apiInvokerId" -------------
71 var apiInvokerId string
73 err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
75 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
78 // Invoke the callback with all the unmarshalled arguments
79 err = w.Handler.DeleteTrustedInvokersApiInvokerId(ctx, apiInvokerId)
83 // GetTrustedInvokersApiInvokerId converts echo context to params.
84 func (w *ServerInterfaceWrapper) GetTrustedInvokersApiInvokerId(ctx echo.Context) error {
86 // ------------- Path parameter "apiInvokerId" -------------
87 var apiInvokerId string
89 err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
91 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
94 // Parameter object where we will unmarshal all parameters from the context
95 var params GetTrustedInvokersApiInvokerIdParams
96 // ------------- Optional query parameter "authenticationInfo" -------------
98 err = runtime.BindQueryParameter("form", true, false, "authenticationInfo", ctx.QueryParams(), ¶ms.AuthenticationInfo)
100 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authenticationInfo: %s", err))
103 // ------------- Optional query parameter "authorizationInfo" -------------
105 err = runtime.BindQueryParameter("form", true, false, "authorizationInfo", ctx.QueryParams(), ¶ms.AuthorizationInfo)
107 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authorizationInfo: %s", err))
110 // Invoke the callback with all the unmarshalled arguments
111 err = w.Handler.GetTrustedInvokersApiInvokerId(ctx, apiInvokerId, params)
115 // PutTrustedInvokersApiInvokerId converts echo context to params.
116 func (w *ServerInterfaceWrapper) PutTrustedInvokersApiInvokerId(ctx echo.Context) error {
118 // ------------- Path parameter "apiInvokerId" -------------
119 var apiInvokerId string
121 err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
123 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
126 // Invoke the callback with all the unmarshalled arguments
127 err = w.Handler.PutTrustedInvokersApiInvokerId(ctx, apiInvokerId)
131 // PostTrustedInvokersApiInvokerIdDelete converts echo context to params.
132 func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context) error {
134 // ------------- Path parameter "apiInvokerId" -------------
135 var apiInvokerId string
137 err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
139 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
142 // Invoke the callback with all the unmarshalled arguments
143 err = w.Handler.PostTrustedInvokersApiInvokerIdDelete(ctx, apiInvokerId)
147 // PostTrustedInvokersApiInvokerIdUpdate converts echo context to params.
148 func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context) error {
150 // ------------- Path parameter "apiInvokerId" -------------
151 var apiInvokerId string
153 err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
155 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
158 // Invoke the callback with all the unmarshalled arguments
159 err = w.Handler.PostTrustedInvokersApiInvokerIdUpdate(ctx, apiInvokerId)
163 // This is a simple interface which specifies echo.Route addition functions which
164 // are present on both echo.Echo and echo.Group, since we want to allow using
165 // either of them for path registration
166 type EchoRouter interface {
167 CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
168 DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
169 GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
170 HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
171 OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
172 PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
173 POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
174 PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
175 TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
178 // RegisterHandlers adds each server route to the EchoRouter.
179 func RegisterHandlers(router EchoRouter, si ServerInterface) {
180 RegisterHandlersWithBaseURL(router, si, "")
183 // Registers handlers, and prepends BaseURL to the paths, so that the paths
184 // can be served under a prefix.
185 func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
187 wrapper := ServerInterfaceWrapper{
191 router.POST(baseURL+"/securities/:securityId/token", wrapper.PostSecuritiesSecurityIdToken)
192 router.DELETE(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.DeleteTrustedInvokersApiInvokerId)
193 router.GET(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.GetTrustedInvokersApiInvokerId)
194 router.PUT(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.PutTrustedInvokersApiInvokerId)
195 router.POST(baseURL+"/trustedInvokers/:apiInvokerId/delete", wrapper.PostTrustedInvokersApiInvokerIdDelete)
196 router.POST(baseURL+"/trustedInvokers/:apiInvokerId/update", wrapper.PostTrustedInvokersApiInvokerIdUpdate)
200 // Base64 encoded, gzipped, json marshaled Swagger object
201 var swaggerSpec = []string{
203 "H4sIAAAAAAAC/+xa/W7jNhJ/FUI9oLuAItnepNv4P6/jXbhoEyNyugf0AoOWxjYbidSSlJ1c4Ae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I70aXaczrLVtfWh9fCaQ5Pq4ilaz+PEAFj8qFqevY5YB501mGRTHgc2G0VSu5ImQEKQ9",
230 "jnAfiw3P2sBHCBLqKXOhn4/L9L1yu/R6aVPpy56ZOKVwPa2D5CVDfeMo9K4QYdoUhQEC3BNVK+aqiufk",
231 "799czL2IhaLVLNoHsGgbFh8OYPHBsDg9gMWpZtE5fzmLzrlicXaAOc+MOc8OsMWZsUUAM5yE8sVsMnqd",
232 "/3NoKIZfQP7l0tquiqGPMcK0098r6u8bDiy72vdsbFiYKRVmPg0zxCd271rrbwnwh4La9flWg7J5w/+K",
233 "2m4GEa+qbHnktlPX21fsL6pn9YZKOi6eaxuGf0XbpKGLplgdeZmpvtlxccZZtH1c6hyrxpusGq0fDmDx",
234 "g2bRPkCK9rF2ba1dcaIZ+TgMp9i/2zc3esxehE9Z8PCdu2XlunhGfNoJ67mQ0zAmftKxak+fKjZ9alG3",
235 "Yzv6NoGlfYAibaNI+wBF2kaR9tkBLM6O2NSMTTqdKwOmRP41j8qvgYB7my6fA5aA8Kbz0jvfSz26xLSi",
236 "9D7kbP+ZshfmBUYNPetcAA60bx+tn9m29w4KyzGhplu/uR5mvSWFVfiQcUMcBEu4DzbCvs94oN+UmUsT",
237 "QvLElwmHLnrEMblmTK5dH8dkdpJZ0l229w19nhMj6/8pXH8joHx4w3jE9VfB9b0DU3czLd3+omFHITBD",
238 "1f+zcrCtIa6+NldCP+02l6oSvdFQX5x4QVtdgPD0ksbxeH7soo9d9JtD2yQO8AFoe2PIj813SV9jlfKF",
239 "nqz9fgfO3EEcTijMmSS1denVwvdPAd7Wf6krN0FzhPQjpB8h/U8fjNiWvv+TAq255LTjqGrZ1hJzgqdh",
240 "eu/VrDQtWypWfkkK7nEUh+D4LLKq+Z8SVi7gFW/fnSl0L1/ecpTMt+v/BAAA///ckgllpTUAAA==",
243 // GetSwagger returns the content of the embedded swagger specification file
244 // or error if failed to decode
245 func decodeSpec() ([]byte, error) {
246 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
248 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
250 zr, err := gzip.NewReader(bytes.NewReader(zipped))
252 return nil, fmt.Errorf("error decompressing spec: %s", err)
255 _, err = buf.ReadFrom(zr)
257 return nil, fmt.Errorf("error decompressing spec: %s", err)
260 return buf.Bytes(), nil
263 var rawSpec = decodeSpecCached()
265 // a naive cached of a decoded swagger spec
266 func decodeSpecCached() func() ([]byte, error) {
267 data, err := decodeSpec()
268 return func() ([]byte, error) {
273 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
274 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
275 var res = make(map[string]func() ([]byte, error))
276 if len(pathToFile) > 0 {
277 res[pathToFile] = rawSpec
280 pathPrefix := path.Dir(pathToFile)
282 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
283 if _, ok := res[rawPath]; ok {
284 // it is not possible to compare functions in golang, so always overwrite the old value
286 res[rawPath] = rawFunc
288 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
289 if _, ok := res[rawPath]; ok {
290 // it is not possible to compare functions in golang, so always overwrite the old value
292 res[rawPath] = rawFunc
294 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
295 if _, ok := res[rawPath]; ok {
296 // it is not possible to compare functions in golang, so always overwrite the old value
298 res[rawPath] = rawFunc
303 // GetSwagger returns the Swagger specification corresponding to the generated code
304 // in this file. The external references of Swagger specification are resolved.
305 // The logic of resolving external references is tightly connected to "import-mapping" feature.
306 // Externally referenced files must be embedded in the corresponding golang packages.
307 // Urls can be supported but this task was out of the scope.
308 func GetSwagger() (swagger *openapi3.T, err error) {
309 var resolvePath = PathToRawSpec("")
311 loader := openapi3.NewLoader()
312 loader.IsExternalRefsAllowed = true
313 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
314 var pathToFile = url.String()
315 pathToFile = path.Clean(pathToFile)
316 getSpec, ok := resolvePath[pathToFile]
318 err1 := fmt.Errorf("path not found: %s", pathToFile)
324 specData, err = rawSpec()
328 swagger, err = loader.LoadFromData(specData)