Moving add client in keycloak from security to invoker api
[nonrtric/plt/sme.git] / capifcore / internal / securityapi / securityapi-server.gen.go
1 // Package securityapi provides primitives to interact with the openapi HTTP API.
2 //
3 // Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
4 package securityapi
5
6 import (
7         "bytes"
8         "compress/gzip"
9         "encoding/base64"
10         "fmt"
11         "net/http"
12         "net/url"
13         "path"
14         "strings"
15
16         "github.com/deepmap/oapi-codegen/pkg/runtime"
17         "github.com/getkin/kin-openapi/openapi3"
18         "github.com/labstack/echo/v4"
19         externalRef0 "oransc.org/nonrtric/capifcore/internal/common29122"
20         externalRef1 "oransc.org/nonrtric/capifcore/internal/common29571"
21         externalRef2 "oransc.org/nonrtric/capifcore/internal/publishserviceapi"
22 )
23
24 // ServerInterface represents all server handlers.
25 type ServerInterface interface {
26
27         // (POST /securities/{securityId}/token)
28         PostSecuritiesSecurityIdToken(ctx echo.Context, securityId string) error
29
30         // (DELETE /trustedInvokers/{apiInvokerId})
31         DeleteTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error
32
33         // (GET /trustedInvokers/{apiInvokerId})
34         GetTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string, params GetTrustedInvokersApiInvokerIdParams) error
35
36         // (PUT /trustedInvokers/{apiInvokerId})
37         PutTrustedInvokersApiInvokerId(ctx echo.Context, apiInvokerId string) error
38
39         // (POST /trustedInvokers/{apiInvokerId}/delete)
40         PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context, apiInvokerId string) error
41
42         // (POST /trustedInvokers/{apiInvokerId}/update)
43         PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context, apiInvokerId string) error
44 }
45
46 // ServerInterfaceWrapper converts echo contexts to parameters.
47 type ServerInterfaceWrapper struct {
48         Handler ServerInterface
49 }
50
51 // PostSecuritiesSecurityIdToken converts echo context to params.
52 func (w *ServerInterfaceWrapper) PostSecuritiesSecurityIdToken(ctx echo.Context) error {
53         var err error
54         // ------------- Path parameter "securityId" -------------
55         var securityId string
56
57         err = runtime.BindStyledParameterWithLocation("simple", false, "securityId", runtime.ParamLocationPath, ctx.Param("securityId"), &securityId)
58         if err != nil {
59                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter securityId: %s", err))
60         }
61
62         // Invoke the callback with all the unmarshalled arguments
63         err = w.Handler.PostSecuritiesSecurityIdToken(ctx, securityId)
64         return err
65 }
66
67 // DeleteTrustedInvokersApiInvokerId converts echo context to params.
68 func (w *ServerInterfaceWrapper) DeleteTrustedInvokersApiInvokerId(ctx echo.Context) error {
69         var err error
70         // ------------- Path parameter "apiInvokerId" -------------
71         var apiInvokerId string
72
73         err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
74         if err != nil {
75                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
76         }
77
78         // Invoke the callback with all the unmarshalled arguments
79         err = w.Handler.DeleteTrustedInvokersApiInvokerId(ctx, apiInvokerId)
80         return err
81 }
82
83 // GetTrustedInvokersApiInvokerId converts echo context to params.
84 func (w *ServerInterfaceWrapper) GetTrustedInvokersApiInvokerId(ctx echo.Context) error {
85         var err error
86         // ------------- Path parameter "apiInvokerId" -------------
87         var apiInvokerId string
88
89         err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
90         if err != nil {
91                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
92         }
93
94         // Parameter object where we will unmarshal all parameters from the context
95         var params GetTrustedInvokersApiInvokerIdParams
96         // ------------- Optional query parameter "authenticationInfo" -------------
97
98         err = runtime.BindQueryParameter("form", true, false, "authenticationInfo", ctx.QueryParams(), &params.AuthenticationInfo)
99         if err != nil {
100                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authenticationInfo: %s", err))
101         }
102
103         // ------------- Optional query parameter "authorizationInfo" -------------
104
105         err = runtime.BindQueryParameter("form", true, false, "authorizationInfo", ctx.QueryParams(), &params.AuthorizationInfo)
106         if err != nil {
107                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter authorizationInfo: %s", err))
108         }
109
110         // Invoke the callback with all the unmarshalled arguments
111         err = w.Handler.GetTrustedInvokersApiInvokerId(ctx, apiInvokerId, params)
112         return err
113 }
114
115 // PutTrustedInvokersApiInvokerId converts echo context to params.
116 func (w *ServerInterfaceWrapper) PutTrustedInvokersApiInvokerId(ctx echo.Context) error {
117         var err error
118         // ------------- Path parameter "apiInvokerId" -------------
119         var apiInvokerId string
120
121         err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
122         if err != nil {
123                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
124         }
125
126         // Invoke the callback with all the unmarshalled arguments
127         err = w.Handler.PutTrustedInvokersApiInvokerId(ctx, apiInvokerId)
128         return err
129 }
130
131 // PostTrustedInvokersApiInvokerIdDelete converts echo context to params.
132 func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdDelete(ctx echo.Context) error {
133         var err error
134         // ------------- Path parameter "apiInvokerId" -------------
135         var apiInvokerId string
136
137         err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
138         if err != nil {
139                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
140         }
141
142         // Invoke the callback with all the unmarshalled arguments
143         err = w.Handler.PostTrustedInvokersApiInvokerIdDelete(ctx, apiInvokerId)
144         return err
145 }
146
147 // PostTrustedInvokersApiInvokerIdUpdate converts echo context to params.
148 func (w *ServerInterfaceWrapper) PostTrustedInvokersApiInvokerIdUpdate(ctx echo.Context) error {
149         var err error
150         // ------------- Path parameter "apiInvokerId" -------------
151         var apiInvokerId string
152
153         err = runtime.BindStyledParameterWithLocation("simple", false, "apiInvokerId", runtime.ParamLocationPath, ctx.Param("apiInvokerId"), &apiInvokerId)
154         if err != nil {
155                 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apiInvokerId: %s", err))
156         }
157
158         // Invoke the callback with all the unmarshalled arguments
159         err = w.Handler.PostTrustedInvokersApiInvokerIdUpdate(ctx, apiInvokerId)
160         return err
161 }
162
163 // This is a simple interface which specifies echo.Route addition functions which
164 // are present on both echo.Echo and echo.Group, since we want to allow using
165 // either of them for path registration
166 type EchoRouter interface {
167         CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
168         DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
169         GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
170         HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
171         OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
172         PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
173         POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
174         PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
175         TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
176 }
177
178 // RegisterHandlers adds each server route to the EchoRouter.
179 func RegisterHandlers(router EchoRouter, si ServerInterface) {
180         RegisterHandlersWithBaseURL(router, si, "")
181 }
182
183 // Registers handlers, and prepends BaseURL to the paths, so that the paths
184 // can be served under a prefix.
185 func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
186
187         wrapper := ServerInterfaceWrapper{
188                 Handler: si,
189         }
190
191         router.POST(baseURL+"/securities/:securityId/token", wrapper.PostSecuritiesSecurityIdToken)
192         router.DELETE(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.DeleteTrustedInvokersApiInvokerId)
193         router.GET(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.GetTrustedInvokersApiInvokerId)
194         router.PUT(baseURL+"/trustedInvokers/:apiInvokerId", wrapper.PutTrustedInvokersApiInvokerId)
195         router.POST(baseURL+"/trustedInvokers/:apiInvokerId/delete", wrapper.PostTrustedInvokersApiInvokerIdDelete)
196         router.POST(baseURL+"/trustedInvokers/:apiInvokerId/update", wrapper.PostTrustedInvokersApiInvokerIdUpdate)
197
198 }
199
200 // Base64 encoded, gzipped, json marshaled Swagger object
201 var swaggerSpec = []string{
202
203         "H4sIAAAAAAAC/+xa/W7bOBJ/FUJ7wLaAItlu0m79n5u4hRe7qRE52wO2hUFLY5sbiVRJyk4u8APda9yT",
204         "HUhKsiRL/og3ve6tgaKxZc5wPn8zHPHR8lkUMwpUCqv7aAl/DhHWH3u+D0KM2B3QPufqSQDC5ySWhFGr",
205         "a91AzEEoQoQpAs4ZR4QiOQeENSmSihZx+JqAkI5lWzFnMXBJQG+gSfQHmkRW93eL0AUOSTBOKSw7f+KH",
206         "BGjxwYxj/T2hOJFzxsm/oLAqoSKJY8YlpCvH8iGGArnwWQzWF9vSz7uWkJzQmbWyjVDjkqaPTasSTmp+",
207         "XdmWUoBwCJRSRsv1VmzyB/hSMSkY+Aa+bjVwk1ERoVPGI6wolIHNF6tr3Z8tl8sz9fUs4SFQnwUQbHjA",
208         "GGxMglol018F+Bxk7YqCbQtuTOl8DgFQSXAoai1tfLDTfiX/rQXeZVARH2pQETMqoGrRssEMyViTbPL/",
209         "+ZOHLlkUY18iDzjBoQpLxLNtNVPEpkgtFGRGIUA/ex+vkVEBvSgocBliEomXn6lVF6T3MeEgxkQL8Q8O",
210         "U6trjbzO23anM75kUcToFZbYecBR+IO7znA3TW/3KuFaGA/8ba6wLa3phoffAebAa7xa8V3JXCVmJR3q",
211         "fHmJEwGbJh4yIcgkBLTAYQICYQ7dz/QMffytf/PL4NfBaHzr9T70u2g0B8Rhwfzc6NrlKViUHvaGA0To",
212         "gt0BR0SgIAEkmf6FLYCHJCISJQLPICMQwBfE14Rq79vr/j+H/ctR/2p80+95H6//hN0TCvcx+FKHDxaM",
213         "OjoSMgdU1LVsa0OI2pzzwE84kQ+DdZDvTBNCJfAp9gEFIDEJFdwHqR0MNxSBnLOgJl1gOgg2NxhoXJgS",
214         "4EUjwH3MBKEzNE2or1fWKIBjUsdRGzHnWkuYyLn63XhE6V/DpbQGcQixckABEZo4515tZrx2/J58c7tf",
215         "GbNXUr2jUr03HLwfD5NJSMR87JmwHPeGg+bMH6y5riVcKcfBNIuOX7U7xaYeXtnhAikq4BwCNHnYiOYp",
216         "44Vn6bYqSIiE6E9SpyyyUiQidGD4t3OjYs7xgwY6CCsUzyJFBQbrbFuHedmaa6bi2N+dngpi7iCoAAst",
217         "kGc5u3duejr+smR6UJ+1D/vvncZ8FPukeAE0iyGwwXGr/9R2JroOkb0Qk1ikdTeNV+1s5DMOOezU6uln",
218         "5SgNltowMDVrowgWZc4tlrGsjwNtqiwcdiJ0hsu5pUtZqvMQsD8vuqCQkOjTHCgi1A+ToDaRbURUoxmo",
219         "kAKz4zrv0z3YNN+2gWGNpWsYV2WXDE0AJQKCHE7qtdDlsRzhxTy4AiEJzTPqCS3TLSdW6lkQcgRCbk9T",
220         "D6RuI3gCygTFIJQs798bLKOWCKABwkiqZaWUxgIFMCVUlxD1zw9VKKE3zmsHpdtOcSgAMY5YRKQqNkzO",
221         "gS+JSC2VxtyEsRAwNdC4bg2UNlWQ3gp8xX7C5DCJVKdSB8HZyew9YJlwqBaCizftvfzhbfBZ2dYSJoL5",
222         "d9ozl4xOyeyJ3v60yaia1yWD2Y3RtpngK93BS+AUh1fMr0HPVx+GQzTyUOet0+l00G/tN86F00JGcB1K",
223         "7zmOYMn4nU4Lvf6acTmfsIQGaoVCmISHVteaSxmLrusul0vn1SyOHcZn7lTGrheDL1zM/TlZgNt5OxbA",
224         "CQjX7OqaHqS2nRkO9LYmcNcpiymeQQRUOgh9pv/5N+q0Oh3bSPeRzzBNKxQO0RBzSYEL9KJ3M3hno95o",
225         "4Nno8tLr2ag/8gY2GnlX+s+op/67fKl59sIQcTKb69qngACCNJ6JDJWNTfHOwnJsis0CuDCSt52O01KK",
226         "sRgojomytdNyWgo7sJxrV7ipQsoUj7mTg5Wbn/piJvR5WIGN6foCczSRXk6aZ0YwSk8/MVY+k8CF1f19",
227         "e73EVMPiggQJDovQoUcYVlcLq2IOR7pM5XtZxRBV0GOnE526c/aXHM3esUBXGZ9RCVTrhuM4TKPZrR8m",
228         "5NOiXSBRmXOsyomkpNQPzPlbu6DTam0R5w9h8Pbw3UVsdq8gdaKXTJMQmcVIr0Y36RhqZVuvWm8OBJJc",
229         "H1fRahY/HcHiJ8Xi/HnM0ue8ziz94kSvyTDnrfY3FOm2MO0zu786sHqsbapoNYvzI1icaxbt9tNZtNuG",
230         "xRGKtI0i7YsjWFxoFp23T2fReatYXJgQfRILRatZvDqChbZFAFOchPLJbDL6lY5BV/JESAjSLl64j8WW",
231         "fmXqYwgSNmvClX4+KtP3ygeC56sLlZPHgZWhhMfnm13ANUOXJu3RiwKEalMU5ltwT1QzNEMimeTkL787",
232         "UH0Si3MTsSkIPpFFux7JDmHRgGSHsDivB4ADWDQBwP4sGgHgEBZbAGB/NgUAsK0Z1HR7H0D+5dLaroqh",
233         "D+rCnBh/VNQ/1hzJtx1Ps6l2YWpamGrWjLj3PqBqvb8mwB8Kim/OcGvUzc+0z6jvetj2zOqWB8tbtf3y",
234         "jE10dSJV05uNitObmhF30Tpp+KIJFsoUpsXMRiJTzqLmlwLKXKfa8T3WjtbrI1i8Ni3sEVK0TxWssYLF",
235         "iWbk4zCcYP9u13T0MbuyMWHBww9uw8pVcRSy3yDhUNCpeR2y1/RgR7cq1t1qUbdTU/p9Akv7CEWajteH",
236         "sGg4Xh/C4uKETQ3H65UZxhbnqIn8ax6YnwMBd7ZdPgcsAeF176V3vpd6Qo9pReldyNn+lrIXpgZGDX2F",
237         "ZA440L59tH5hTW/XFJZjQk3HfnszyLpLCsvwIeOGOAiWcB9shH2f8UC/ETZXe4TkiS8TDugRx+SGMbly",
238         "fRyT6VlmSHfR3jH50Z37/kGy+r8C9u8ElY/vGE/A/izAvnNu6q6Hps0v1LZUAjNb/ZvVg6aOuHo/RAm9",
239         "351DVSZ6w4G+IfSEvrqA4eltJOfURp/a6FMb/b2hbRIH+Ai0vTXkp+67/EJaW6V8cy3rv1+AM3MQhzMK",
240         "MybJxrr0Du3LfYC39T9qy03QnCD9BOknSP/mkxHb0jfcUqA1l/m2HFYt21pgTvAkTC94m5WmZUvFyi8D",
241         "wj2O4hAcn0VWNf9Twso90/yS6YWC9vINRUcJ/GX13wAAAP//VbZhM004AAA=",
242 }
243
244 // GetSwagger returns the content of the embedded swagger specification file
245 // or error if failed to decode
246 func decodeSpec() ([]byte, error) {
247         zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
248         if err != nil {
249                 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
250         }
251         zr, err := gzip.NewReader(bytes.NewReader(zipped))
252         if err != nil {
253                 return nil, fmt.Errorf("error decompressing spec: %s", err)
254         }
255         var buf bytes.Buffer
256         _, err = buf.ReadFrom(zr)
257         if err != nil {
258                 return nil, fmt.Errorf("error decompressing spec: %s", err)
259         }
260
261         return buf.Bytes(), nil
262 }
263
264 var rawSpec = decodeSpecCached()
265
266 // a naive cached of a decoded swagger spec
267 func decodeSpecCached() func() ([]byte, error) {
268         data, err := decodeSpec()
269         return func() ([]byte, error) {
270                 return data, err
271         }
272 }
273
274 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
275 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
276         var res = make(map[string]func() ([]byte, error))
277         if len(pathToFile) > 0 {
278                 res[pathToFile] = rawSpec
279         }
280
281         pathPrefix := path.Dir(pathToFile)
282
283         for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
284                 if _, ok := res[rawPath]; ok {
285                         // it is not possible to compare functions in golang, so always overwrite the old value
286                 }
287                 res[rawPath] = rawFunc
288         }
289         for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29222_CAPIF_Publish_Service_API.yaml")) {
290                 if _, ok := res[rawPath]; ok {
291                         // it is not possible to compare functions in golang, so always overwrite the old value
292                 }
293                 res[rawPath] = rawFunc
294         }
295         for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
296                 if _, ok := res[rawPath]; ok {
297                         // it is not possible to compare functions in golang, so always overwrite the old value
298                 }
299                 res[rawPath] = rawFunc
300         }
301         return res
302 }
303
304 // GetSwagger returns the Swagger specification corresponding to the generated code
305 // in this file. The external references of Swagger specification are resolved.
306 // The logic of resolving external references is tightly connected to "import-mapping" feature.
307 // Externally referenced files must be embedded in the corresponding golang packages.
308 // Urls can be supported but this task was out of the scope.
309 func GetSwagger() (swagger *openapi3.T, err error) {
310         var resolvePath = PathToRawSpec("")
311
312         loader := openapi3.NewLoader()
313         loader.IsExternalRefsAllowed = true
314         loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
315                 var pathToFile = url.String()
316                 pathToFile = path.Clean(pathToFile)
317                 getSpec, ok := resolvePath[pathToFile]
318                 if !ok {
319                         err1 := fmt.Errorf("path not found: %s", pathToFile)
320                         return nil, err1
321                 }
322                 return getSpec()
323         }
324         var specData []byte
325         specData, err = rawSpec()
326         if err != nil {
327                 return
328         }
329         swagger, err = loader.LoadFromData(specData)
330         if err != nil {
331                 return
332         }
333         return
334 }