1 // Package auditingapi 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.
17 "github.com/deepmap/oapi-codegen/pkg/runtime"
18 "github.com/getkin/kin-openapi/openapi3"
19 "github.com/labstack/echo/v4"
20 externalRef0 "oransc.org/nonrtric/capifcore/internal/common29122"
21 externalRef1 "oransc.org/nonrtric/capifcore/internal/common29571"
22 externalRef2 "oransc.org/nonrtric/capifcore/internal/publishserviceapi"
25 // ServerInterface represents all server handlers.
26 type ServerInterface interface {
28 // (GET /apiInvocationLogs)
29 GetApiInvocationLogs(ctx echo.Context, params GetApiInvocationLogsParams) error
32 // ServerInterfaceWrapper converts echo contexts to parameters.
33 type ServerInterfaceWrapper struct {
34 Handler ServerInterface
37 // GetApiInvocationLogs converts echo context to params.
38 func (w *ServerInterfaceWrapper) GetApiInvocationLogs(ctx echo.Context) error {
41 // Parameter object where we will unmarshal all parameters from the context
42 var params GetApiInvocationLogsParams
43 // ------------- Optional query parameter "aef-id" -------------
45 err = runtime.BindQueryParameter("form", true, false, "aef-id", ctx.QueryParams(), ¶ms.AefId)
47 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter aef-id: %s", err))
50 // ------------- Optional query parameter "api-invoker-id" -------------
52 err = runtime.BindQueryParameter("form", true, false, "api-invoker-id", ctx.QueryParams(), ¶ms.ApiInvokerId)
54 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter api-invoker-id: %s", err))
57 // ------------- Optional query parameter "time-range-start" -------------
59 err = runtime.BindQueryParameter("form", true, false, "time-range-start", ctx.QueryParams(), ¶ms.TimeRangeStart)
61 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter time-range-start: %s", err))
64 // ------------- Optional query parameter "time-range-end" -------------
66 err = runtime.BindQueryParameter("form", true, false, "time-range-end", ctx.QueryParams(), ¶ms.TimeRangeEnd)
68 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter time-range-end: %s", err))
71 // ------------- Optional query parameter "api-id" -------------
73 err = runtime.BindQueryParameter("form", true, false, "api-id", ctx.QueryParams(), ¶ms.ApiId)
75 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter api-id: %s", err))
78 // ------------- Optional query parameter "api-name" -------------
80 err = runtime.BindQueryParameter("form", true, false, "api-name", ctx.QueryParams(), ¶ms.ApiName)
82 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter api-name: %s", err))
85 // ------------- Optional query parameter "api-version" -------------
87 err = runtime.BindQueryParameter("form", true, false, "api-version", ctx.QueryParams(), ¶ms.ApiVersion)
89 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter api-version: %s", err))
92 // ------------- Optional query parameter "protocol" -------------
94 err = runtime.BindQueryParameter("form", true, false, "protocol", ctx.QueryParams(), ¶ms.Protocol)
96 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter protocol: %s", err))
99 // ------------- Optional query parameter "operation" -------------
101 err = runtime.BindQueryParameter("form", true, false, "operation", ctx.QueryParams(), ¶ms.Operation)
103 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter operation: %s", err))
106 // ------------- Optional query parameter "result" -------------
108 err = runtime.BindQueryParameter("form", true, false, "result", ctx.QueryParams(), ¶ms.Result)
110 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter result: %s", err))
113 // ------------- Optional query parameter "resource-name" -------------
115 err = runtime.BindQueryParameter("form", true, false, "resource-name", ctx.QueryParams(), ¶ms.ResourceName)
117 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter resource-name: %s", err))
120 // ------------- Optional query parameter "src-interface" -------------
122 if paramValue := ctx.QueryParam("src-interface"); paramValue != "" {
124 var value externalRef2.InterfaceDescription
125 err = json.Unmarshal([]byte(paramValue), &value)
127 return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter 'src-interface' as JSON")
129 params.SrcInterface = &value
133 // ------------- Optional query parameter "dest-interface" -------------
135 if paramValue := ctx.QueryParam("dest-interface"); paramValue != "" {
137 var value externalRef2.InterfaceDescription
138 err = json.Unmarshal([]byte(paramValue), &value)
140 return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter 'dest-interface' as JSON")
142 params.DestInterface = &value
146 // ------------- Optional query parameter "supported-features" -------------
148 err = runtime.BindQueryParameter("form", true, false, "supported-features", ctx.QueryParams(), ¶ms.SupportedFeatures)
150 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter supported-features: %s", err))
153 // Invoke the callback with all the unmarshalled arguments
154 err = w.Handler.GetApiInvocationLogs(ctx, params)
158 // This is a simple interface which specifies echo.Route addition functions which
159 // are present on both echo.Echo and echo.Group, since we want to allow using
160 // either of them for path registration
161 type EchoRouter interface {
162 CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
163 DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
164 GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
165 HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
166 OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
167 PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
168 POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
169 PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
170 TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
173 // RegisterHandlers adds each server route to the EchoRouter.
174 func RegisterHandlers(router EchoRouter, si ServerInterface) {
175 RegisterHandlersWithBaseURL(router, si, "")
178 // Registers handlers, and prepends BaseURL to the paths, so that the paths
179 // can be served under a prefix.
180 func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
182 wrapper := ServerInterfaceWrapper{
186 router.GET(baseURL+"/apiInvocationLogs", wrapper.GetApiInvocationLogs)
190 // Base64 encoded, gzipped, json marshaled Swagger object
191 var swaggerSpec = []string{
193 "H4sIAAAAAAAC/9RXzXLbNhB+lR20h3aGIiXaimPdVDvJaCaTqJaaS5PRIOSSREMCKABKcT18oL5Gn6yz",
194 "oKgotmRblnvoRT/k7rff7gcsFjcsUZVWEqWzbHTTBAy/OjSSl5cqoScsRZsYoZ1Qko3YyZvpFOYziM/D",
195 "OI7hw+AsfBH24UJVlZIwnk7gteEVrpT5Apky4O3fKeOKz6qWKVlYFrDalGzECue0HUXRarUKT3KtQ2Xy",
196 "KHM6mmlMbMRNUoglRvH5wqIRaKM2asSagAmZqbv0iACF5XUqnJB5CPBR/vM3xP04Dloy703OpfiLkwcv",
197 "YcqNk2gs/DS+mvwSwHg+mQVwcTEbB/BqPpsEMJ9d+q/5mD4ufvaY47IEI/LCWTBo0SwxDT9KFjAnXIls",
198 "xC7G08nrxXjNYzGeTljAlmhsS3QQxuGA8lAaJdeCShv2wz4LmOau8JWPuBYTuVSJ5/pW5f5pju5u3r/W",
199 "aK6ByxQMOiNwiUCkRIJeE7FBgVLlFqxTBlNQElyB4KlCogxCVsuEzELmmRnvM0nZiL1BN75Dh8iS3A6N",
200 "ZaPfb7OaOSNkDiJF6UR2Tb8pHjHCr1pZerAdUZDTn5QKC5jkFdWRY9YTKQuYTQqsOKXurjW9sR6dNU1w",
201 "QFyqxBc0sCpEUqz/pf7tVr32ctGitwZ4AiduHDhRIajMB9wSxT82XOa4LzRZ9LxFzxLSd8F/NJixEZvP",
202 "4vNBHC/azXjJHQ+veVX+EH3b4lHrZKNL7nAuKtxF9ZVMn4UoyvS/pPmgyum9Oh6oH8GSewDCgbBg0QG3",
203 "cMO1eMcrbECTvuuK/XY1AetMnbjaIJmlmAmJKQgJSclrizAM4/CU7Lc66iCO2yayj7T/eRDtD23H6YhR",
204 "Fu3SX3H7mDJ1HeugoFOjnEpU+VAAvbbbt0piWiW+j07rz6WwxWLWblJqp/sXTRd+F7X3XVMDV3C3XYWu",
205 "G96z/zcd8ZkJb0jtYnyFti4dKAOqdrp2d3flPrrGex4mHa3lLoLVmIhMJHTCqdok+JCend2j1mmipEPp",
206 "zzKudSnaXKI/LPG4edb6TqRDk/EEL7dybZomuJX8xg62nm9vnXXz35e/NUlPdBjs/53kXpFTtO5Wlt8H",
207 "mCvIROnQgDAGS1xy6WgJaSUt0rhUckdnroJa2lprZehvhpyapd1X2s6wt2W4s3zDs8GjjpZZh/i6A2ya",
208 "TwHbECXYuN+nr+NUfKvyfD0CLr7NTw+JuTVn7VKx6wqtbL5YsGlPwEslc1gJV0CGLikwvWcchJTq9FHS",
209 "NHrSPzvwpN7UKyJfD/HyCIiXBHHalv1JEOTrIQZHQAxaiJMjIE5aiNMjIE5biBdHQLzwEIMjWAxaFvH5",
210 "0yHic4IYHiHqsBV1eIQiw1aRFDNOh+JTYTr/pvGb0t/81nef9k5LA+GVUq6J6KYVLQd07eNG8M9l21PW",
211 "79s73JrM5iaMX3mlSwwTVbHbW37tuHucPAuHt4bJOI5Dovmp+TcAAP//gET/GuQPAAA=",
214 // GetSwagger returns the content of the embedded swagger specification file
215 // or error if failed to decode
216 func decodeSpec() ([]byte, error) {
217 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
219 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
221 zr, err := gzip.NewReader(bytes.NewReader(zipped))
223 return nil, fmt.Errorf("error decompressing spec: %s", err)
226 _, err = buf.ReadFrom(zr)
228 return nil, fmt.Errorf("error decompressing spec: %s", err)
231 return buf.Bytes(), nil
234 var rawSpec = decodeSpecCached()
236 // a naive cached of a decoded swagger spec
237 func decodeSpecCached() func() ([]byte, error) {
238 data, err := decodeSpec()
239 return func() ([]byte, error) {
244 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
245 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
246 var res = make(map[string]func() ([]byte, error))
247 if len(pathToFile) > 0 {
248 res[pathToFile] = rawSpec
251 pathPrefix := path.Dir(pathToFile)
253 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
254 if _, ok := res[rawPath]; ok {
255 // it is not possible to compare functions in golang, so always overwrite the old value
257 res[rawPath] = rawFunc
259 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
260 if _, ok := res[rawPath]; ok {
261 // it is not possible to compare functions in golang, so always overwrite the old value
263 res[rawPath] = rawFunc
265 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
266 if _, ok := res[rawPath]; ok {
267 // it is not possible to compare functions in golang, so always overwrite the old value
269 res[rawPath] = rawFunc
274 // GetSwagger returns the Swagger specification corresponding to the generated code
275 // in this file. The external references of Swagger specification are resolved.
276 // The logic of resolving external references is tightly connected to "import-mapping" feature.
277 // Externally referenced files must be embedded in the corresponding golang packages.
278 // Urls can be supported but this task was out of the scope.
279 func GetSwagger() (swagger *openapi3.T, err error) {
280 var resolvePath = PathToRawSpec("")
282 loader := openapi3.NewLoader()
283 loader.IsExternalRefsAllowed = true
284 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
285 var pathToFile = url.String()
286 pathToFile = path.Clean(pathToFile)
287 getSpec, ok := resolvePath[pathToFile]
289 err1 := fmt.Errorf("path not found: %s", pathToFile)
295 specData, err = rawSpec()
299 swagger, err = loader.LoadFromData(specData)