// 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/FUJ7wLaAItlu0m79n+u4hRe7qRE52wO2gUFLY5sbiVRJyk4u8APda9yT", "HUhKsmRL/og3veytgaKxZfJHztdvhiM+Wj6LYkaBSmG1Hy3hzyDC+mPH90GIIbsD2uNcPQlA+JzEkjBq", "ta1riDkINRFhioBzxhGhSM4AYT0VSTUXcfiWgJCOZVsxZzFwSUAvoKfoDzSJr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", "swq4Yqhrwh69KlCoVkWhRQb3RBVDUySScT799Ysj1SdBnBuPTUnwiRDNaiY7BKKGyQ6BOK8mgAMg6ghg", "f4haAjgEYgsB7A9TIADbmkJFtfcJ5F8urO31beiDujAnxh/V7B8rjuTbjqdZY7zQNS10NSu65HsfULXc", "3xLgDwXBN3u4FeLmZ9pnlHfVbHtmccuN5a3S3j5jEb3ekaqozYbF7k1Fi7uondR90RgLpQpTYmYtkQln", "Uf1LAaWuU+54ibmj8fYIiLemhD1iF81TBqvNYHGigXwchmPs3+3qjj5mtz7GLHj4wa0ZuSy2QvZrJBxK", "OhWvQ/bqHuyoVsWqWi3KdipKXyaxNI8QpO54fQhEzfH6EIiLEzfVHK+Xphlb7KMm8q95YH4OBtxZdvkc", "sASEV7WXXvle6g49pmtC72LO5vfce6FrYMTQt1BmgANt20frF1b3dk1xOSbUVOw31/2suqSwCB8yNMRB", "sIT7YCPs+4wH+o2wuR0kJE98mXBAjzgm14zJpevjmEzOMkW68+aOzo+u3Pd3kuX/FbG/EFY+vmI8Efuz", "EPvOvqm7aprWv1DbkglMb/Vvlg/qKuL1+yFq0/tdW1RpojPo6xtCT6irCxye3kZyTmX0qYw+ldEvjW2T", "OMBHsO2NmX6qvssvpLVWyjfXsvr7FThTB3E4ozBlkmyMS+/Qvt6HeBv/o7LcOM2J0k+UfqL0794ZsS19", "wy0lWnOZb8th1bKtOeYEj8P0grcZaUq2dFv5ZUC4x1EcguOzyFqP/3Ti2j3T/JLphaL28g1FR234dvnf", "AAAA///vfrHakDgAAA==", } // 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 }