// Package securityapi provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT. package securityapi import ( "bytes" "compress/gzip" "encoding/base64" "fmt" "net/http" "net/url" "path" "strings" "github.com/deepmap/oapi-codegen/pkg/runtime" "github.com/getkin/kin-openapi/openapi3" "github.com/labstack/echo/v4" externalRef0 "oransc.org/nonrtric/sme/internal/common29122" externalRef1 "oransc.org/nonrtric/sme/internal/common29571" externalRef2 "oransc.org/nonrtric/sme/internal/publishserviceapi" ) // ServerInterface represents all server handlers. type ServerInterface interface { // (POST /securities/{securityId}/token) PostSecuritiesSecurityIdToken(ctx echo.Context, securityId string) error // (DELETE /trustedInvokers/{apiInvokerId}) DeleteTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error // (GET /trustedInvokers/{apiInvokerId}) GetTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string, params GetTrustedInvokersApiInvokerIdParams) error // (PUT /trustedInvokers/{apiInvokerId}) PutTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error // (POST /trustedInvokers/{apiInvokerId}/delete) PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context, apiInvokerId string) error // (POST /trustedInvokers/{apiInvokerId}/update) PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context, apiInvokerId string) error } // ServerInterfaceWrapper converts echo contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface } // PostSecuritiesSecurityIdToken converts echo context to params. func (w *ServerInterfaceWrapper) PostSecuritiesSecurityIdToken(ctx echo.Context) error { var err error // ------------- Path parameter "securityId" ------------- var securityId string err = runtime.BindStyledParameterWithLocation("simple", false, "securityId", runtime.ParamLocationPath, ctx.Param("securityId"), &securityId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter securityId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostSecuritiesSecurityIdToken(ctx, securityId) return err } // DeleteTrustedInvokersApiInvokerId converts echo context to params. func (w *ServerInterfaceWrapper) DeleteTrustedInvokersApiInvokerId(ctx echo.Context) error { var err error // ------------- Path parameter "apiInvokerId" ------------- var apiInvokerId string err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.DeleteTrustedInvokersApiInvokerId(ctx, apiInvokerId) return err } // GetTrustedInvokersApiInvokerId converts echo context to params. func (w *ServerInterfaceWrapper) GetTrustedInvokersApiInvokerId(ctx echo.Context) error { var err error // ------------- Path parameter "apiInvokerId" ------------- var apiInvokerId string err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err)) } // Parameter object where we will unmarshal all parameters from the context var params GetTrustedInvokersApiInvokerIdParams // ------------- Optional query parameter "authenticationInfo" ------------- err = runtime.BindQueryParameter("form", true, false, "authenticationInfo", ctx.QueryParams(), ¶ms.AuthenticationInfo) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authenticationInfo: %s", err)) } // ------------- Optional query parameter "authorizationInfo" ------------- err = runtime.BindQueryParameter("form", true, false, "authorizationInfo", ctx.QueryParams(), ¶ms.AuthorizationInfo) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authorizationInfo: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.GetTrustedInvokersApiInvokerId(ctx, apiInvokerId, params) return err } // PutTrustedInvokersApiInvokerId converts echo context to params. func (w *ServerInterfaceWrapper) PutTrustedInvokersApiInvokerId(ctx echo.Context) error { var err error // ------------- Path parameter "apiInvokerId" ------------- var apiInvokerId string err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PutTrustedInvokersApiInvokerId(ctx, apiInvokerId) return err } // PostTrustedInvokersApiInvokerIdDelete converts echo context to params. func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context) error { var err error // ------------- Path parameter "apiInvokerId" ------------- var apiInvokerId string err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostTrustedInvokersApiInvokerIdDelete(ctx, apiInvokerId) return err } // PostTrustedInvokersApiInvokerIdUpdate converts echo context to params. func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context) error { var err error // ------------- Path parameter "apiInvokerId" ------------- var apiInvokerId string err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.PostTrustedInvokersApiInvokerIdUpdate(ctx, apiInvokerId) return err } // This is a simple interface which specifies echo.Route addition functions which // are present on both echo.Echo and echo.Group, since we want to allow using // either of them for path registration type EchoRouter interface { CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route } // RegisterHandlers adds each server route to the EchoRouter. func RegisterHandlers(router EchoRouter, si ServerInterface) { RegisterHandlersWithBaseURL(router, si, "") } // Registers handlers, and prepends BaseURL to the paths, so that the paths // can be served under a prefix. func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) { wrapper := ServerInterfaceWrapper{ Handler: si, } router.POST(baseURL+"/securities/:securityId/token", wrapper.PostSecuritiesSecurityIdToken) router.DELETE(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.DeleteTrustedInvokersApiInvokerId) router.GET(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.GetTrustedInvokersApiInvokerId) router.PUT(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.PutTrustedInvokersApiInvokerId) router.POST(baseURL+"/trustedInvokers/:apiInvokerId/delete", wrapper.PostTrustedInvokersApiInvokerIdDelete) router.POST(baseURL+"/trustedInvokers/:apiInvokerId/update", wrapper.PostTrustedInvokersApiInvokerIdUpdate) } // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ "H4sIAAAAAAAC/+xa/W7jNhJ/FUI9oLuAItnepNv4P6/jXbhoEyNyugf0AoOWxjYbidSSlJ1c4Ae617gn", "O5CUZH3ZTuKml94ZWGxsmTOcz98MR3y0fBbFjAKVwuo+WsJfQIT1x57vgxBjdgd0wLl6EoDwOYklYdTq", "WtcQcxCKEGGKgHPGEaFILgBhTYqkokUcviUgpGPZVsxZDFwS0BtoEv2BJpHV/c0idIlD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"/3NoKIZfQP7l0tquiqGPMcK0098r6u8bDiy72vdsbFiYKRVmPg0zxCd271rrbwnwh4La9flWg7J5w/+K", "2m4GEa+qbHnktlPX21fsL6pn9YZKOi6eaxuGf0XbpKGLplgdeZmpvtlxccZZtH1c6hyrxpusGq0fDmDx", "g2bRPkCK9rF2ba1dcaIZ+TgMp9i/2zc3esxehE9Z8PCdu2XlunhGfNoJ67mQ0zAmftKxak+fKjZ9alG3", "Yzv6NoGlfYAibaNI+wBF2kaR9tkBLM6O2NSMTTqdKwOmRP41j8qvgYB7my6fA5aA8Kbz0jvfSz26xLSi", "9D7kbP+ZshfmBUYNPetcAA60bx+tn9m29w4KyzGhplu/uR5mvSWFVfiQcUMcBEu4DzbCvs94oN+UmUsT", "QvLElwmHLnrEMblmTK5dH8dkdpJZ0l229w19nhMj6/8pXH8joHx4w3jE9VfB9b0DU3czLd3+omFHITBD", "1f+zcrCtIa6+NldCP+02l6oSvdFQX5x4QVtdgPD0ksbxeH7soo9d9JtD2yQO8AFoe2PIj813SV9jlfKF", "nqz9fgfO3EEcTijMmSS1denVwvdPAd7Wf6krN0FzhPQjpB8h/U8fjNiWvv+TAq255LTjqGrZ1hJzgqdh", "eu/VrDQtWypWfkkK7nEUh+D4LLKq+Z8SVi7gFW/fnSl0L1/ecpTMt+v/BAAA///ckgllpTUAAA==", } // GetSwagger returns the content of the embedded swagger specification file // or error if failed to decode func decodeSpec() ([]byte, error) { zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) if err != nil { return nil, fmt.Errorf("error base64 decoding spec: %s", err) } zr, err := gzip.NewReader(bytes.NewReader(zipped)) if err != nil { return nil, fmt.Errorf("error decompressing spec: %s", err) } var buf bytes.Buffer _, err = buf.ReadFrom(zr) if err != nil { return nil, fmt.Errorf("error decompressing spec: %s", err) } return buf.Bytes(), nil } var rawSpec = decodeSpecCached() // a naive cached of a decoded swagger spec func decodeSpecCached() func() ([]byte, error) { data, err := decodeSpec() return func() ([]byte, error) { return data, err } } // Constructs a synthetic filesystem for resolving external references when loading openapi specifications. func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { var res = make(map[string]func() ([]byte, error)) if len(pathToFile) > 0 { res[pathToFile] = rawSpec } pathPrefix := path.Dir(pathToFile) for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) { if _, ok := res[rawPath]; ok { // it is not possible to compare functions in golang, so always overwrite the old value } res[rawPath] = rawFunc } for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) { if _, ok := res[rawPath]; ok { // it is not possible to compare functions in golang, so always overwrite the old value } res[rawPath] = rawFunc } for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) { if _, ok := res[rawPath]; ok { // it is not possible to compare functions in golang, so always overwrite the old value } res[rawPath] = rawFunc } return res } // GetSwagger returns the Swagger specification corresponding to the generated code // in this file. The external references of Swagger specification are resolved. // The logic of resolving external references is tightly connected to "import-mapping" feature. // Externally referenced files must be embedded in the corresponding golang packages. // Urls can be supported but this task was out of the scope. func GetSwagger() (swagger *openapi3.T, err error) { var resolvePath = PathToRawSpec("") loader := openapi3.NewLoader() loader.IsExternalRefsAllowed = true loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { var pathToFile = url.String() pathToFile = path.Clean(pathToFile) getSpec, ok := resolvePath[pathToFile] if !ok { err1 := fmt.Errorf("path not found: %s", pathToFile) return nil, err1 } return getSpec() } var specData []byte specData, err = rawSpec() if err != nil { return } swagger, err = loader.LoadFromData(specData) if err != nil { return } return }