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/FUJ7wLaAItlu0m79n5u4hRe7qRE52wO2hUFLY5sbiVRJyk4u8APda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agger returns the content of the embedded swagger specification file
245 // or error if failed to decode
246 func decodeSpec() ([]byte, error) {
247 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
249 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
251 zr, err := gzip.NewReader(bytes.NewReader(zipped))
253 return nil, fmt.Errorf("error decompressing spec: %s", err)
256 _, err = buf.ReadFrom(zr)
258 return nil, fmt.Errorf("error decompressing spec: %s", err)
261 return buf.Bytes(), nil
264 var rawSpec = decodeSpecCached()
266 // a naive cached of a decoded swagger spec
267 func decodeSpecCached() func() ([]byte, error) {
268 data, err := decodeSpec()
269 return func() ([]byte, error) {
274 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
275 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
276 var res = make(map[string]func() ([]byte, error))
277 if len(pathToFile) > 0 {
278 res[pathToFile] = rawSpec
281 pathPrefix := path.Dir(pathToFile)
283 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
284 if _, ok := res[rawPath]; ok {
285 // it is not possible to compare functions in golang, so always overwrite the old value
287 res[rawPath] = rawFunc
289 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
290 if _, ok := res[rawPath]; ok {
291 // it is not possible to compare functions in golang, so always overwrite the old value
293 res[rawPath] = rawFunc
295 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
296 if _, ok := res[rawPath]; ok {
297 // it is not possible to compare functions in golang, so always overwrite the old value
299 res[rawPath] = rawFunc
304 // GetSwagger returns the Swagger specification corresponding to the generated code
305 // in this file. The external references of Swagger specification are resolved.
306 // The logic of resolving external references is tightly connected to "import-mapping" feature.
307 // Externally referenced files must be embedded in the corresponding golang packages.
308 // Urls can be supported but this task was out of the scope.
309 func GetSwagger() (swagger *openapi3.T, err error) {
310 var resolvePath = PathToRawSpec("")
312 loader := openapi3.NewLoader()
313 loader.IsExternalRefsAllowed = true
314 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
315 var pathToFile = url.String()
316 pathToFile = path.Clean(pathToFile)
317 getSpec, ok := resolvePath[pathToFile]
319 err1 := fmt.Errorf("path not found: %s", pathToFile)
325 specData, err = rawSpec()
329 swagger, err = loader.LoadFromData(specData)