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/sme/internal/common29122"
21 externalRef1 "oransc.org/nonrtric/sme/internal/common29571"
22 externalRef2 "oransc.org/nonrtric/sme/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+lR20h3aGIkXaimPdVDvJaCaTqJaaS5PxwOSSREMCKABKcT18oL5Gn6yz",
194 "oKgotmVHlnvoRT/k7rff7gcsFjcsVbVWEqWzbHzTBgy/ODSSV+cqpScsQ5saoZ1Qko3Z0ZvZDBZzSE7D",
195 "JEngQ3wSxuEQzlRdKwmT2RReG17jSpnPkCsD3v6dMq68Uo3MyMKygDWmYmNWOqfHUbRarcKjQutQmSLK",
196 "nY7mGlMbcZOWYolRcnpp0Qi0URc0Ym3AhMzVXXYUn6LyJhNOyCL8KP/5G5JhEgcdk/em4FL8xcmeVzDj",
197 "xkk0Fn6aXEx/CWCymM4DODubTwJ4tZhPA1jMz/3XYkIfZz+HH+WkqsCIonQWDFo0S8zCj5IFzAlXIRuz",
198 "s8ls+vpysuZwOZlNWcCWaGxHMg6TcDjglS55GFMuSqPkWlB1w2E4ZAHT3JW++BHXYiqXKvWM36rCPy3Q",
199 "3c391wbNNXCZgUFnBC4RiJxI0csiNihQqcKCdcpgBkqCKxE8ZUiVQcgbmZJZyDwz432mGRuzN+gmd+gQ",
200 "WVLcobFs/PttVnNnhCxAZCidyK/pN8UjRvhFK0sPtiMKcvqTUmEBk7ymenLMByJjAbNpiTWn1N21pjfW",
201 "o7O2DfaIS5X4jAZWpUjL9b/Mv92q104uWgzWAE/gxI0DJ2oElfuAW6L4x4bLAneFJouBtxhYQvom+I8G",
202 "czZmi3lyGifJZbcfz7nj4TWvqx+ir7s86pxsdM4dLkSN91F9JbNnIYoy+y9pPqpy9qCOe+pHsOQegHAg",
203 "LFh0wC3ccC3e8Rpb0KTvumK/XUzBOtOkrjFIZhnmQmIGQoJtrtKKNxbhODwmh62uOhrGD3H2P/di/aFr",
204 "PD0vSqJb+Stuv6dKfePaK+jMKKdSVT0WQK/tdi2ShBaJb6ez5qoStrycd3uUuuruNdOHv4/a+76ngSu5",
205 "265C3wwf2P6bhvjMhDek7mN8gbapHCgDqnG6cXc35S66xnvuJx0t5T6C1ZiKXKR00KnGpPiYnr3dd63T",
206 "VEmH0h9lXOtKdLlEf1jicfOs9Z1KhybnKZ5v5dq2bXAr+Y0dbD3f3jrr3r8rf2vSgegx2P87yZ0iZ2jd",
207 "rSy/DbBQkIvKoQFhDFa45NLREtJKWqSpqeKOjlwFjbSN1srQ3xw59Uq7q7S94WDL8N7yjU7i7zpZ5j3i",
208 "6x6wbT8FbEOUYJPhkL4OU/GtKor1JHj5dXx6TMytMes+Ffuu0MnmiwWb9gS8UrKAlXAl5OjSErMHpkHI",
209 "qE40ih4NT/Y8pjfVisjXQ7w8AOIlQRx3RX8SBPl6iPgAiLiDODoA4qiDOD4A4riDeHEAxAsPER/AIu5Y",
210 "JKdPh0hOCWJ0gKijTtTRAYqMOkUyzDkdiU+F6f3b1m9Jf/1bX3y6Oy1NgxdKuTaia1a0jOnux43gV1XX",
211 "Udbvuwvcmoy/CdtxFOEXXusKw1TV7PaGXzvunCVPwtGtWTJJkpCYfmr/DQAA//8fy/fu5w8AAA==",
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)