// Package accesscontrolpolicyapi 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 accesscontrolpolicyapi 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/common29571" ) // ServerInterface represents all server handlers. type ServerInterface interface { // (GET /accessControlPolicyList/{serviceApiId}) GetAccessControlPolicyListServiceApiId(ctx echo.Context, serviceApiId string, params GetAccessControlPolicyListServiceApiIdParams) error } // ServerInterfaceWrapper converts echo contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface } // GetAccessControlPolicyListServiceApiId converts echo context to params. func (w *ServerInterfaceWrapper) GetAccessControlPolicyListServiceApiId(ctx echo.Context) error { var err error // ------------- Path parameter "serviceApiId" ------------- var serviceApiId string err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err)) } // Parameter object where we will unmarshal all parameters from the context var params GetAccessControlPolicyListServiceApiIdParams // ------------- Required query parameter "aef-id" ------------- err = runtime.BindQueryParameter("form", true, true, "aef-id", ctx.QueryParams(), ¶ms.AefId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter aef-id: %s", err)) } // ------------- Optional query parameter "api-invoker-id" ------------- err = runtime.BindQueryParameter("form", true, false, "api-invoker-id", ctx.QueryParams(), ¶ms.ApiInvokerId) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter api-invoker-id: %s", err)) } // ------------- Optional query parameter "supported-features" ------------- err = runtime.BindQueryParameter("form", true, false, "supported-features", ctx.QueryParams(), ¶ms.SupportedFeatures) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter supported-features: %s", err)) } // Invoke the callback with all the unmarshalled arguments err = w.Handler.GetAccessControlPolicyListServiceApiId(ctx, serviceApiId, params) 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.GET(baseURL+"/accessControlPolicyList/:serviceApiId", wrapper.GetAccessControlPolicyListServiceApiId) } // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ "H4sIAAAAAAAC/6xX3W7bOBN9lQG/72IXUCRbqZvGd16nKYxdbI3Y2Ju2MGhpZLGVSJak7HoDP9C+xj7Z", "YkjFP7XdP/cmTuSZM2eGh2eUR5apWiuJ0lnWf2Q2K7Hm/tdBlqG1QyWdUdVYVSJb/yGso69ytJkR2gkl", "WZ89oDZoCQFcicB9HmQhEbTPhEpYB4U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bpt6UzL4Xe/A4n+Pr3mC7idefmO712Sz6hXA/x4gKI", "FwTxLMzghyAo10N0L4DoBojrCyCuA8SzCyCeBYjnF0A89xDdC1h0A4v09sch0luC6F1wqL1wqL0LTqQX", "TiTHgjeV+2GYp/zNxl8ivwFb3w+L/pFr8aCU27SL66rdNVdh1yTLLq1AbgSfV9t/nSghrK6W3fZ9AT/x", "WlcYZ6pmn9/ZNhG4hRwLQe+bQkJW8cYi3MQ98t7Dlxii/W7zXwAAAP//Y6DD0EcOAAA=", } // 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, "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 }