// 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/capifcore/internal/common29122" externalRef1 "oransc.org/nonrtric/capifcore/internal/common29571" externalRef2 "oransc.org/nonrtric/capifcore/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/W7bOBJ/FUJ7wLaAItlu0m79n5u4hRe7qRE52wO2hUFLY5sbiVRJyk4u8APda9yT", "HUhKsiRL/og3ve6tgaKxZc5wPn8zHPHR8lkUMwpUCqv7aAl/DhHWH3u+D0KM2B3QPufqSQDC5ySWhFGr", "a91AzEEoQoQpAs4ZR4QiOQeENSmSihZx+JqAkI5lWzFnMXBJQG+gSfQHmkR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3MTsSkIPpFFux7JDmHRgGSHsDivB4ADWDQBwP4sGgHgEBZbAGB/NgUAsK0Z1HR7H0D+5dLaroqh", "D+rCnBh/VNQ/1hzJtx1Ps6l2YWpamGrWjLj3PqBqvb8mwB8Kim/OcGvUzc+0z6jvetj2zOqWB8tbtf3y", "jE10dSJV05uNitObmhF30Tpp+KIJFsoUpsXMRiJTzqLmlwLKXKfa8T3WjtbrI1i8Ni3sEVK0TxWssYLF", "iWbk4zCcYP9u13T0MbuyMWHBww9uw8pVcRSy3yDhUNCpeR2y1/RgR7cq1t1qUbdTU/p9Akv7CEWajteH", "sGg4Xh/C4uKETQ3H65UZxhbnqIn8ax6YnwMBd7ZdPgcsAeF176V3vpd6Qo9pReldyNn+lrIXpgZGDX2F", "ZA440L59tH5hTW/XFJZjQk3HfnszyLpLCsvwIeOGOAiWcB9shH2f8UC/ETZXe4TkiS8TDugRx+SGMbly", "fRyT6VlmSHfR3jH50Z37/kGy+r8C9u8ElY/vGE/A/izAvnNu6q6Hps0v1LZUAjNb/ZvVg6aOuHo/RAm9", "351DVSZ6w4G+IfSEvrqA4eltJOfURp/a6FMb/b2hbRIH+Ai0vTXkp+67/EJaW6V8cy3rv1+AM3MQhzMK", "MybJxrr0Du3LfYC39T9qy03QnCD9BOknSP/mkxHb0jfcUqA1l/m2HFYt21pgTvAkTC94m5WmZUvFyi8D", "wj2O4hAcn0VWNf9Twso90/yS6YWC9vINRUcJ/GX13wAAAP//VbZhM004AAA=", } // 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 }