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/W7bOBJ/FUJ7wLaAItlu0m79n+u4hRe7qRE52wO2gUFLY5sbiVRJyk4u8APda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FR234dvnf",
242 "AAAA///vfrHakDgAAA==",
245 // GetSwagger returns the content of the embedded swagger specification file
246 // or error if failed to decode
247 func decodeSpec() ([]byte, error) {
248 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
250 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
252 zr, err := gzip.NewReader(bytes.NewReader(zipped))
254 return nil, fmt.Errorf("error decompressing spec: %s", err)
257 _, err = buf.ReadFrom(zr)
259 return nil, fmt.Errorf("error decompressing spec: %s", err)
262 return buf.Bytes(), nil
265 var rawSpec = decodeSpecCached()
267 // a naive cached of a decoded swagger spec
268 func decodeSpecCached() func() ([]byte, error) {
269 data, err := decodeSpec()
270 return func() ([]byte, error) {
275 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
276 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
277 var res = make(map[string]func() ([]byte, error))
278 if len(pathToFile) > 0 {
279 res[pathToFile] = rawSpec
282 pathPrefix := path.Dir(pathToFile)
284 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
285 if _, ok := res[rawPath]; ok {
286 // it is not possible to compare functions in golang, so always overwrite the old value
288 res[rawPath] = rawFunc
290 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
291 if _, ok := res[rawPath]; ok {
292 // it is not possible to compare functions in golang, so always overwrite the old value
294 res[rawPath] = rawFunc
296 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
297 if _, ok := res[rawPath]; ok {
298 // it is not possible to compare functions in golang, so always overwrite the old value
300 res[rawPath] = rawFunc
305 // GetSwagger returns the Swagger specification corresponding to the generated code
306 // in this file. The external references of Swagger specification are resolved.
307 // The logic of resolving external references is tightly connected to "import-mapping" feature.
308 // Externally referenced files must be embedded in the corresponding golang packages.
309 // Urls can be supported but this task was out of the scope.
310 func GetSwagger() (swagger *openapi3.T, err error) {
311 var resolvePath = PathToRawSpec("")
313 loader := openapi3.NewLoader()
314 loader.IsExternalRefsAllowed = true
315 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
316 var pathToFile = url.String()
317 pathToFile = path.Clean(pathToFile)
318 getSpec, ok := resolvePath[pathToFile]
320 err1 := fmt.Errorf("path not found: %s", pathToFile)
326 specData, err = rawSpec()
330 swagger, err = loader.LoadFromData(specData)